-
Notifications
You must be signed in to change notification settings - Fork 777
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
【映射文档】新增与维护部分映射文档 part2 #6500
Merged
Merged
【映射文档】新增与维护部分映射文档 part2 #6500
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
71340f3
add backednds.cudnn.version
RedContritio 7a43910
add celu
RedContritio 640d686
add torch.distributed.ReduceOp
RedContritio a6d318f
update some docs
RedContritio 3bd07c9
update some docs of #6594
RedContritio 957f432
update some docs
RedContritio 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 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 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
22 changes: 22 additions & 0 deletions
22
...torch/api_difference/distributions/torch.distributions.Distribution.log_prob.md
This file contains 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,22 @@ | ||
## [ 参数完全一致 ]torch.distributions.Distribution.log_prob | ||
|
||
### [torch.distributions.Distribution.log\_prob](https://pytorch.org/docs/stable/distributions.html#torch.distributions.distribution.Distribution.log_prob) | ||
|
||
```python | ||
torch.distributions.Distribution.log_prob(value) | ||
``` | ||
|
||
### [paddle.distributions.Distribution.log\_prob](https://pytorch.org/docs/stable/distributions.html#torch.distributions.distribution.Distribution.log_prob) | ||
|
||
```python | ||
paddle.distributions.Distribution.log_prob(value) | ||
``` | ||
|
||
|
||
功能一致,参数完全一致,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------- | ------------ | ------------ | | ||
| value | value | 输入 Tensor。 | |
21 changes: 21 additions & 0 deletions
21
...ytorch/api_difference/distributions/torch.distributions.Distribution.rsample.md
This file contains 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.distributions.Distribution.rsample | ||
|
||
### [torch.distributions.Distribution.rsample](https://pytorch.org/docs/stable/distributions.html#torch.distributions.distribution.Distribution.rsample) | ||
|
||
```python | ||
torch.distributions.Distribution.rsample(sample_shape=torch.Size([])) | ||
``` | ||
|
||
### [paddle.distribution.Distribution.rsample](https://github.com/PaddlePaddle/Paddle/blob/2bbd6f84c1db3e7401732869ee50aef2d9c97bdc/python/paddle/distribution/distribution.py#L96) | ||
|
||
```python | ||
paddle.distribution.Distribution.rsample(shape=()) | ||
``` | ||
|
||
其中 PyTorch 和 Paddle 功能一致,仅参数名不一致,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------ | ------------ | ---- | | ||
| sample_shape | shape | 重参数化的样本形状,仅参数名不同。 | |
21 changes: 21 additions & 0 deletions
21
...pytorch/api_difference/distributions/torch.distributions.Distribution.sample.md
This file contains 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.distributions.Distribution.sample | ||
|
||
### [torch.distributions.Distribution.sample](https://pytorch.org/docs/stable/distributions.html#torch.distributions.distribution.Distribution.sample) | ||
|
||
```python | ||
torch.distributions.Distribution.sample(sample_shape=torch.Size([])) | ||
``` | ||
|
||
### [paddle.distribution.Distribution.sample](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Distribution_cn.html#sample) | ||
|
||
```python | ||
paddle.distribution.Distribution.sample(shape=()) | ||
``` | ||
|
||
其中 PyTorch 和 Paddle 功能一致,仅参数名不一致,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------ | ------------ | -- | | ||
| sample_shape | shape | 采样形状,仅参数名不一致。 | |
This file contains 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
21 changes: 21 additions & 0 deletions
21
...rch/api_difference/distributions/torch.distributions.transforms.AbsTransform.md
This file contains 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 参数更多 ]torch.distributions.transforms.AbsTransform | ||
|
||
### [torch.distributions.transforms.AbsTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.AbsTransform) | ||
|
||
```python | ||
torch.distributions.transforms.AbsTransform(cache_size=0) | ||
``` | ||
|
||
### [paddle.distribution.AbsTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/AbsTransform_cn.html#paddle.distribution.AbsTransform) | ||
|
||
```python | ||
paddle.distribution.AbsTransform() | ||
``` | ||
|
||
PyTorch 相比 Paddle 支持更多其他参数,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ---------- | ------------ | -- | | ||
| cache_size | - | 缓存大小,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 | |
24 changes: 24 additions & 0 deletions
24
.../api_difference/distributions/torch.distributions.transforms.AffineTransform.md
This file contains 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,24 @@ | ||
## [ torch 参数更多 ]torch.distributions.transforms.AffineTransform | ||
|
||
### [torch.distributions.transforms.AffineTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.AffineTransform) | ||
|
||
```python | ||
torch.distributions.transforms.AffineTransform(loc, scale, event_dim=0, cache_size=0) | ||
``` | ||
|
||
### [paddle.distribution.AffineTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/AffineTransform_cn.html#affinetransform) | ||
|
||
```python | ||
paddle.distribution.AffineTransform(loc, scale) | ||
``` | ||
|
||
PyTorch 相比 Paddle 支持更多其他参数,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ---------- | ------------ | -- | | ||
| loc | loc | 偏置参数。 | | ||
| scale | scale | 缩放参数。 | | ||
| event_dim | - | event_shape 可选尺寸。对于单随机变量为 0,对于向量分布为 1,对于矩阵分布为 2。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 | | ||
| cache_size | - | 缓存大小,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 | |
21 changes: 21 additions & 0 deletions
21
...rch/api_difference/distributions/torch.distributions.transforms.ExpTransform.md
This file contains 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 参数更多 ]torch.distributions.transforms.ExpTransform | ||
|
||
### [torch.distributions.transforms.ExpTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.ExpTransform) | ||
|
||
```python | ||
torch.distributions.transforms.ExpTransform(cache_size=0) | ||
``` | ||
|
||
### [paddle.distribution.ExpTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/ExpTransform_cn.html#exptransform) | ||
|
||
```python | ||
paddle.distribution.ExpTransform() | ||
``` | ||
|
||
PyTorch 相比 Paddle 支持更多其他参数,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ---------- | ------------ | -- | | ||
| cache_size | - | 缓存大小,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 | |
This file contains 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
22 changes: 22 additions & 0 deletions
22
...h/api_difference/distributions/torch.distributions.transforms.PowerTransform.md
This file contains 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,22 @@ | ||
## [ torch 参数更多 ]torch.distributions.transforms.PowerTransform | ||
|
||
### [torch.distributions.transforms.PowerTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.SigmoidTransform) | ||
|
||
```python | ||
torch.distributions.transforms.PowerTransform(exponent, cache_size=0) | ||
``` | ||
|
||
### [paddle.distribution.PowerTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/PowerTransform_cn.html#powertransform) | ||
|
||
```python | ||
paddle.distribution.PowerTransform(power) | ||
``` | ||
|
||
PyTorch 相比 Paddle 支持更多其他参数,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ---------- | ------------ | -- | | ||
| exponent | power | 幂参数。 | | ||
| cache_size | - | 缓存大小,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 | |
21 changes: 21 additions & 0 deletions
21
...api_difference/distributions/torch.distributions.transforms.SigmoidTransform.md
This file contains 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 参数更多 ]torch.distributions.transforms.SigmoidTransform | ||
|
||
### [torch.distributions.transforms.SigmoidTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.SigmoidTransform) | ||
|
||
```python | ||
torch.distributions.transforms.SigmoidTransform(cache_size=0) | ||
``` | ||
|
||
### [paddle.distribution.SigmoidTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/SigmoidTransform_cn.html#sigmoidtransform) | ||
|
||
```python | ||
paddle.distribution.SigmoidTransform() | ||
``` | ||
|
||
PyTorch 相比 Paddle 支持更多其他参数,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ---------- | ------------ | -- | | ||
| cache_size | - | 缓存大小,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 | |
21 changes: 21 additions & 0 deletions
21
...ch/api_difference/distributions/torch.distributions.transforms.TanhTransform.md
This file contains 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 参数更多 ]torch.distributions.transforms.TanhTransform | ||
|
||
### [torch.distributions.transforms.TanhTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.TanhTransform) | ||
|
||
```python | ||
torch.distributions.transforms.TanhTransform(cache_size=0) | ||
``` | ||
|
||
### [paddle.distribution.TanhTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/TanhTransform_cn.html#tanhtransform) | ||
|
||
```python | ||
paddle.distribution.TanhTransform() | ||
``` | ||
|
||
PyTorch 相比 Paddle 支持更多其他参数,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ---------- | ------------ | -- | | ||
| cache_size | - | 缓存大小,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 | |
24 changes: 12 additions & 12 deletions
24
...guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.rfft2.md
This file contains 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 |
---|---|---|
@@ -1,35 +1,35 @@ | ||
## [ torch 参数更多 ]torch.fft.irfft | ||
## [ torch 参数更多 ]torch.fft.rfft2 | ||
|
||
### [torch.fft.irfft](https://pytorch.org/docs/stable/generated/torch.fft.irfft.html#torch-fft-irfft) | ||
### [torch.fft.rfft2](https://pytorch.org/docs/stable/generated/torch.fft.rfft2.html) | ||
|
||
```python | ||
torch.fft.irfft(input, s=None, dim=(- 2, - 1), norm='backward', *, out=None) | ||
torch.fft.rfft2(input, s=None, dim=(-2, -1), norm=None, *, out=None) | ||
``` | ||
|
||
### [paddle.fft.irfft](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/irfft_cn.html#irfft) | ||
### [paddle.fft.rfft2](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/rfft2_cn.html#rfft2) | ||
|
||
```python | ||
paddle.fft.irfft(x, s=None, axes=(- 2, - 1), norm='backward', name=None) | ||
paddle.fft.rfft2(x, s=None, axes=(- 2, - 1), norm='backward', name=None) | ||
``` | ||
|
||
PyTorch 相比 Paddle 支持更多其他参数,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ----------------------------------- | ------------ | ----------------------------------------------------------------------- | | ||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------- | ------------ | ----- | | ||
| input | x | 表示输入的 Tensor ,仅参数名不一致。 | | ||
| n | n | 表示在傅里叶变换轴的长度 。 | | ||
| s | s | 表示在傅里叶变换轴的长度 。 | | ||
| dim | axis | 表示进行运算的轴,仅参数名不一致。 | | ||
| norm | norm | 表示傅里叶变换的缩放模式。 | | ||
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 | | ||
| norm | norm | 表示傅里叶变换的缩放模式。 | | ||
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. torch的None和 paddle的 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. 这里 torch 会在该参数未指定或传入 None 的时候,内部使用默认值 "backward" (不依赖 python 语法的手动默认值设置)。 效果一致。 |
||
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 | | ||
|
||
### 转写示例 | ||
#### out:指定输出 | ||
```python | ||
# PyTorch 写法 | ||
torch.fft.irfft(x, s, dim, norm, out=y) | ||
torch.fft.rfft2(x, s, dim, norm, out=y) | ||
|
||
# Paddle 写法 | ||
paddle.assign(paddle.fft.irfft(x, s, dim, norm) , y) | ||
paddle.assign(paddle.fft.rfft2(x, s, dim, norm), y) | ||
``` |
15 changes: 15 additions & 0 deletions
15
...convert/convert_from_pytorch/api_difference/ops/torch.backends.cudnn.version.md
This file contains 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.backends.cudnn.version | ||
|
||
### [torch.backends.cudnn.version](https://pytorch.org/docs/stable/generated/torch.backends.cudnn.version.html) | ||
|
||
```python | ||
torch.backends.cudnn.version() | ||
``` | ||
|
||
### [paddle.device.get\_cudnn\_version](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/device/get_cudnn_version_cn.html#get-cudnn-version) | ||
|
||
```python | ||
paddle.device.get_cudnn_version() | ||
``` | ||
|
||
两者功能一致,无参数。 |
22 changes: 22 additions & 0 deletions
22
docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.celu.md
This file contains 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,22 @@ | ||
## [ 仅参数名不一致 ]torch.celu | ||
|
||
### [torch.celu](https://pytorch.org/docs/stable/generated/torch.nn.functional.celu.html#torch.nn.functional.celu) | ||
|
||
```python | ||
torch.celu(input, alpha=1.0) | ||
``` | ||
|
||
### [paddle.nn.functional.celu](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/functional/celu_cn.html#celu) | ||
|
||
```python | ||
paddle.nn.functional.celu(x, alpha=1.0, name=None) | ||
``` | ||
|
||
其中 PyTorch 和 Paddle 功能一致,仅参数名不一致,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------- | ------------ | -- | | ||
| input | x | 输入的 Tensor,仅参数名不一致。 | | ||
| alpha | alpha | CELU 的 alpha 值,默认值为 1.0。 | |
34 changes: 34 additions & 0 deletions
34
docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.complex.md
This file contains 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,34 @@ | ||
## [ torch 参数更多 ]torch.complex | ||
|
||
|
||
### [torch.complex](https://pytorch.org/docs/stable/generated/torch.complex.html) | ||
|
||
```python | ||
torch.complex(real, imag, *, out=None) | ||
``` | ||
|
||
### [paddle.complex](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/complex_cn.html#complex) | ||
|
||
```python | ||
paddle.complex(real, imag, name=None) | ||
``` | ||
|
||
其中,PyTorch 相比 Paddle 支持更多其他参数,具体如下: | ||
|
||
### 参数映射 | ||
|
||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------- | ------------ | -- | | ||
| real | real | 实部,数据类型为:float32 或 float64。 | | ||
| imag | imag | 虚部,数据类型和 real 相同。 | | ||
| out | - | 输出 Tensor。 | | ||
|
||
### 转写示例 | ||
|
||
```python | ||
# PyTorch 写法 | ||
torch.complex(a, b, out=out) | ||
|
||
# Paddle 写法 | ||
paddle.assign(paddle.complex(a, b), out) | ||
``` |
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.
这个可直接删除吗,没有影响吗
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 没有描述具体实现,可能需要实验来测试。
认为没有影响是因为参考 PaConvert/#341,对该参数做了直接删除处理。
此外
tests/test_distributions_AffineTransform.py
未覆盖 0、1、2 取值。