-
Notifications
You must be signed in to change notification settings - Fork 762
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
映射文档 No. 34 #5825
Conversation
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-5825.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
您好,请您check一下PR@Tomoko-hjf |
There was a problem hiding this 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 保持默认即可。 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| dim | axis | 表示在哪一个维度 scatter ,仅参数名不一致。 | | ||
| index | indices | 表示输入的索引张量,仅参数名不一致。 | | ||
| src | values | 表示需要插入的值,仅参数名不一致。 | | ||
| - | reduce | 表示对输出 Tensor 的计算方式, PyTorch 无此参数+ Paddle 应设置为 add 。 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
把+
号换成,
号吧~
reduce='assign') | ||
``` | ||
|
||
两者功能一致且参数用法一致,仅参数名不同,同时 Paddle 支持更多其他参数,具体如下: |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 。| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+号改为逗号就可以~
28c67ec
to
d5cf951
Compare
修改了,请您看还有问题吗@ Tomoko-hjf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@zhwesky2010 ,请问可以合并PR吗 |
@Tomoko-hjf,请问可以合并PR吗 |
|
||
```python | ||
paddle.Tensor.put_along_axis_(indices, | ||
value, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 。 | |
There was a problem hiding this comment.
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 。| |
There was a problem hiding this comment.
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可能还需要组合其他的逻辑
@cccbbbttt 同学你好,有时间的话可以按照修改意见完善一下映射文档~ |
update md