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.51] add a figure of unfold method and update unfold_cn.rst #6951

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions docs/api/paddle/unfold_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ unfold

仅在动态图下可用,返回的 Tensor 和 x 共享内存。

下图展示了一个元素值为 0-8 且 Shape 为 [9] 的 Tensor 如何使用 ``unfold`` 方法在第一个维度(axis = 0),使用大小为 2 的窗口(size = 0)根据 4 的步长(step = 4)进行采样。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size = 0 是不是写错了


.. image:: ../../images/api_legend/unfold.png
:width: 700
:alt: 图例

参数
:::::::::

Expand Down
8 changes: 8 additions & 0 deletions docs/api/paddle/unsqueeze_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ unsqueeze
请注意,在动态图模式下,输出 Tensor 将与输入 Tensor 共享数据,并且没有 Tensor 数据拷贝的过程。
如果不希望输入与输出共享数据,请使用 `Tensor.clone`,例如 `unsqueeze_clone_x = x.unsqueeze(-1).clone()` 。

下图展示了一个 Shape 为 [2, 3] 的 Tensor 如何使用 ``unsqueeze`` 方法在最后一个位置(axis = 2)增加一个维度,从二维变成三维。

.. image:: ../../images/api_legend/unsqueeze.png
:width: 700
:alt: 图例

额外的,当需要在多个位置增加维度时, ``unsqueeze`` 方法会按顺序依次增加维度。例如 Shape 为 [2, 3] 的 Tensor 在 axis = [0, 2] 处增加维度, ``unsqueeze`` 方法会先在 axis = 0 前插入一个维度, Shape 变为 [1, 2, 3],接着在 axis = 2 前插入一个维度, Shape 最终变为 [1, 2, 1, 3]。

参数
:::::::::
- **x** (Tensor) - 输入的 `Tensor`,数据类型为:bfloat16、float32、float64、bool、int8、int32、int64。
Expand Down
Binary file added docs/images/api_legend/unfold.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/api_legend/unsqueeze.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.