Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docathon][Add API Legend No.18]为roll API 添加插图 #6810

Merged
merged 4 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/api/paddle/roll_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,18 @@ roll
- **axis** (int|list|tuple,可选) – 滚动轴。默认值为 None。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

下图展示了一个形状为 ``[[1,2,3],[4,5,6],[7,8,9]]`` 的二维张量通过 ``roll`` 操作转变为形状不同的张量。

.. image:: ../../images/api_legend/roll.png
:width: 700
:align: center
:alt: 图例

- 当 ``axis = None`` 时,张量会被展平成一维,然后进行循环滚动,再恢复原状
- 当 ``axis=0`` 时,张量沿着 0 轴方向进行循环滚动
- 当 ``axis=1`` 时,张量沿着 1 轴方向进行循环滚动

由于 ``axis`` 参数的取值不同,对应的滚动操作也不同,由图可以看到每个元素在不同滚动操作下的位置变化。

返回
:::::::::
Expand Down
Binary file added docs/images/api_legend/roll.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.