Skip to content

Commit

Permalink
[Docathon][Add API Legend No.18]为roll API 添加插图 (PaddlePaddle#6810)
Browse files Browse the repository at this point in the history
* Modify the roll API documentation

* fix document

* update

* update and  fix roll_cn.rst
  • Loading branch information
haoyu2022 authored and molly committed Sep 4, 2024
1 parent 2c16d84 commit 0f1efa3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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.

0 comments on commit 0f1efa3

Please sign in to comment.