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.55、22] add paddle.index_fill and paddle.shard_index doc image example #6939

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
8 changes: 8 additions & 0 deletions docs/api/paddle/index_fill_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ index_fill

Tensor,返回一个数据类型同输入的 Tensor。

**图解说明**:

一个形状为 [3, 3] 的二维张量,通过 index_fill 操作,当 axis = 0,索引张量 index 为 [0, 2],填充值 value = -1 时,将第一行和第三行的所有元素填充为 -1,从而得到形状仍为 [3, 3] 但元素部分改变的新张量。

.. figure:: ../../images/api_legend/index_fill.png
:width: 500
:align: center

代码示例
::::::::::::

Expand Down
9 changes: 9 additions & 0 deletions docs/api/paddle/shard_index_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ shard_index
::::::::::::
Tensor

**图解说明**:

一个形状为[2, 1]的二维张量,通过 shard_index 操作,当 index_num = 20,nshards = 2,shard_id = 0 时,计算分片大小 shard_size = (20 + 2 - 1) // 2 = 10。对于 label 中的元素值,如 16,因为 16 >= 10(不在分片 0 的[0, 10)区间内),根据公式其值被设为 ignore_value(即 -1);而元素值 1,由于 0 <= 1 < 10(在分片 0 内),更新后值为 1 - 0 * 10 = 1,最终得到形状仍为[2, 1]但元素部分改变的新张量(如 shard_label)。

.. figure:: ../../images/api_legend/shard_index.png
:width: 500
:align: center


代码示例
::::::::::::

Expand Down
Binary file added docs/images/api_legend/index_fill.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/shard_index.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.