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

[SCU][Add API Legend No.21] Add the legend of scatter_nd_add_cn #6964

Merged
merged 13 commits into from
Dec 5, 2024

Conversation

ndyysheep
Copy link
Contributor

No description provided.

Copy link

paddle-bot bot commented Nov 14, 2024

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-6964.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html
预览工具的更多说明,请参考:飞桨文档预览工具

@CLAassistant
Copy link

CLAassistant commented Nov 14, 2024

CLA assistant check
All committers have signed the CLA.

@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Nov 14, 2024
Copy link
Collaborator

Choose a reason for hiding this comment

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

英文文档是直接从 源码 里抽取docstring再自动转成rst的,不用手写,这块儿全删了吧

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的,我将英文文档删除

@@ -57,4 +57,13 @@ Tensor,数据类型和形状都与 :code:`x` 相同。
代码示例
::::::::::::

COPY-FROM: paddle.scatter_nd_add
Copy link
Collaborator

Choose a reason for hiding this comment

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

为什么把这块儿删了? 这部分是引用源码里的代码示例

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已经添加上去了

@@ -57,4 +57,13 @@ Tensor,数据类型和形状都与 :code:`x` 相同。
代码示例
::::::::::::

COPY-FROM: paddle.scatter_nd_add

output = [0, 22, 12, 14, 4, 5]
Copy link
Collaborator

Choose a reason for hiding this comment

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

这部分是笔误了多加了么

Comment on lines 63 to 69
**示例一图解说明**:

在这个示例中,通过 Paddle 的 scatter_nd_add 函数对张量 x 进行稀疏加法操作。初始张量 x 为 [0, 1, 2, 3, 4, 5],通过 index 指定需要更新的索引位置,并使用 updates 中的值进行累加。scatter_nd_add 函数会根据 index 的位置逐步累加 updates 中的对应值,而不是替换原有值,最终得到输出张量为 [0, 22, 12, 14, 4, 5],实现了对张量部分元素的累加更新而保持其他元素不变。
.. figure:: ../../images/api_legend/scatter_nd_add.png
:width: 700
:alt: 示例一图示
:align: center
Copy link
Collaborator

Choose a reason for hiding this comment

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

图解部分放在 参数 板块上面,即api简介的那部分。 而不是替换原有值 有些多余,可以删掉

Copy link
Collaborator

Choose a reason for hiding this comment

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

红色虚线框似乎会增加图片的理解难度,可以删掉。 +9 可以放在方向键的左侧保持统一

@@ -41,6 +41,9 @@ scatter_nd_add

output = [[67, 19], [-16, -27]]

**示例一图解说明**:

在这个示例中,通过 Paddle 的 scatter_nd_add 函数对张量 x 进行稀疏加法操作。初始张量 x 为 [0, 1, 2, 3, 4, 5],通过 index 指定需要更新的索引位置,并使用 updates 中的值进行累加。scatter_nd_add 函数会根据 index 的位置逐步累加 updates 中的对应值,最终得到输出张量为 [0, 22, 12, 14, 4, 5],实现了对张量部分元素的累加更新而保持其他元素不变。
Copy link
Collaborator

Choose a reason for hiding this comment

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

图例的引用也放在文字说明下面呀

Copy link
Contributor Author

@ndyysheep ndyysheep left a comment

Choose a reason for hiding this comment

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

修改了引用的位置

Copy link
Collaborator

Choose a reason for hiding this comment

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

文件名少了个d

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已经修改

Copy link
Collaborator

@sunzhongkai588 sunzhongkai588 left a comment

Choose a reason for hiding this comment

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

LGTM~

@luotao1 luotao1 merged commit 51d3332 into PaddlePaddle:develop Dec 5, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants