forked from mindspore-Ecosystem/mindspore
!49957 fix bug: tuple_slice when start, stop, step are unknown
Merge pull request !49957 from Yanzhi_YI/master
This commit is contained in:
commit
47e14294dd
|
@ -137,6 +137,12 @@ def _tuple_getitem_by_slice(data, slice_index):
|
||||||
start = slice_getitem(slice_index, "start")
|
start = slice_getitem(slice_index, "start")
|
||||||
stop = slice_getitem(slice_index, "stop")
|
stop = slice_getitem(slice_index, "stop")
|
||||||
step = slice_getitem(slice_index, "step")
|
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 sequence_slice(data, start, stop, step)
|
||||||
return _tuple_slice(data, slice_index)
|
return _tuple_slice(data, slice_index)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue