-
Notifications
You must be signed in to change notification settings - Fork 877
[Fix] fix pytorch-paddle mapping index generate #6607
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
Merged
jzhang533
merged 2 commits into
PaddlePaddle:release/2.6
from
RedContritio:fix_2.6_pytorch_mapping
Apr 9, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| api_mappings.json |
21 changes: 21 additions & 0 deletions
21
...model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.apply_.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| ## [ 参数完全一致 ]torch.Tensor.apply_ | ||
| ### [torch.Tensor.apply_](https://pytorch.org/docs/stable/generated/torch.Tensor.apply_.html) | ||
|
|
||
| ```python | ||
| torch.Tensor.apply_(callable) | ||
| ``` | ||
|
|
||
| ### [paddle.Tensor.apply_]() | ||
|
|
||
| ```python | ||
| paddle.Tensor.apply_(callable) | ||
| ``` | ||
|
|
||
|
|
||
| 两者功能不同,pytorch 只支持 Inplace 操作,且只对 CPU tensor 才能使用。Paddle 版本可以在 GPU 下运行同时也有 outplace 版本。两者参数一致,具体如下: | ||
|
|
||
| ### 参数映射 | ||
|
|
||
| | PyTorch | PaddlePaddle | 备注 | | ||
| |----------|--------------|-----------| | ||
| | callable | callable | 一个被调用的函数。 | | ||
4 changes: 2 additions & 2 deletions
4
...model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.dsplit.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
...convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.tensor_split.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.vsplit.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...l_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.matrix_exp.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...el_convert/convert_from_pytorch/api_difference/nn/torch.nn.AdaptiveAvgPool1d.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| ## [ 参数完全一致 ] torch.nn.AdaptiveAvgPool1d | ||
|
|
||
| ### [torch.nn.AdaptiveAvgPool1d](https://pytorch.org/docs/stable/generated/torch.nn.AdaptiveAvgPool1d.html) | ||
|
|
||
| ```python | ||
| torch.nn.AdaptiveAvgPool1d(output_size) | ||
| ``` | ||
|
|
||
| ### [paddle.nn.AdaptiveAvgPool1D](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/AdaptiveAvgPool1D_cn.html#adaptiveavgpool1d) | ||
|
|
||
| ```python | ||
| paddle.nn.AdaptiveAvgPool1D(output_size, name=None) | ||
| ``` | ||
|
|
||
| 两者功能一致,参数完全一致。 | ||
RedContritio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
20 changes: 20 additions & 0 deletions
20
...el_convert/convert_from_pytorch/api_difference/nn/torch.nn.AdaptiveAvgPool2d.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| ## [ 仅 paddle 参数更多 ] torch.nn.AdaptiveAvgPool2d | ||
|
|
||
| ### [torch.nn.AdaptiveAvgPool2d](https://pytorch.org/docs/stable/generated/torch.nn.AdaptiveAvgPool2d.html) | ||
|
|
||
| ```python | ||
| torch.nn.AdaptiveAvgPool2d(output_size) | ||
| ``` | ||
|
|
||
| ### [paddle.nn.AdaptiveAvgPool2D](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/AdaptiveAvgPool2D_cn.html#adaptiveavgpool2d) | ||
|
|
||
| ```python | ||
| paddle.nn.AdaptiveAvgPool2D(output_size, data_format='NCHW', name=None) | ||
| ``` | ||
|
|
||
| 其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下: | ||
| ### 参数映射 | ||
| | PyTorch | PaddlePaddle | 备注 | | ||
| | ------------- | ------------ | ------------------------------------------------------ | | ||
| | output_size | output_size | 表示输出 Tensor 的 size 。 | | ||
| | - | data_format | 表示输入 Tensor 的数据格式, PyTorch 无此参数, Paddle 保持默认即可。 | |
20 changes: 20 additions & 0 deletions
20
...el_convert/convert_from_pytorch/api_difference/nn/torch.nn.AdaptiveAvgPool3d.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| ## [ 仅 paddle 参数更多 ] torch.nn.AdaptiveAvgPool3d | ||
|
|
||
| ### [torch.nn.AdaptiveAvgPool3d](https://pytorch.org/docs/stable/generated/torch.nn.AdaptiveAvgPool3d.html) | ||
|
|
||
| ```python | ||
| torch.nn.AdaptiveAvgPool3d(output_size) | ||
| ``` | ||
|
|
||
| ### [paddle.nn.AdaptiveAvgPool3D](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/AdaptiveAvgPool3D_cn.html#adaptiveavgpool3d) | ||
|
|
||
| ```python | ||
| paddle.nn.AdaptiveAvgPool3D(output_size, data_format='NCDHW', name=None) | ||
| ``` | ||
|
|
||
| 其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下: | ||
| ### 参数映射 | ||
| | PyTorch | PaddlePaddle | 备注 | | ||
| | ------------- | ------------ | ------------------------------------------------------ | | ||
| | output_size | output_size | 表示输出 Tensor 的 size 。 | | ||
| | - | data_format | 表示输入 Tensor 的数据格式, PyTorch 无此参数, Paddle 保持默认即可。 | |
15 changes: 15 additions & 0 deletions
15
...des/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.LogSigmoid.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| ## [ 无参数 ] torch.nn.LogSigmoid | ||
|
|
||
| ### [torch.nn.LogSigmoid](https://pytorch.org/docs/stable/generated/torch.nn.LogSigmoid.html) | ||
|
|
||
| ```python | ||
| torch.nn.LogSigmoid(*args, **kwargs) | ||
| ``` | ||
|
|
||
| ### [paddle.nn.LogSigmoid](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/LogSigmoid_cn.html#logsigmoid) | ||
|
|
||
| ```python | ||
| paddle.nn.LogSigmoid(name=None) | ||
| ``` | ||
|
|
||
| 两者功能一致,均无参数。 |
15 changes: 15 additions & 0 deletions
15
...guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Sigmoid.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| ## [ 无参数 ] torch.nn.Sigmoid | ||
|
|
||
| ### [torch.nn.Sigmoid](https://pytorch.org/docs/stable/generated/torch.nn.Sigmoid.html) | ||
|
|
||
| ```python | ||
| torch.nn.Sigmoid(*args, **kwargs) | ||
| ``` | ||
|
|
||
| ### [paddle.nn.Sigmoid](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/Sigmoid_cn.html#sigmoid) | ||
|
|
||
| ```python | ||
| paddle.nn.Sigmoid(name=None) | ||
| ``` | ||
|
|
||
| 两者功能一致,均无参数。 |
15 changes: 15 additions & 0 deletions
15
...uides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Softplus.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| ## [ 参数完全一致 ] torch.nn.Softplus | ||
|
|
||
| ### [torch.nn.Softplus](https://pytorch.org/docs/stable/generated/torch.nn.Softplus.html) | ||
|
|
||
| ```python | ||
| torch.nn.Softplus(beta=1, threshold=20) | ||
| ``` | ||
|
|
||
| ### [paddle.nn.Softplus](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/Softplus_cn.html) | ||
|
|
||
| ```python | ||
| paddle.nn.Softplus(beta=1, threshold=20, name=None) | ||
| ``` | ||
|
|
||
| 两者功能一致,参数完全一致。 | ||
RedContritio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
15 changes: 15 additions & 0 deletions
15
...uides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Softsign.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| ## [ 无参数 ] torch.nn.Softsign | ||
|
|
||
| ### [torch.nn.Softsign](https://pytorch.org/docs/stable/generated/torch.nn.Softsign.html) | ||
|
|
||
| ```python | ||
| torch.nn.Softsign(*args, **kwargs) | ||
| ``` | ||
|
|
||
| ### [paddle.nn.Softsign](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/Softsign_cn.html) | ||
|
|
||
| ```python | ||
| paddle.nn.Softsign(name=None) | ||
| ``` | ||
|
|
||
| 两者功能一致,均无参数。 |
15 changes: 15 additions & 0 deletions
15
docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Tanh.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| ## [ 无参数 ] torch.nn.Tanh | ||
|
|
||
| ### [torch.nn.Tanh](https://pytorch.org/docs/stable/generated/torch.nn.Tanh.html) | ||
|
|
||
| ```python | ||
| torch.nn.Tanh(*args, **kwargs) | ||
| ``` | ||
|
|
||
| ### [paddle.nn.Tanh](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/Tanh_cn.html) | ||
|
|
||
| ```python | ||
| paddle.nn.Tanh(name=None) | ||
| ``` | ||
|
|
||
| 两者功能一致,无参数。 |
15 changes: 15 additions & 0 deletions
15
...des/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Tanhshrink.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| ## [ 无参数 ] torch.nn.Tanhshrink | ||
|
|
||
| ### [torch.nn.Tanhshrink](https://pytorch.org/docs/stable/generated/torch.nn.Tanhshrink.html) | ||
|
|
||
| ```python | ||
| torch.nn.Tanhshrink(*args, **kwargs) | ||
| ``` | ||
|
|
||
| ### [paddle.nn.Tanhshrink](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/Tanhshrink_cn.html) | ||
|
|
||
| ```python | ||
| paddle.nn.Tanhshrink(name=None) | ||
| ``` | ||
|
|
||
| 两者功能一致,均无参数。 |
15 changes: 15 additions & 0 deletions
15
...onvert_from_pytorch/api_difference/nn/torch.nn.TripletMarginWithDistanceLoss.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| ## [ 参数完全一致 ] torch.nn.TripletMarginWithDistanceLoss | ||
|
|
||
| ### [torch.nn.TripletMarginWithDistanceLoss](https://pytorch.org/docs/stable/generated/torch.nn.TripletMarginWithDistanceLoss.html) | ||
|
|
||
| ```python | ||
| torch.nn.TripletMarginWithDistanceLoss(*, distance_function=None, margin=1.0, swap=False, reduction='mean') | ||
| ``` | ||
|
|
||
| ### [paddle.nn.TripletMarginWithDistanceLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/TripletMarginWithDistanceLoss_cn.html#tripletmarginwithdistanceloss) | ||
|
|
||
| ```python | ||
| paddle.nn.TripletMarginWithDistanceLoss(distance_function=None, margin: float = 1.0, swap: bool = False, reduction: str = 'mean', name: str = None) | ||
| ``` | ||
|
|
||
| 两者功能一致,参数完全一致。 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 参数完全一致,也需要写一下 参数映射表
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这部分主要用于生成主目录时作为数据源,并不参与实际展示。 |
||
36 changes: 36 additions & 0 deletions
36
...es/model_convert/convert_from_pytorch/api_difference/ops/torch.slice_scatter.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| ## [ 参数不一致 ]torch.slice_scatter | ||
|
|
||
| ### [torch.slice_scatter](https://pytorch.org/docs/stable/generated/torch.slice_scatter.html#torch.slice_scatter) | ||
|
|
||
| ```python | ||
| torch.slice_scatter(input, src, dim=0, start=None, end=None, step=1) | ||
RedContritio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| ### [paddle.slice_scatter](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/slice_scatter.html) | ||
|
|
||
| ```python | ||
| paddle.slice_scatter(x, value, axes, starts, ends, strides, name=None) | ||
| ``` | ||
|
|
||
| 两者功能一致,参数不一致,具体如下: | ||
|
|
||
| ### 参数映射 | ||
|
|
||
| | PyTorch | PaddlePaddle | 备注 | | ||
| | ------------- | ------------ | ------------------------------------------------------ | | ||
| | input | x | 输入的目标矩阵, 仅参数名不一致。 | | ||
| | src | value | 嵌入的值,仅参数名不一致。 | | ||
| | dim | axes | 嵌入的维度,PyTorch 为 int 类型,Paddle 为 list of int。 | | ||
| | start | starts | 嵌入起始索引,PyTorch 为 int 类型,Paddle 为 list of int。 | | ||
| | end | ends | 嵌入截至索引,PyTorch 为 int 类型,Paddle 为 list of int。 | | ||
| | step | strides | 嵌入步长,PyTorch 为 int 类型,Paddle 为 list of int。 | | ||
|
|
||
| ### 转写示例 | ||
|
|
||
| ```python | ||
| # PyTorch 写法 | ||
| torch.slice_scatter(input, src, dim=0, start=1, end=5, step=2) | ||
|
|
||
| # Paddle 写法 | ||
| paddle.slice_scatter(x, value, axes=[0], starts=[1], ends=[5], strides=[2]) | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
这个目前写了Matcher没
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.
尚未添加,文档存在就能修复 release/2.6 的问题