-
Notifications
You must be signed in to change notification settings - Fork 775
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
cccbbbttt
committed
Apr 27, 2023
1 parent
69319e1
commit d5cf951
Showing
9 changed files
with
122 additions
and
121 deletions.
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
76 changes: 38 additions & 38 deletions
76
...guides/model_convert/convert_from_pytorch/api_difference/ops/torch.bernoulli.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,38 +1,38 @@ | ||
## [torch 参数更多 ]torch.bernoulli | ||
|
||
### [torch.bernoulli](https://pytorch.org/docs/1.13/generated/torch.bernoulli.html#torch.bernoulli) | ||
|
||
```python | ||
torch.bernoulli(input, | ||
*, | ||
generator=None, | ||
out=None) | ||
``` | ||
|
||
### [paddle.bernoulli](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/bernoulli_cn.html) | ||
|
||
```python | ||
paddle.bernoulli(x, | ||
name=None) | ||
``` | ||
|
||
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: | ||
|
||
### 参数映射 | ||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| input | x | 表示输入的 Tensor ,仅参数名不同。 | | ||
| generator | - | 用于采样的伪随机数生成器, Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 | | ||
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 | | ||
|
||
|
||
|
||
### 转写示例 | ||
#### out:指定输出 | ||
```python | ||
# Pytorch 写法 | ||
torch.bernoulli([3, 5], out=y) | ||
|
||
# Paddle 写法 | ||
paddle.assign(paddle.bernoulli([3, 5]), y) | ||
``` | ||
## [torch 参数更多 ]torch.bernoulli | ||
|
||
### [torch.bernoulli](https://pytorch.org/docs/1.13/generated/torch.bernoulli.html#torch.bernoulli) | ||
|
||
```python | ||
torch.bernoulli(input, | ||
*, | ||
generator=None, | ||
out=None) | ||
``` | ||
|
||
### [paddle.bernoulli](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/bernoulli_cn.html) | ||
|
||
```python | ||
paddle.bernoulli(x, | ||
name=None) | ||
``` | ||
|
||
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: | ||
|
||
### 参数映射 | ||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| input | x | 表示输入的 Tensor ,仅参数名不同。 | | ||
| generator | - | 用于采样的伪随机数生成器, Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 | | ||
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 | | ||
|
||
|
||
|
||
### 转写示例 | ||
#### out:指定输出 | ||
```python | ||
# Pytorch 写法 | ||
torch.bernoulli(torch.tensor([3, 5]), out=y) | ||
|
||
# Paddle 写法 | ||
paddle.assign(paddle.bernoulli(paddle.to_tensor([3, 5])), y) | ||
``` |
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
70 changes: 35 additions & 35 deletions
70
docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.nonzero.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.nonzero | ||
### [torch.nonzero](https://pytorch.org/docs/1.13/generated/torch.nonzero.html#torch.nonzero) | ||
|
||
```python | ||
torch.nonzero(input, | ||
*, | ||
out=None, | ||
as_tuple=False) | ||
``` | ||
|
||
### [paddle.nonzero](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nonzero_cn.html) | ||
|
||
```python | ||
paddle.nonzero(x, | ||
as_tuple=False) | ||
``` | ||
|
||
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: | ||
### 参数映射 | ||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| input | x | 表示输入的 Tensor ,仅参数名不一致。 | | ||
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 | | ||
| as_tuple | as_tuple | bool 类型表示输出数据的格式,默认 False 时,输出一个张量,True 时输出一组一维张量。 | | ||
|
||
|
||
### 转写示例 | ||
#### out:指定输出 | ||
```python | ||
# Pytorch 写法 | ||
torch.nonzero(x, out=y) | ||
|
||
# Paddle 写法 | ||
paddle.assign(paddle.nonzero(x), y) | ||
``` | ||
## [torch 参数更多 ]torch.nonzero | ||
### [torch.nonzero](https://pytorch.org/docs/1.13/generated/torch.nonzero.html#torch.nonzero) | ||
|
||
```python | ||
torch.nonzero(input, | ||
*, | ||
out=None, | ||
as_tuple=False) | ||
``` | ||
|
||
### [paddle.nonzero](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nonzero_cn.html) | ||
|
||
```python | ||
paddle.nonzero(x, | ||
as_tuple=False) | ||
``` | ||
|
||
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: | ||
### 参数映射 | ||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| input | x | 表示输入的 Tensor ,仅参数名不一致。 | | ||
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 | | ||
| as_tuple | as_tuple | bool 类型表示输出数据的格式,默认 False 时,输出一个张量,True 时输出一组一维张量。 | | ||
|
||
|
||
### 转写示例 | ||
#### out:指定输出 | ||
```python | ||
# Pytorch 写法 | ||
torch.nonzero(torch.tensor([3, 5]), out=y) | ||
|
||
# Paddle 写法 | ||
paddle.assign(paddle.nonzero(paddle.to_tensor([3, 5])), y) | ||
``` |
74 changes: 37 additions & 37 deletions
74
docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.normal.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,37 +1,37 @@ | ||
## [torch 参数更多 ]torch.normal | ||
### [torch.normal](https://pytorch.org/docs/1.13/generated/torch.normal.html#torch.normal) | ||
```python | ||
torch.normal(mean, | ||
std, | ||
*, | ||
generator=None, | ||
out=None) | ||
``` | ||
### [paddle.normal](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/normal_cn.html) | ||
```python | ||
paddle.normal(mean=0.0, | ||
std=1.0, | ||
shape=None, | ||
name=None) | ||
``` | ||
|
||
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: | ||
### 参数映射 | ||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| mean | mean | 表示正态分布的均值。 | | ||
| std | std | 表示正态分布的方差。 | | ||
| - | shape | 表示输出 Tensor 的形状,Pytorch 无此参数, Paddle 保持默认即可。 | | ||
| generator | - | 用于采样的伪随机数生成器,PaddlePaddle 无此参数,一般对网络训练结果影响不大,可直接删除。 | | ||
| out | - | 表示输出的 Tensor, Paddle 无此参数,需要进行转写。 | | ||
|
||
|
||
### 转写示例 | ||
#### out:指定输出 | ||
```python | ||
# Pytorch 写法 | ||
torch.normal(mean=[0., 0., 0.], std=[1., 2., 3.], out=y) | ||
|
||
# Paddle 写法 | ||
paddle.assign(paddle.normal(mean=[0., 0., 0.], std=[1., 2., 3.]), y) | ||
``` | ||
## [torch 参数更多 ]torch.normal | ||
### [torch.normal](https://pytorch.org/docs/1.13/generated/torch.normal.html#torch.normal) | ||
```python | ||
torch.normal(mean, | ||
std, | ||
*, | ||
generator=None, | ||
out=None) | ||
``` | ||
### [paddle.normal](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/normal_cn.html) | ||
```python | ||
paddle.normal(mean=0.0, | ||
std=1.0, | ||
shape=None, | ||
name=None) | ||
``` | ||
|
||
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: | ||
### 参数映射 | ||
| PyTorch | PaddlePaddle | 备注 | | ||
| ------------- | ------------ | ------------------------------------------------------ | | ||
| mean | mean | 表示正态分布的均值。 | | ||
| std | std | 表示正态分布的方差。 | | ||
| - | shape | 表示输出 Tensor 的形状,Pytorch 无此参数, Paddle 保持默认即可。 | | ||
| generator | - | 用于采样的伪随机数生成器,PaddlePaddle 无此参数,一般对网络训练结果影响不大,可直接删除。 | | ||
| out | - | 表示输出的 Tensor, Paddle 无此参数,需要进行转写。 | | ||
|
||
|
||
### 转写示例 | ||
#### out:指定输出 | ||
```python | ||
# Pytorch 写法 | ||
torch.normal(torch.tensor([0, 0, 0]), torch.tensor([1.0, 2.0, 3.0]), out=y) | ||
|
||
# Paddle 写法 | ||
paddle.assign(paddle.normal(paddle.to_tensor([0, 0, 0]), paddle.to_tensor([1.0, 2.0, 3.0])), y) | ||
``` |
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
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