Skip to content

Commit 4a27d5a

Browse files
authored
映射文档 No. 40 (#5841)
* add the api mapping NO 40 * add the api mapping NO 40 1 * paddle-40-PR
1 parent e782cac commit 4a27d5a

File tree

10 files changed

+213
-58
lines changed

10 files changed

+213
-58
lines changed
Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
## [ 仅参数名不一致 ]torch.logical_xor
2-
### [torch.logical_xor](https://pytorch.org/docs/1.13/generated/torch.logical_xor.html?highlight=logical_xor#torch.logical_xor)
2+
3+
### [torch.logical_xor](https://pytorch.org/docs/1.13/generated/torch.logical_xor.html?highlight=torch+logical_xor#torch.logical_xor)
34

45
```python
5-
torch.logical_xor(input,
6-
other,
7-
*,
8-
out=None)
6+
torch.logical_xor(input, other, *, out=None)
97
```
108

11-
### [paddle.logical_xor](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/logical_xor_cn.html#logical-xor)
9+
### [paddle.logical_xor](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/logical_xor_cn.html)
1210

1311
```python
14-
paddle.logical_xor(x,
15-
y,
16-
out=None,
17-
name=None)
12+
paddle.logical_xor(x, y, out=None, name=None)
1813
```
1914

20-
两者功能一致且参数用法一致,仅参数名不同,具体如下:
15+
两者功能一致且参数用法一致,仅参数名不一致,具体如下:
16+
2117
### 参数映射
22-
| PyTorch | PaddlePaddle | 备注 |
23-
| ------------- | ------------ | ------------------------------------------------------ |
24-
| <font color='red'> input </font> | <font color='red'> x </font> | 表示输入的 Tensor ,仅参数名不一致。 |
25-
| <font color='red'> other </font> | <font color='red'> y </font> | 表示输入的 Tensor ,仅参数名不一致。 |
26-
| out | out | 表示输出的 Tensor 。|
18+
19+
| PyTorch | PaddlePaddle | 备注 |
20+
| ----------------------------------- | ------------ | ----------------------------------------------------------------------- |
21+
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
22+
| other | y | 表示输入的 Tensor ,仅参数名不一致。 |
23+
| out | out | 表示输出的 Tensor 。 |
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## [ torch 参数更多 ]torch.logit
2+
3+
### [torch.logit](https://pytorch.org/docs/1.13/generated/torch.logit.html?highlight=torch+logit#torch.logit)
4+
5+
```python
6+
torch.logit(input, eps=None, *, out=None)
7+
```
8+
9+
### [paddle.logit](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/logit_cn.html)
10+
11+
```python
12+
paddle.logit(x, eps=None, name=None)
13+
```
14+
15+
Pytorch 相比 Paddle 支持更多其他参数,具体如下:
16+
17+
### 参数映射
18+
19+
| PyTorch | PaddlePaddle | 备注 |
20+
| ----------------------------------- | ------------ | ----------------------------------------------------------------------- |
21+
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
22+
| eps | eps | 将输入向量的范围控制在 [eps,1−eps] |
23+
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |
24+
25+
### 转写示例
26+
#### out:指定输出
27+
```python
28+
# Pytorch 写法
29+
torch.logit(x, out=y)
30+
31+
# Paddle 写法
32+
paddle.assign(paddle.logit(x),y)
33+
```
Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
1-
## [torch 参数更多 ]torch.mul
2-
### [torch.mul](https://pytorch.org/docs/stable/generated/torch.mul.html?highlight=mul#torch.mul)
1+
## [ torch 参数更多 ]torch.mul
2+
3+
### [torch.mul](https://pytorch.org/docs/1.13/generated/torch.mul.html?highlight=torch+mul#torch.mul)
34

45
```python
5-
torch.mul(input,
6-
other,
7-
*,
8-
out=None)
6+
torch.mul(input, other, *, out=None)
97
```
108

11-
### [paddle.multiply](https://vpaddlepaddle.org.cn/documentation/docs/zh/api/paddle/multiply_cn.html#multiply)
9+
### [paddle.multiply](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/multiply_cn.html)
1210

1311
```python
14-
paddle.multiply(x,
15-
y,
16-
name=None)
12+
paddle.multiply(x, y, name=None)
1713
```
1814

19-
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
15+
Pytorch 相比 Paddle 支持更多其他参数,具体如下:
16+
2017
### 参数映射
21-
| PyTorch | PaddlePaddle | 备注 |
22-
| ------------- | ------------ | ------------------------------------------------------ |
23-
| <font color='red'> input </font> | <font color='red'> x </font> | 表示输入的 Tensor ,仅参数名不一致。 |
24-
| <font color='red'> other </font> | <font color='red'> y </font> | 表示输入的 Tensor ,仅参数名不一致。 |
25-
| <font color='red'> out </font> | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |
2618

19+
| PyTorch | PaddlePaddle | 备注 |
20+
| ----------------------------------- | ------------ | ----------------------------------------------------------------------- |
21+
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
22+
| other | y | 表示输入的 Tensor ,仅参数名不一致。 |
23+
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |
2724

2825
### 转写示例
2926
#### out:指定输出
@@ -32,5 +29,5 @@ paddle.multiply(x,
3229
torch.mul([3, 5], [1, 2], out=y)
3330

3431
# Paddle 写法
35-
paddle.assign(paddle.multiply([3, 5], [1, 2]), y)
32+
paddle.assign(paddle.multiply([3, 5], [1, 2]),y)
3633
```
Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,33 @@
1-
## [torch 参数更多 ]torch.multiply
2-
### [torch.multiply](https://pytorch.org/docs/stable/generated/torch.multiply.html?highlight=multiply#torch.multiply)
1+
## [ torch 参数更多 ]torch.multiply
2+
3+
### [torch.multiply](https://pytorch.org/docs/1.13/generated/torch.multiply.html?highlight=torch+multiply#torch.multiply)
34

45
```python
5-
torch.multiply(input,
6-
other,
7-
*,
8-
out=None)
6+
torch.multiply(input, other, *, out=None)
97
```
108

11-
### [paddle.multiply](https://vpaddlepaddle.org.cn/documentation/docs/zh/api/paddle/multiply_cn.html#multiply)
9+
### [paddle.multiply](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/multiply_cn.html)
1210

1311
```python
14-
paddle.multiply(x,
15-
y,
16-
name=None)
12+
paddle.multiply(x, y, name=None)
1713
```
1814

19-
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
15+
Pytorch 相比 Paddle 支持更多其他参数,具体如下:
16+
2017
### 参数映射
21-
| PyTorch | PaddlePaddle | 备注 |
22-
| ------------- | ------------ | ------------------------------------------------------ |
23-
| <font color='red'> input </font> | <font color='red'> x </font> | 表示输入的 Tensor ,仅参数名不一致。 |
24-
| <font color='red'> other </font> | <font color='red'> y </font> | 表示输入的 Tensor ,仅参数名不一致。 |
25-
| <font color='red'> out </font> | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |
2618

19+
| PyTorch | PaddlePaddle | 备注 |
20+
| ----------------------------------- | ------------ | ----------------------------------------------------------------------- |
21+
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
22+
| other | y | 表示输入的 Tensor ,仅参数名不一致。 |
23+
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |
2724

2825
### 转写示例
2926
#### out:指定输出
3027
```python
3128
# Pytorch 写法
32-
torch.multiply([3, 5], [1, 2], out=y)
29+
torch.multiply([3, 5], [1, 2], out = y)
3330

3431
# Paddle 写法
35-
paddle.assign(paddle.multiply([3, 5], [1, 2]), y)
32+
paddle.assign(paddle.multiply([3, 5], [1, 2]) , y)
3633
```
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## [torch 参数更多 ]torch.nan_to_num
2+
3+
### [torch.nan_to_num](https://pytorch.org/docs/1.13/generated/torch.nan_to_num.html?highlight=nan_to_num#torch.nan_to_num)
4+
5+
```python
6+
torch.nan_to_num(input, nan=0.0, posinf=None, neginf=None, *, out=None)
7+
```
8+
9+
### [paddle.nan_to_num]()
10+
11+
```python
12+
paddle.nan_to_num(x, nan=0.0, posinf=None, neginf=None, name=None)
13+
```
14+
15+
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
16+
### 参数映射
17+
| PyTorch | PaddlePaddle | 备注 |
18+
| ------------- | ------------ | ------------------------------------------------------ |
19+
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
20+
| nan | nan | 表示用于替换 nan 的值。 |
21+
| posinf | posinf | 表示+inf 的替换值。 |
22+
| neginf | neginf | 表示-inf 的替换值。 |
23+
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |
24+
25+
26+
### 转写示例
27+
#### out:指定输出
28+
```python
29+
# Pytorch 写法
30+
torch.nan_to_num(x, n, pos, neg, out = y)
31+
32+
# Paddle 写法
33+
paddle.assign(paddle.nan_to_num(x, n, pos, neg), y)
34+
```
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## [ torch 参数更多 ]torch.neg
2+
3+
### [torch.neg](https://pytorch.org/docs/1.13/generated/torch.neg.html?highlight=neg#torch.neg)
4+
5+
```python
6+
torch.neg(input, *, out=None)
7+
```
8+
9+
### [paddle.neg](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/neg_cn.html)
10+
11+
```python
12+
paddle.neg(x, name=None)
13+
```
14+
15+
Pytorch 相比 Paddle 支持更多其他参数,具体如下:
16+
17+
### 参数映射
18+
19+
| PyTorch | PaddlePaddle | 备注 |
20+
| ----------------------------------- | ------------ | ----------------------------------------------------------------------- |
21+
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
22+
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |
23+
24+
### 转写示例
25+
#### out:指定输出
26+
```python
27+
# Pytorch 写法
28+
torch.neg(x , out=y)
29+
30+
# Paddle 写法
31+
paddle.assign(paddle.neg(x) , y)
32+
```
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
## [ torch 参数更多 ]torch.negative
2+
3+
### [torch.negative](https://pytorch.org/docs/1.13/generated/torch.negative.html?highlight=torch+negative#torch.negative)
4+
5+
```python
6+
torch.negative(input, *, out=None)
7+
```
8+
9+
### [paddle.neg](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/neg_cn.html)
10+
11+
```python
12+
paddle.neg(x, name=None)
13+
```
14+
15+
Pytorch 相比 Paddle 支持更多其他参数,具体如下:
16+
17+
### 参数映射
18+
19+
| PyTorch | PaddlePaddle | 备注 |
20+
| ----------------------------------- | ------------ | ----------------------------------------------------------------------- |
21+
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
22+
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |
23+
24+
### 转写示例
25+
#### out:指定输出
26+
```python
27+
# Pytorch 写法
28+
torch.negative(x ,out = y)
29+
30+
# Paddle 写法
31+
paddle.assign(paddle.neg(x), y)
32+
```

docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.pow.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## [torch 参数更多 ]torch.pow
2-
### [torch.pow](https://pytorch.org/docs/stable/generated/torch.pow.html?highlight=pow#torch.pow)
2+
3+
### [torch.pow](https://pytorch.org/docs/1.13/generated/torch.pow.html?highlight=pow#torch.pow)
34

45
```python
56
torch.pow(input,
@@ -8,7 +9,7 @@ torch.pow(input,
89
out=None)
910
```
1011

11-
### [paddle.pow](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/pow_cn.html#pow)
12+
### [paddle.pow](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/pow_cn.html)
1213

1314
```python
1415
paddle.pow(x,
@@ -20,9 +21,9 @@ paddle.pow(x,
2021
### 参数映射
2122
| PyTorch | PaddlePaddle | 备注 |
2223
| ------------- | ------------ | ------------------------------------------------------ |
23-
| <font color='red'> input </font> | <font color='red'> x </font> | 表示输入的 Tensor ,仅参数名不一致。 |
24-
| <font color='red'> exponent </font> | <font color='red'> y </font> | 表示输入的 Tensor ,仅参数名不一致。 |
25-
| <font color='red'> out </font> | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |
24+
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
25+
| exponent | y | 表示输入的 Tensor ,仅参数名不一致。 |
26+
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |
2627

2728

2829
### 转写示例
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## [torch 参数更多 ]torch.rad2deg
2+
3+
### [torch.rad2deg](https://pytorch.org/docs/1.13/generated/torch.rad2deg.html?highlight=torch+rad2deg#torch.rad2deg)
4+
5+
```python
6+
torch.rad2deg(input, *, out=None)
7+
```
8+
9+
### [paddle.rad2deg](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/rad2deg_cn.html)
10+
11+
```python
12+
paddle.rad2deg(x, name=None)
13+
```
14+
15+
其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
16+
### 参数映射
17+
| PyTorch | PaddlePaddle | 备注 |
18+
| ------------- | ------------ | ------------------------------------------------------ |
19+
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
20+
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |
21+
22+
23+
### 转写示例
24+
#### out:指定输出
25+
```python
26+
# Pytorch 写法
27+
torch.rad2deg(x, out=y)
28+
29+
# Paddle 写法
30+
paddle.assign(paddle.rad2deg(x), y)
31+
```

docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.reciprocal.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
## [torch 参数更多]torch.reciprocal
2-
### [torch.reciprocal](https://pytorch.org/docs/stable/generated/torch.reciprocal.html?highlight=reciprocal#torch.reciprocal)
2+
3+
### [torch.reciprocal](https://pytorch.org/docs/1.13/generated/torch.reciprocal.html?highlight=torch+reciprocal#torch.reciprocal)
34

45
```python
56
torch.reciprocal(input,
67
*,
78
out=None)
89
```
910

10-
### [paddle.reciprocal](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/reciprocal_cn.html#reciprocal)
11+
### [paddle.reciprocal](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/reciprocal_cn.html)
1112

1213
```python
1314
paddle.reciprocal(x,

0 commit comments

Comments
 (0)