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.20]add the picture of scatter_nd #6931

Open
wants to merge 3 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
9 changes: 9 additions & 0 deletions docs/api/paddle/scatter_nd_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ scatter_nd

根据 :code:`index`,将 :code:`updates` 添加到一个新的 Tensor 中,从而得到输出的 Tensor。这个操作与 :code:`scatter_nd_add` 类似,除了形状为 :code:`shape` 的 Tensor 是通过零初始化的。相应地,:code:`scatter_nd(index, updates, shape)` 等价于 :code:`scatter_nd_add(fluid.layers.zeros(shape, updates.dtype), index, updates)`。如果 :code:`index` 有重复元素,则将累积相应的更新,因此,由于数值近似问题,索引中重复元素的顺序不同可能会导致不同的输出结果。具体的计算方法可以参见 :code:`scatter_nd_add`。该 OP 是 :code:`gather_nd` 的反函数。

**图解说明**:

下图展示了一个形状为 [3, 4] 的张量,使用 paddle.scatter_nd 操作根据 index 指定的位置更新张量为对应的 update 的数据。通过比较,可以清晰地看到张量形状变化前后各元素的对应关系。

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

参数
::::::::::::

Expand Down
Binary file added docs/images/api_legend/scatter_nd.png
Copy link
Collaborator

Choose a reason for hiding this comment

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

很棒,最好也写上 shape 的参数值

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.