未验证 提交 27a91b1a 编写于 作者: Z zyfncg 提交者: GitHub

Adjust the slice end in getitem (#41681)

* adjust the slice end in getitem

* fix bug

* fix bug

* fix bug

* recover start change
上级 b61fa16a
...@@ -375,7 +375,13 @@ def _getitem_impl_(var, item): ...@@ -375,7 +375,13 @@ def _getitem_impl_(var, item):
if start is None: if start is None:
start = 0 if step > 0 else MAX_INTEGER start = 0 if step > 0 else MAX_INTEGER
if end is None: if end is None:
end = MAX_INTEGER if step > 0 else -1 if var.shape[dim] != -1 and (
paddle.fluid.framework._non_static_mode() or
var.desc.type() != core.VarDesc.VarType.LOD_TENSOR_ARRAY
):
end = var.shape[dim] if step > 0 else -1
else:
end = MAX_INTEGER if step > 0 else -1
elif isinstance(slice_item, list): elif isinstance(slice_item, list):
all_bool = True all_bool = True
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册