From e1c752b7cb33e281ef7d4138e7ca5483720d9c76 Mon Sep 17 00:00:00 2001 From: yiyanzhi_akane Date: Wed, 8 Mar 2023 10:18:41 +0800 Subject: [PATCH] fix bug: tuple_slice when start, stop, step are unknown --- .../mindspore/ops/composite/multitype_ops/getitem_impl.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mindspore/python/mindspore/ops/composite/multitype_ops/getitem_impl.py b/mindspore/python/mindspore/ops/composite/multitype_ops/getitem_impl.py index d4fb3e22fd7..9bbc54acaa8 100644 --- a/mindspore/python/mindspore/ops/composite/multitype_ops/getitem_impl.py +++ b/mindspore/python/mindspore/ops/composite/multitype_ops/getitem_impl.py @@ -137,6 +137,12 @@ def _tuple_getitem_by_slice(data, slice_index): start = slice_getitem(slice_index, "start") stop = slice_getitem(slice_index, "stop") step = slice_getitem(slice_index, "step") + if start is None: + start = 0 + if step is None: + step = 1 + if stop is None: + stop = (2**31-1) if step >= 1 else 0 return sequence_slice(data, start, stop, step) return _tuple_slice(data, slice_index)