-
Notifications
You must be signed in to change notification settings - Fork 860
Update pytorch api mapping #7425
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
base: develop
Are you sure you want to change the base?
Conversation
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-7425.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
1. **参数与 API 名均一致**:无需参数映射与转写示例。 | ||
|
||
2. **参数完全一致**:无需转写示例。 | ||
2. **参数一致但 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.
无需映射文档
参数映射以表格的形式呈现,表格的第 1 列是`PyTorch` 所有参数,第 2 列是`Paddle`对应参数,表格顺序按第 1 列 `PyTorch` 的参数顺序来。 | ||
|
||
1. **无参数**:无需参数映射与转写示例。 | ||
1. **参数与 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.
无需映射文档
| 1 | 无参数 | ❌ | ❌ | | ||
| 2 | 参数完全一致 | ✅ | ❌ | | ||
| 1 | 参数与 API 名均一致 | ❌ | ❌ | | ||
| 2 | 参数一致但 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.
前面两种都不需要 映射文档,什么都不用写了
|
||
|
||
## 分类 1:无参数 | ||
## 分类 1:参数与 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.
前面两种分类 就不需要映射文档了,在映射主页的表头说明将 torch.
改成 paddle.
就行
|
||
|
||
## 分类 2:参数完全一致 | ||
## 分类 2:参数一致但 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.
这一类也不需要映射文档,模板也就不需要了。在映射主页的表头里说明就可以
### [torch.Tensor.t](https://pytorch.org/docs/stable/generated/torch.Tensor.t.html#torch.Tensor.t) | ||
|
||
```python | ||
torch.Tensor.t() |
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.t()
x.t()
换个 torch.matmul
来说明吧,多用几种不同的写法
## 参数一致但 API 名不一致 | ||
此类 API 功能和使用方法在 PyTorch 和 PaddlePaddle 中完全一致,但是 API 名称不同,需要用户进行 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.
示例是给几个示例代码
##### 分类依据 | ||
此类 API 功能和使用方法在 PyTorch 和 PaddlePaddle 中完全一致,只需将 ``torch.`` 替换为 ``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.
示例是要给几个示例代码,你看下现在的映射文档里,示例代码的写法
| 106 | [torchvision.transforms.functional.pad](https://pytorch.org/vision/main/generated/torchvision.transforms.functional.pad.html) | [paddle.vision.transforms.pad](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/transforms/pad_cn.html) | - | | ||
| 107 | [torchvision.transforms.functional.to_grayscale](https://pytorch.org/vision/main/generated/torchvision.transforms.functional.to_grayscale.html?highlight=to_grayscale#torchvision.transforms.functional.to_grayscale) | [paddle.vision.transforms.to_grayscale](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/vision/transforms/to_grayscale_cn.html#to-grayscale) | - | | ||
| 108 | [torchvision.transforms.functional.vflip](https://pytorch.org/vision/main/generated/torchvision.transforms.functional.vflip.html) | [paddle.vision.transforms.vflip](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/vision/transforms/vflip_cn.html) | - | | ||
|
||
|
||
## <span id="id1">torch.XX API 映射列表</span> |
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_difference来扫描生成的,所以还得改apply_reference.py。
同时上面的461+108篇映射文档,是应该要移动到deprecated里的,这个工作量比较大,这次一起做吧。整体开展。
@hd9568 由于下面那些分类是在对应目录里扫描并自动生成的,所以这个 目录层级 与 子标题 是对应的。 目前的 子标题 由之前的 可以本地写一些脚本,来做目录的自动归类。 |
No description provided.