mindspore/docs/api/api_python/ops/mindspore.ops.func_roll.rst

18 lines
871 B
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.roll
===================
.. py:function:: mindspore.ops.roll(x, shifts, dims=None)
沿轴移动Tensor的元素。
参数:
- **x** (Tensor) - 输入Tensor。
- **shifts** (Union[list(int), tuple(int), int]) - 指定元素移动方式,如果为正数,则元素沿指定维度正向移动(朝向较大的索引)的位置数。负偏移将向相反的方向滚动元素。
- **dims** (Union[list(int), tuple(int), int], optional) - 指定需移动维度的轴。默认值None。如果dims为None则会将输入Tensor展平后再进行roll计算然后将计算结果reshape为输入的shape。
返回:
Tensorshape和数据类型与输入 `x` 相同。
异常:
- **TypeError** - `shifts` 不是int、tuple或list。
- **TypeError** - `dims` 不是int、tuple或list。