-
Notifications
You must be signed in to change notification settings - Fork 765
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.17 #5755
映射文档 No.17 #5755
Conversation
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-5755.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
ymw seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
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.
有一个共性问题,需要修改一下:
- 文档整体的格式不太对,可以参考常用模板链接 https://docs.qq.com/doc/DQmVOT2xPcGRRbVll 或者 已经合并的PR
- 分类名称尽量和模板保持一致,保持统一性
- paddle多的参数也需要在参数映射部分一一进行介绍,在参数映射时,需要在备注部分写明
仅参数名不一致
,还是Paddle 无此参数,需要进行转写
,或者 'Pytorch 无此参数,Paddle 保持默认即可',可以参考常用模板
@@ -0,0 +1,43 @@ | |||
## [ 一致的参数 ] torch.Tensor.mul |
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,paddle多了axis
参数,可以参考https://docs.qq.com/doc/DQmVOT2xPcGRRbVll 链接来规范一下分类名~
```python | ||
torch.Tensor.mul(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.
只有需要转写的时候才需要写示例代码,示例代码需要写到参数映射部分的后面,这里就不需要写示例代码啦,可以参考一下其他的PR #5699
print(res) # [[5, 12], [21, 32]] | ||
``` | ||
|
||
两者功能一致,输入两个矩阵x,y,将x与y的对应元素相乘 |
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 支持更多其他参数,具体如下:
| ------------- | ------------ | ------------------------------------------------------ | | ||
| value | y | 相乘的矩阵 | | ||
| - | axis | 维度 | | ||
| - | name | 表示填充的模式。 | |
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.
name
属性可以省略不写在参数映射部分
| - | axis | 维度 | | ||
| - | name | 表示填充的模式。 | | ||
|
||
name (str,可选) - 具体用法请参见 [name](https://www.paddlepaddle.org.cn/documentation/docs/zh/api_guides/low_level/program.html#api-guide-name),一般无需设置,默认值为 None。 |
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.
这句话可以删去,这里我们都默认省略介绍name
属性
| value | scale | 放缩的大小 | | ||
| - | bias | 偏置 | | ||
|
||
两者功能一致,输入一个常数value(scale),将矩阵x放大value(scale)倍,需要将bias设置为0.0 |
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.
这句话可以放在bias参数的备注部分 表示放缩后的偏置部分,PyTorch 无此参数, Paddle 设为 0.0 即可。
关于参数的介绍以及默认值设置均需要放大备注部分,方便查阅~
### [paddle.Tensor.scale_](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#id16) | ||
|
||
```python | ||
paddle.Tensor.scale_(scale=1.0, bias=0.0, bias_after_scale=True, act=None, name=None) |
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.
在参数映射部分中,bias
, bias_after_scale
,act
均需要介绍作用是什么,以及Paddle应该如何设置,备注大部分情况是先说明参数的意义,然后加一句 Pytorch 无此参数,Paddle 保持默认即可。
。可以查看模板链接https://docs.qq.com/doc/DQmVOT2xPcGRRbVll
@@ -0,0 +1,41 @@ | |||
## [ 一致的参数 ] torch.Tensor.multiply |
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参数更多
| ------------- | ------------ | ------------------------------------------------------ | | ||
| value | y | 相乘的矩阵 | | ||
| - | axis | 维度 | | ||
| - | name | 表示填充的模式。 | |
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.
name 属性可以不写
这里有些官网文档确实没有更新,如果官网找不到的话, import paddle
a = paddle.to_tensor([[[1, 2, 3], [4, 3, 8]]])
b = a.nansum(axis=1, keepdim=True, dtype='int32')
print(b) |
@Tomoko-hjf |
#5691
添加对比文档,其中paddle.Tensor.ndimension和paddle.Tensor.nansum未找到paddle2.4版本的官方文档