-
Notifications
You must be signed in to change notification settings - Fork 869
[Docs] 增加第二类api difference #7592
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
[Docs] 增加第二类api difference #7592
Conversation
|
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-7592.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
📚 本次 PR 文档预览链接(点击展开)
|
| ### [torch.max](https://pytorch.org/docs/stable/generated/torch.max.html) | ||
|
|
||
| ```python | ||
| torch.max(input, *, out=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.
这几个签名直接写 torch.max(*args, **kwargs) 吧
max、min、median、nanmedian
|
|
||
| ```python | ||
| # PyTorch 写法 | ||
| result = torch.max(x) |
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.max有多种签名与用法,均只需修改torch前缀为paddle.compat
|
|
||
| ```python | ||
| # PyTorch 写法 | ||
| result = torch.median(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.
同上
| paddle.compat.min(input, *args, out=None, **kwargs) | ||
| ``` | ||
|
|
||
| 两者功能一致,但调用方式不一致,具体如下: |
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 写法 | ||
| result = torch.nanmedian(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.
同上
| ### [paddle.compat.softmax](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/compat/softmax_cn.html#paddle/compat/softmax_cn#cn-api-paddle-compat-softmax) | ||
|
|
||
| ```python | ||
| paddle.compat.softmax(input, dim=None, dtype, *, out=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.
如果是 [仅API调用方式不一致],上下的签名,API参数部分应该都是一样的,或者paddle比torch参数更多。
这里需要再整体核对下,为什么会有的参数不符合上面的情况。
paddle.compat.softmax的_stacklevel、dtype都是一样的。多一个out。
| ### [paddle.compat.median](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/compat/median_cn.html#paddle/compat/median_cn#cn-api-paddle-compat-median) | ||
|
|
||
| ```python | ||
| paddle.compat.median(input, dim=None, keepdim=False, *, out=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.
上面如果按*args, **kwargs写,这里也这样写吧
| ### [paddle.compat.min](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/compat/min_cn.html#paddle/compat/min_cn#cn-api-paddle-compat-min) | ||
|
|
||
| ```python | ||
| paddle.compat.min(input, *args, out=None, **kwargs) |
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.
*args, **kwargs
| ### [paddle.compat.nanmedian](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/compat/nanmedian_cn.html#paddle/compat/nanmedian_cn#cn-api-paddle-compat-nanmedian) | ||
|
|
||
| ```python | ||
| paddle.compat.nanmedian(input, dim=None, keepdim=False, *, out=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.
*args, **kwargs
| unfold = torch.nn.Unfold(kernel_size=(2, 2)) | ||
|
|
||
| # Paddle 写法 | ||
| unfold = paddle.compat.Unfold(kernel_size=(2, 2)) |
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.compat.nn.Unfold
| ### [paddle.compat.Unfold](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/compat/Unfold_cn.html#paddle/compat/Unfold_cn#cn-api-paddle-compat-Unfold) | ||
|
|
||
| ```python | ||
| paddle.compat.Unfold(kernel_size, dilation=1, padding=0, stride=1) |
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.
paconvert更新为paddle.compat.nn.Unfold
| ### [paddle.compat.softmax](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/compat/softmax_cn.html#paddle/compat/softmax_cn#cn-api-paddle-compat-softmax) | ||
|
|
||
| ```python | ||
| paddle.compat.softmax(input, dim=None, _stacklevel=3, dtype=None, out=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.
paconvert更新为paddle.compat.nn.functional.softmax
| ``` | ||
| | PyTorch | PaddlePaddle | 备注 | | ||
| | ---------- | ------------ | -- | | ||
| | including_emulation | - | 是否包含软件模拟支持 | |
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 | 备注 | | ||
| | ---------- | ------------ | -- | | ||
| | including_emulation | - | 是否包含软件模拟支持 | | ||
| | - | device | 查询的设备类型 | |
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应该怎么设置,不需要修改的话就是 paddle保持默认即可
| ``` | ||
| | PyTorch | PaddlePaddle | 备注 | | ||
| | ---------- | ------------ | -- | | ||
| | `mode` | 无 | 是否设置为训练模式 | |
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 | 备注 | | ||
| | ---------- | ------------ | -- | | ||
| | closure | - | 传入一个闭包函数,在优化器更新参数前执行。 | |
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.compat.pad](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/compat/pad_cn.html#paddle/compat/pad_cn#cn-api-paddle-compat-pad) | ||
| ### [paddle.compat.nn.pad](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/compat/nn/pad_cn.html#paddle/compat/nn/pad_cn#cn-api-paddle-compat-nn-pad) |
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.compat.nn.functional.pad
| | including_emulation | - | 是否包含软件模拟支持 | | ||
| | - | device | 查询的设备类型 | | ||
| | including_emulation | - | 是否包含软件模拟支持,暂无转写方式 | | ||
| | - | device | 查询的设备类型,转写时 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.
LGTM
|
|
||
| ```python | ||
| paddle.compat.nn.softmax(input, dim=None, _stacklevel=3, dtype=None, out=None) | ||
| paddle.compat.nn.functional.softmax(input, dim=None, _stacklevel=3, dtype=None, out=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.
这些在后面优化 validate_api_difference 及一致性工具时,加上校验吧,需要与paconvert的pytorch api、paddle API保持一致。
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.
收到




No description provided.