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.17 #5755

Closed
wants to merge 7 commits into from
Closed

映射文档 No.17 #5755

wants to merge 7 commits into from

Conversation

Waylon7
Copy link
Contributor

@Waylon7 Waylon7 commented Mar 23, 2023

#5691
添加对比文档,其中paddle.Tensor.ndimension和paddle.Tensor.nansum未找到paddle2.4版本的官方文档

@paddle-bot
Copy link

paddle-bot bot commented Mar 23, 2023

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

@CLAassistant
Copy link

CLAassistant commented Mar 23, 2023

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ YouZijun97
❌ ymw


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.

@Waylon7
Copy link
Contributor Author

Waylon7 commented Mar 23, 2023

#5691 添加对比文档,其中paddle.Tensor.ndimension和paddle.Tensor.nansum未找到paddle2.4版本的官方文档
ndimension找到了,之后会修正
https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#ndimension

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.

有一个共性问题,需要修改一下:

  1. 文档整体的格式不太对,可以参考常用模板链接 https://docs.qq.com/doc/DQmVOT2xPcGRRbVll 或者 已经合并的PR
  2. 分类名称尽量和模板保持一致,保持统一性
  3. paddle多的参数也需要在参数映射部分一一进行介绍,在参数映射时,需要在备注部分写明 仅参数名不一致,还是Paddle 无此参数,需要进行转写,或者 'Pytorch 无此参数,Paddle 保持默认即可',可以参考常用模板

@@ -0,0 +1,43 @@
## [ 一致的参数 ] torch.Tensor.mul
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,paddle多了axis参数,可以参考https://docs.qq.com/doc/DQmVOT2xPcGRRbVll 链接来规范一下分类名~

```python
torch.Tensor.mul(value)

#示例代码
Copy link
Collaborator

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的对应元素相乘
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 支持更多其他参数,具体如下:

| ------------- | ------------ | ------------------------------------------------------ |
| value | y | 相乘的矩阵 |
| - | axis | 维度 |
| - | name | 表示填充的模式。 |
Copy link
Collaborator

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。
Copy link
Collaborator

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
Copy link
Collaborator

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)
Copy link
Collaborator

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
Copy link
Collaborator

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 | 表示填充的模式。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

name 属性可以不写

@huajiao-hjyp
Copy link
Collaborator

这里有些官网文档确实没有更新,如果官网找不到的话,[paddle.Tensor.nansum]( )部分就先不需要填写官网链接了,但可以自己简单测试一下用法,不影响后面文档的编写~

import paddle
a = paddle.to_tensor([[[1, 2, 3], [4, 3, 8]]])
b = a.nansum(axis=1, keepdim=True, dtype='int32')
print(b)

@Waylon7
Copy link
Contributor Author

Waylon7 commented Apr 4, 2023

@Tomoko-hjf

@Waylon7 Waylon7 mentioned this pull request Apr 5, 2023
@Waylon7 Waylon7 closed this Apr 6, 2023
@Waylon7 Waylon7 deleted the map_doc_17 branch April 6, 2023 05:06
This was referenced Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants