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

fix examplce code of slice api (#47735)

上级 130db92a
...@@ -183,13 +183,13 @@ def slice(input, axes, starts, ends): ...@@ -183,13 +183,13 @@ def slice(input, axes, starts, ends):
starts = [-3, 0, 2] starts = [-3, 0, 2]
ends = [3, 2, 4] ends = [3, 2, 4]
sliced_1 = paddle.slice(input, axes=axes, starts=starts, ends=ends) sliced_1 = paddle.slice(input, axes=axes, starts=starts, ends=ends)
# sliced_1 is input[0:3, 0:2, 2:4]. # sliced_1 is input[1:3, 0:2, 2:4].
# example 2: # example 2:
# attr starts is a list which contain tensor. # attr starts is a list which contain tensor.
minus_3 = paddle.full([1], -3, "int32") minus_3 = paddle.full([1], -3, "int32")
sliced_2 = paddle.slice(input, axes=axes, starts=[minus_3, 0, 2], ends=ends) sliced_2 = paddle.slice(input, axes=axes, starts=[minus_3, 0, 2], ends=ends)
# sliced_2 is input[0:3, 0:2, 2:4]. # sliced_2 is input[1:3, 0:2, 2:4].
""" """
if in_dygraph_mode(): if in_dygraph_mode():
attrs = () attrs = ()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册