-
Notifications
You must be signed in to change notification settings - Fork 766
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.68 #5865
映射文档 No.68 #5865
Conversation
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-5865.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
❌ The PR's message can't be empty. |
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 参数更多时,一句话描述部分可以直接写
其中,PyTorch 相比 Paddle 支持更多其他参数,具体如下:
即可 - 参数映射部分的备注以句号结尾,中间的句号可以改为逗号,参数名相同时,
参数名相同
这几个字可以不写 - 转写示例部分pytorch和paddle的输入要保持一致,建议用符号 x 或 y 来表示
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.
这里直接改为 其中,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.
已修改
torch.fft.fftfreq(5, out=y) | ||
|
||
# Paddle 写法 | ||
paddle.assign(paddle.fft.fftfreq(np.array([3, 1, 2, 2, 3], dtype=float).size, d=0.5),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.
这里直接写成n=5吧,d 参数可以删去,和torch示例保持一致,
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.
已修改
# Pytorch 写法 | ||
x = torch.fft.fftfreq(5, requires_grad=True) | ||
# Paddle 写法 | ||
x = paddle.fft.fftfreq(np.array([3, 1, 2, 2, 3], dtype=float).size, d=0.5) |
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 保持一致~
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.
已修改
# Pytorch 写法 | ||
torch.fft.fftfreq(5, device=torch.device('cpu')) | ||
# Paddle 写法 | ||
y = paddle.fft.fftfreq(np.array([3, 1, 2, 2, 3], dtype=float).size, d=0.5) |
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 保持一致
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=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.
这里直接改为 其中,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.
已修改
| ------------- | ------------ | ------------------------------------------------------ | | ||
| input | x | 输入 Tensor,仅参数名不一致。 | | ||
| n | n | 输出 Tensor 在傅里叶变换轴的长度。 参数名相同。 | | ||
| dim | axis | 傅里叶变换的轴。如果没有指定,默认是使用最后一维。仅参数名不一致| |
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.
末尾以句号结尾,中间的句号可以改为分号或逗号,参数名相同时可以不写 参数名相同
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.
已修改
#### out:指定输出 | ||
```python | ||
# Pytorch 写法 | ||
torch.fft.hfft(tensor([ 0.5000-0.0000j, -0.1250-0.1720j, -0.1250-0.0406j, -0.1250+0.0406j, |
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.
两个示例的输入需要保持一致,建议用 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.
已修改
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.
这里直接改为 其中,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.
已修改
| ------------- | ------------ | ------------------------------------------------------ | | ||
| input | x |输入 Tensor,仅参数名不一致。 | | ||
| n | n |傅里叶变换点数。 | | ||
| dim | axis |傅里叶变换的轴,如果没有指定,默认使用最后一维仅参数名不一致。| |
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.
仅参数名不一致 前面加个逗号吧~
```python | ||
# Pytorch 写法 | ||
x = torch.fft.fftfreq(x, requires_grad=True) | ||
# 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.
加个回车吧,分开两个示例~
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.
一句话描述部分需要改为 其中,PyTorch 相比 Paddle 支持更多其他参数,具体如下:
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.
一句话描述部分修改一下~
```python | ||
# Pytorch 写法 | ||
x = torch.fft.rfftfreq(x, requires_grad=True) | ||
# 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.
加个回车吧
| trust_repo | - |在 v1.14 中被移除。Paddle 无此参数,可直接删除。| | ||
| force_reload | force_reload |指定是否强制拉取,默认值: False。参数名相同。 | | ||
|verbose | - |如果设置为 False,将不会显示关于命中本地缓存的消息,默认为 True,Paddle 无此参数,无需转写。| | ||
| skip_validation| - |检查由 github 参数指定的分支或提交是否属于存储库所有者,默认为 False,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.
备注中的无需转写
,可以改为 直接删除即可
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
|m |layer | 需要存储的 Layer 对象或者 function,参数名不同。 | | ||
|f |- |一个类似文件的对象(必须实现 write 和 flush 方法)或包含文件名的字符串,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.
这个f参数要分为两种情况,如果是文件对象,那么要写Paddle暂无转写方式;如果是文件名,则可以用path参数实现
|f |- |一个类似文件的对象(必须实现 write 和 flush 方法)或包含文件名的字符串,Paddle 无此参数。| | ||
|_extra_files |- |文件名到内容的映射,这些内容将作为 f 的一部分进行存储,Paddle 无此参数。| | ||
|- |path |存储模型的路径前缀,格式为 dirname/file_prefix 或者 file_prefix。| | ||
|- |input_spec |描述存储模型 forward 方法的输入,可以通过 InputSpec 或者示例 Tensor 进行描述。| |
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.
备注加一句 PyTorch无此参数,Paddle 保持默认即可。
| ------------- | ------------ | ------------------------------------------------------ | | ||
|m |layer | 需要存储的 Layer 对象或者 function,参数名不同。 | | ||
|f |- |一个类似文件的对象(必须实现 write 和 flush 方法)或包含文件名的字符串,Paddle 无此参数。| | ||
|_extra_files |- |文件名到内容的映射,这些内容将作为 f 的一部分进行存储,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.
备注加一句 暂无转写方式~
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
|url |url |下载的链接。| | ||
|dst |- |对象将被保存的完整路径,例如:/tmp/temporary_file,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 暂无转写方式
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.
还有一些小问题,辛苦修改一下~
|dst |- |对象将被保存的完整路径,例如:/tmp/temporary_file,Paddle 无此参数,Paddle 暂无转写方式| | ||
|hash_prefix |- |如果不为 None,则下载的 SHA256 文件应以 hash_prefix 开头,默认为 None,Paddle 无此参数。| | ||
|progress |- |是否显示进度条。默认值为 True,Paddle 无此参数,可直接删除。| | ||
|- |md5sum |下载文件的 md5 值,默认值: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.
这里的备注加一句Paddle 保持默认即可
~
md5sum=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.
这里的一句话描述改为其中,PyTorch 相比 Paddle 支持更多其他参数,具体如下:
吧
| ------------- | ------------ | ------------------------------------------------------ | | ||
|url |url |下载的链接。| | ||
|dst |- |对象将被保存的完整路径,例如:/tmp/temporary_file,Paddle 无此参数,Paddle 暂无转写方式| | ||
|hash_prefix |- |如果不为 None,则下载的 SHA256 文件应以 hash_prefix 开头,默认为 None,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.
备注可以加一句暂无转写方式。
| force_reload | force_reload |指定是否强制拉取,默认值: False。参数名相同。 | | ||
|verbose | - |如果设置为 False,将不会显示关于命中本地缓存的消息,默认为 True,Paddle 无此参数,直接删除即可。| | ||
| skip_validation| - |检查由 github 参数指定的分支或提交是否属于存储库所有者,默认为 False,Paddle 无此参数,直接删除即可。| | ||
|- |source |指定 repo 托管的位置,支持 github、gitee 和 local,默认值:github。| |
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.
备注可以加一句 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.
LGTM
| input | x | 输入 Tensor,仅参数名不一致。 | | ||
| n | n | 输出 Tensor 在傅里叶变换轴的长度。 | | ||
| dim | axis | 傅里叶变换的轴,如果没有指定,默认是使用最后一维,仅参数名不一致。| | ||
| norm |norm |指定傅里叶变换的缩放模式,缩放系数由变换的方向和模式同时决定。| |
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.
这两个参数完全一致吗,pytorch是None,paddle是'backward'
| input | x |输入 Tensor,仅参数名不一致。 | | ||
| n | n |傅里叶变换点数。 | | ||
| dim | axis |傅里叶变换的轴,如果没有指定,默认使用最后一维,仅参数名不一致。| | ||
| norm |norm |指定傅里叶变换的缩放模式,缩放系数由变换的方向和模式同时决定。| |
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.
这两个参数完全一致吗,pytorch是None,paddle是'backward'
| input | x |输入 Tensor,仅参数名不一致。 | | ||
| s | s |输出 Tensor 在每一个傅里叶变换轴上的长度。 | | ||
| dim | axes |计算快速傅里叶变换的轴。仅参数名不一致。 | | ||
| norm |norm |指定傅里叶变换的缩放模式,缩放系数由变换的方向和模式同时决定。| |
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.
这两个参数完全一致吗,pytorch是None,paddle是'backward'
|model | model |模型的名字。 | | ||
| force_reload | force_reload |指定是否强制拉取,默认值: False。 | | ||
| skip_validation| - |检查由 github 参数指定的分支或提交是否属于存储库所有者,默认为 False,Paddle 无此参数,无需转写。| | ||
| trust_repo | - |在 v1.14 中被移除。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.
如果对训练无影响,可直接删除。需要写下理由
#### f:一个文件名 | ||
```python | ||
# Pytorch 写法 | ||
torch.jit.save(m, filePath) |
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.
转写时,加下关键字吧
| input | x |输入 Tensor,仅参数名不一致。 | | ||
| n | n |傅里叶变换点数。 | | ||
| dim | axis |傅里叶变换的轴,如果没有指定,默认使用最后一维,仅参数名不一致。| | ||
| norm |norm |指定傅里叶变换的缩放模式,pytorch 是 None,paddle 是 backward。| |
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.
这两个参数不存在转写关系吗?看起来并不一致。
哪些差异,是否需要转写,也需要说明白
如果需要转写,下面就要转写示例
| input | x |输入 Tensor,仅参数名不一致。 | | ||
| s | s |输出 Tensor 在每一个傅里叶变换轴上的长度。 | | ||
| dim | axes |计算快速傅里叶变换的轴。仅参数名不一致。 | | ||
| norm |norm |指定傅里叶变换的缩放模式,pytorch 是 None,paddle 是 backward。| |
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.
norm的问题都一致,可以再全部排查下
|m |layer | 需要存储的 Layer 对象或者 function,参数名不同。 | | ||
|f |- |一个类似文件的对象(必须实现 write 和 flush 方法)或包含文件名的字符串,如果是文件对象,Paddle 暂无转写方式;如果是文件名,则可以用 path 参数实现,需要进行转写。| | ||
|_extra_files |- |文件名到内容的映射,这些内容将作为 f 的一部分进行存储,Paddle 无此参数,paddle 暂无转写方式。| | ||
|- |path |存储模型的路径前缀,格式为 dirname/file_prefix 或者 file_prefix,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.
这个是不是应该和 f
对应上?
|f |- |一个类似文件的对象(必须实现 write 和 flush 方法)或包含文件名的字符串,如果是文件对象,Paddle 暂无转写方式;如果是文件名,则可以用 path 参数实现,需要进行转写。| | ||
|_extra_files |- |文件名到内容的映射,这些内容将作为 f 的一部分进行存储,Paddle 无此参数,paddle 暂无转写方式。| | ||
|- |path |存储模型的路径前缀,格式为 dirname/file_prefix 或者 file_prefix,PyTorch 无此参数,Paddle 保持默认即可。| | ||
|- |input_spec |描述存储模型 forward 方法的输入,可以通过 InputSpec 或者示例 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.
_extra_files和input_spec能做对应吗
|- |path |存储模型的路径前缀,格式为 dirname/file_prefix 或者 file_prefix,PyTorch 无此参数,Paddle 保持默认即可。| | ||
|- |input_spec |描述存储模型 forward 方法的输入,可以通过 InputSpec 或者示例 Tensor 进行描述,PyTorch 无此参数,Paddle 保持默认即可。| | ||
|_extra_files |- |文件名到内容的映射,这些内容将作为 f 的一部分进行存储,对应 Paddle 中的 input_spec 参数,需要进行转写。| | ||
|- |path |存储模型的路径前缀,格式为 dirname/file_prefix 或者 file_prefix,对应 PyTorch 的 f 参数。需要进行转写。| |
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.
如果对应的,需要放到表格同一格。
_extra_files和input_spec能做对应吗这个我不确定,需要你这边看一下
@@ -28,7 +28,7 @@ paddle.fft.hfft(x, | |||
| input | x | 输入 Tensor,仅参数名不一致。 | | |||
| n | n | 输出 Tensor 在傅里叶变换轴的长度。 | | |||
| dim | axis | 傅里叶变换的轴,如果没有指定,默认是使用最后一维,仅参数名不一致。| | |||
| norm |norm |指定傅里叶变换的缩放模式,pytorch 是 None,paddle 是 backward。| | |||
| norm |norm |傅里叶变换的缩放模式,缩放系数由变换的方向和缩放模式同时决定,默认是 backward。| |
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.
可以写详细些,感觉这样写,还是看不太明白这里两个norm的差异
@xiaoheicheng 同学你好,有时间的话可以按照意见再修改一下,这样就能尽快合并了~ |
torch.jit.save(m, f=filePath, _extra_files={'foo.txt': b'bar'}) | ||
|
||
# Paddle 写法 | ||
paddle.jit.save(fun, path=filePath, input_spec=list[Tensor]) |
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.
转写示例可以写详细点
完成 #5691 中No.68的文档映射工作