Skip to content

映射文档 No. 40 #5841

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
merged 3 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
## [ 仅参数名不一致 ]torch.logical_xor
### [torch.logical_xor](https://pytorch.org/docs/1.13/generated/torch.logical_xor.html?highlight=logical_xor#torch.logical_xor)

### [torch.logical_xor](https://pytorch.org/docs/1.13/generated/torch.logical_xor.html?highlight=torch+logical_xor#torch.logical_xor)

```python
torch.logical_xor(input,
other,
*,
out=None)
torch.logical_xor(input, other, *, out=None)
```

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

```python
paddle.logical_xor(x,
y,
out=None,
name=None)
paddle.logical_xor(x, y, out=None, name=None)
```

两者功能一致且参数用法一致,仅参数名不同,具体如下:
两者功能一致且参数用法一致,仅参数名不一致,具体如下:

### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| <font color='red'> input </font> | <font color='red'> x </font> | 表示输入的 Tensor ,仅参数名不一致。 |
| <font color='red'> other </font> | <font color='red'> y </font> | 表示输入的 Tensor ,仅参数名不一致。 |
| out | out | 表示输出的 Tensor 。|

| PyTorch | PaddlePaddle | 备注 |
| ----------------------------------- | ------------ | ----------------------------------------------------------------------- |
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
| other | y | 表示输入的 Tensor ,仅参数名不一致。 |
| out | out | 表示输出的 Tensor 。 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## [ torch 参数更多 ]torch.logit

### [torch.logit](https://pytorch.org/docs/1.13/generated/torch.logit.html?highlight=torch+logit#torch.logit)

```python
torch.logit(input, eps=None, *, out=None)
```

### [paddle.logit](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/logit_cn.html)

```python
paddle.logit(x, eps=None, name=None)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ----------------------------------- | ------------ | ----------------------------------------------------------------------- |
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
| eps | eps | 将输入向量的范围控制在 [eps,1−eps] |
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |

### 转写示例
#### out:指定输出
```python
# Pytorch 写法
torch.logit(x, out=y)

# Paddle 写法
paddle.assign(paddle.logit(x),y)
```
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
## [torch 参数更多 ]torch.mul
### [torch.mul](https://pytorch.org/docs/stable/generated/torch.mul.html?highlight=mul#torch.mul)
## [ torch 参数更多 ]torch.mul

### [torch.mul](https://pytorch.org/docs/1.13/generated/torch.mul.html?highlight=torch+mul#torch.mul)

```python
torch.mul(input,
other,
*,
out=None)
torch.mul(input, other, *, out=None)
```

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

```python
paddle.multiply(x,
y,
name=None)
paddle.multiply(x, y, name=None)
```

其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
Pytorch 相比 Paddle 支持更多其他参数,具体如下:

### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| <font color='red'> input </font> | <font color='red'> x </font> | 表示输入的 Tensor ,仅参数名不一致。 |
| <font color='red'> other </font> | <font color='red'> y </font> | 表示输入的 Tensor ,仅参数名不一致。 |
| <font color='red'> out </font> | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |

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

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

# Paddle 写法
paddle.assign(paddle.multiply([3, 5], [1, 2]), y)
paddle.assign(paddle.multiply([3, 5], [1, 2]),y)
```
Original file line number Diff line number Diff line change
@@ -1,36 +1,33 @@
## [torch 参数更多 ]torch.multiply
### [torch.multiply](https://pytorch.org/docs/stable/generated/torch.multiply.html?highlight=multiply#torch.multiply)
## [ torch 参数更多 ]torch.multiply

### [torch.multiply](https://pytorch.org/docs/1.13/generated/torch.multiply.html?highlight=torch+multiply#torch.multiply)

```python
torch.multiply(input,
other,
*,
out=None)
torch.multiply(input, other, *, out=None)
```

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

```python
paddle.multiply(x,
y,
name=None)
paddle.multiply(x, y, name=None)
```

其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
Pytorch 相比 Paddle 支持更多其他参数,具体如下:

### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| <font color='red'> input </font> | <font color='red'> x </font> | 表示输入的 Tensor ,仅参数名不一致。 |
| <font color='red'> other </font> | <font color='red'> y </font> | 表示输入的 Tensor ,仅参数名不一致。 |
| <font color='red'> out </font> | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |

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

### 转写示例
#### out:指定输出
```python
# Pytorch 写法
torch.multiply([3, 5], [1, 2], out=y)
torch.multiply([3, 5], [1, 2], out = y)

# Paddle 写法
paddle.assign(paddle.multiply([3, 5], [1, 2]), y)
paddle.assign(paddle.multiply([3, 5], [1, 2]) , y)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## [torch 参数更多 ]torch.nan_to_num

### [torch.nan_to_num](https://pytorch.org/docs/1.13/generated/torch.nan_to_num.html?highlight=nan_to_num#torch.nan_to_num)

```python
torch.nan_to_num(input, nan=0.0, posinf=None, neginf=None, *, out=None)
```

### [paddle.nan_to_num]()

```python
paddle.nan_to_num(x, nan=0.0, posinf=None, neginf=None, name=None)
```

其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
| nan | nan | 表示用于替换 nan 的值。 |
| posinf | posinf | 表示+inf 的替换值。 |
| neginf | neginf | 表示-inf 的替换值。 |
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |


### 转写示例
#### out:指定输出
```python
# Pytorch 写法
torch.nan_to_num(x, n, pos, neg, out = y)

# Paddle 写法
paddle.assign(paddle.nan_to_num(x, n, pos, neg), y)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## [ torch 参数更多 ]torch.neg

### [torch.neg](https://pytorch.org/docs/1.13/generated/torch.neg.html?highlight=neg#torch.neg)

```python
torch.neg(input, *, out=None)
```

### [paddle.neg](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/neg_cn.html)

```python
paddle.neg(x, name=None)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ----------------------------------- | ------------ | ----------------------------------------------------------------------- |
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |

### 转写示例
#### out:指定输出
```python
# Pytorch 写法
torch.neg(x , out=y)

# Paddle 写法
paddle.assign(paddle.neg(x) , y)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## [ torch 参数更多 ]torch.negative

### [torch.negative](https://pytorch.org/docs/1.13/generated/torch.negative.html?highlight=torch+negative#torch.negative)

```python
torch.negative(input, *, out=None)
```

### [paddle.neg](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/neg_cn.html)

```python
paddle.neg(x, name=None)
```

Pytorch 相比 Paddle 支持更多其他参数,具体如下:

### 参数映射

| PyTorch | PaddlePaddle | 备注 |
| ----------------------------------- | ------------ | ----------------------------------------------------------------------- |
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |

### 转写示例
#### out:指定输出
```python
# Pytorch 写法
torch.negative(x ,out = y)

# Paddle 写法
paddle.assign(paddle.neg(x), y)
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [torch 参数更多 ]torch.pow
### [torch.pow](https://pytorch.org/docs/stable/generated/torch.pow.html?highlight=pow#torch.pow)

### [torch.pow](https://pytorch.org/docs/1.13/generated/torch.pow.html?highlight=pow#torch.pow)

```python
torch.pow(input,
Expand All @@ -8,7 +9,7 @@ torch.pow(input,
out=None)
```

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

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


### 转写示例
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## [torch 参数更多 ]torch.rad2deg

### [torch.rad2deg](https://pytorch.org/docs/1.13/generated/torch.rad2deg.html?highlight=torch+rad2deg#torch.rad2deg)

```python
torch.rad2deg(input, *, out=None)
```

### [paddle.rad2deg](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/rad2deg_cn.html)

```python
paddle.rad2deg(x, name=None)
```

其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下:
### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 |


### 转写示例
#### out:指定输出
```python
# Pytorch 写法
torch.rad2deg(x, out=y)

# Paddle 写法
paddle.assign(paddle.rad2deg(x), y)
```
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
## [torch 参数更多]torch.reciprocal
### [torch.reciprocal](https://pytorch.org/docs/stable/generated/torch.reciprocal.html?highlight=reciprocal#torch.reciprocal)

### [torch.reciprocal](https://pytorch.org/docs/1.13/generated/torch.reciprocal.html?highlight=torch+reciprocal#torch.reciprocal)

```python
torch.reciprocal(input,
*,
out=None)
```

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

```python
paddle.reciprocal(x,
Expand Down