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

映射文档 No. 34 #5825

Closed
wants to merge 2 commits into from
Closed

Conversation

cccbbbttt
Copy link

update md

:wq
i
te -v
:wq

git commit -m''add new md''#
@paddle-bot
Copy link

paddle-bot bot commented Apr 23, 2023

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

@cccbbbttt cccbbbttt changed the title :wq 映射文档 NO. 34 Apr 24, 2023
@cccbbbttt cccbbbttt changed the title 映射文档 NO. 34 映射文档 No. 34 Apr 24, 2023
@cccbbbttt
Copy link
Author

您好,请您check一下PR@Tomoko-hjf

Copy link
Collaborator

@huajiao-hjyp huajiao-hjyp left a comment

Choose a reason for hiding this comment

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

转写示例如果使用的是具体的数值,需要用torch.tensor()或paddle.to_tensor()处理一下,不然运行不能通过,尽量给用户正确的示例~

| dim | axis | 表示在哪一个维度 scatter ,仅参数名不一致。 |
| index | indices | 表示输入的索引张量,仅参数名不一致。 |
| src | values | 表示需要插入的值,仅参数名不一致。 |
| reduce | reduce | 表示对输出 Tensor 的计算方式,与 PyTorch 默认值不同+ Paddle 保持默认即可。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里如果不指定的话都是直接覆盖吧,所以只写 表示对输出 Tensor 的计算方式。就可以
image

| dim | axis | 表示在哪一个维度 scatter ,仅参数名不一致。 |
| index | indices | 表示输入的索引张量,仅参数名不一致。 |
| src | values | 表示需要插入的值,仅参数名不一致。 |
| - | reduce | 表示对输出 Tensor 的计算方式, PyTorch 无此参数+ Paddle 应设置为 add 。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

+号换成号吧~

reduce='assign')
```

两者功能一致且参数用法一致,仅参数名不同,同时 Paddle 支持更多其他参数,具体如下:
Copy link
Collaborator

Choose a reason for hiding this comment

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

这句话直接写 Paddle 相比 Pytorch 支持更多其他参数,具体如下:就可以

### [torch.scatter_add](https://pytorch.org/docs/1.13/generated/torch.scatter_add.html#torch.scatter_add)

```python
torch.scatter(input,
Copy link
Collaborator

Choose a reason for hiding this comment

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

api签名少了_add

| dim | axis | 表示在哪一个维度 scatter ,仅参数名不一致。 |
| index | indices | 表示输入的索引张量,仅参数名不一致。 |
| src | values | 表示需要插入的值,仅参数名不一致。 |
| - | reduce | 表示对输出 Tensor 的计算方式, PyTorch 无此参数+ Paddle 应设置此参数为 add 。|
Copy link
Collaborator

Choose a reason for hiding this comment

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

+号改为逗号就可以~

@huajiao-hjyp
Copy link
Collaborator

好多地方都没有修改,点击files可以看到评论吗
image

@cccbbbttt
Copy link
Author

修改了,请您看还有问题吗@ Tomoko-hjf

Copy link
Collaborator

@huajiao-hjyp huajiao-hjyp left a comment

Choose a reason for hiding this comment

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

LGTM

@cccbbbttt
Copy link
Author

@zhwesky2010 ,请问可以合并PR吗

@cccbbbttt
Copy link
Author

@Tomoko-hjf,请问可以合并PR吗


```python
paddle.Tensor.put_along_axis_(indices,
value,
Copy link
Collaborator

Choose a reason for hiding this comment

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

API签名没写对,少个s


```python
paddle.Tensor.put_along_axis_(indices,
value,
Copy link
Collaborator

Choose a reason for hiding this comment

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

API签名没写对,少个s

| dim | axis | 表示在哪一个维度 scatter ,仅参数名不一致。 |
| index | indices | 表示输入的索引张量,仅参数名不一致。 |
| src | values | 表示需要插入的值,仅参数名不一致。 |
| - | reduce | 表示对输出 Tensor 的计算方式, PyTorch 无此参数, Paddle 应设置为 add 。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

这两个API对比了结果没,应该不是完全一致的

| dim | axis | 表示在哪一个维度 scatter ,仅参数名不一致。 |
| index | indices | 表示输入的索引张量,仅参数名不一致。 |
| src | values | 表示需要插入的值,仅参数名不一致。 |
| - | reduce | 表示对输出 Tensor 的计算方式, PyTorch 无此参数, Paddle 应设置此参数为 add 。|
Copy link
Collaborator

@zhwesky2010 zhwesky2010 May 12, 2023

Choose a reason for hiding this comment

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

这两个映射对比下结果是否一致吧,put_along_axis可以映射到scatter,但是scatter_add可能还需要组合其他的逻辑

@huajiao-hjyp
Copy link
Collaborator

@cccbbbttt 同学你好,有时间的话可以按照修改意见完善一下映射文档~

@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label May 17, 2023
@luotao1 luotao1 self-assigned this Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants