未验证 提交 96741379 编写于 作者: Y Yuang Liu 提交者: GitHub

en doc update for roll (#42810)

上级 b189e83f
...@@ -1489,7 +1489,8 @@ def roll(x, shifts, axis=None, name=None): ...@@ -1489,7 +1489,8 @@ def roll(x, shifts, axis=None, name=None):
x (Tensor): The x tensor as input. x (Tensor): The x tensor as input.
shifts (int|list|tuple): The number of places by which the elements shifts (int|list|tuple): The number of places by which the elements
of the `x` tensor are shifted. of the `x` tensor are shifted.
axis (int|list|tuple|None): axis(axes) along which to roll. axis (int|list|tuple, optional): axis(axes) along which to roll. Default: None
name (str, optional): Name for the operation. Default: None
Returns: Returns:
Tensor: A Tensor with same data type as `x`. Tensor: A Tensor with same data type as `x`.
...@@ -1512,6 +1513,11 @@ def roll(x, shifts, axis=None, name=None): ...@@ -1512,6 +1513,11 @@ def roll(x, shifts, axis=None, name=None):
#[[7. 8. 9.] #[[7. 8. 9.]
# [1. 2. 3.] # [1. 2. 3.]
# [4. 5. 6.]] # [4. 5. 6.]]
out_z3 = paddle.roll(x, shifts=1, axis=1)
print(out_z3)
#[[3. 1. 2.]
# [6. 4. 5.]
# [9. 7. 8.]]
""" """
origin_shape = x.shape origin_shape = x.shape
if type(shifts) == int: if type(shifts) == int:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册