From c2dffb125e573a04a03b5f72b8d9c5f9ed70855e Mon Sep 17 00:00:00 2001 From: carloscjl Date: Tue, 25 Apr 2023 15:52:48 +0800 Subject: [PATCH 1/3] add the api mapping NO 40 --- .../api_difference/ops/torch.logical_xor.md | 29 ++++++++-------- .../api_difference/ops/torch.logit.md | 32 ++++++++++++++++++ .../api_difference/ops/torch.mul.md | 31 ++++++++--------- .../api_difference/ops/torch.multiply.md | 33 +++++++++---------- .../api_difference/ops/torch.neg.md | 32 ++++++++++++++++++ .../api_difference/ops/torch.negative.md | 32 ++++++++++++++++++ .../api_difference/ops/torch.pow.md | 10 +++--- .../api_difference/ops/torch.rad2deg.md | 30 +++++++++++++++++ .../api_difference/ops/torch.reciprocal.md | 4 +-- 9 files changed, 175 insertions(+), 58 deletions(-) create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.logit.md create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.neg.md create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.negative.md create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.rad2deg.md diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.logical_xor.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.logical_xor.md index 9ad3d59946c..06bf1e2fbbe 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.logical_xor.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.logical_xor.md @@ -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 | 备注 | -| ------------- | ------------ | ------------------------------------------------------ | -| input | x | 表示输入的 Tensor ,仅参数名不一致。 | -| other | y | 表示输入的 Tensor ,仅参数名不一致。 | -| out | out | 表示输出的 Tensor 。| + +| PyTorch | PaddlePaddle | 备注 | +| ----------------------------------- | ------------ | ----------------------------------------------------------------------- | +| input | x | 表示输入的 Tensor ,仅参数名不一致。 | +| other | y | 表示输入的 Tensor ,仅参数名不一致。 | +| out | out | 表示输出的 Tensor 。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.logit.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.logit.md new file mode 100644 index 00000000000..d579fa26196 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.logit.md @@ -0,0 +1,32 @@ +## [ 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) +``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.mul.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.mul.md index c61335f2464..decc59c1ba1 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.mul.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.mul.md @@ -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 | 备注 | -| ------------- | ------------ | ------------------------------------------------------ | -| input | x | 表示输入的 Tensor ,仅参数名不一致。 | -| other | y | 表示输入的 Tensor ,仅参数名不一致。 | -| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 | +| PyTorch | PaddlePaddle | 备注 | +| ----------------------------------- | ------------ | ----------------------------------------------------------------------- | +| input | x | 表示输入的 Tensor ,仅参数名不一致。 | +| other | y | 表示输入的 Tensor ,仅参数名不一致。 | +| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 | ### 转写示例 #### out:指定输出 @@ -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) ``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.multiply.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.multiply.md index 8149c0cecc8..cc5138ef6c1 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.multiply.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.multiply.md @@ -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 | 备注 | -| ------------- | ------------ | ------------------------------------------------------ | -| input | x | 表示输入的 Tensor ,仅参数名不一致。 | -| other | y | 表示输入的 Tensor ,仅参数名不一致。 | -| out | - | 表示输出的 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) ``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.neg.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.neg.md new file mode 100644 index 00000000000..a0f50030c6e --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.neg.md @@ -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) +``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.negative.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.negative.md new file mode 100644 index 00000000000..4a788baf365 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.negative.md @@ -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) +``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.pow.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.pow.md index e1e7fa7b4d0..5d393435c68 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.pow.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.pow.md @@ -1,5 +1,5 @@ ## [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, @@ -8,7 +8,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, @@ -20,9 +20,9 @@ paddle.pow(x, ### 参数映射 | PyTorch | PaddlePaddle | 备注 | | ------------- | ------------ | ------------------------------------------------------ | -| input | x | 表示输入的 Tensor ,仅参数名不一致。 | -| exponent | y | 表示输入的 Tensor ,仅参数名不一致。 | -| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 | +| input | x | 表示输入的 Tensor ,仅参数名不一致。 | +| exponent | y | 表示输入的 Tensor ,仅参数名不一致。 | +| out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 | ### 转写示例 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.rad2deg.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.rad2deg.md new file mode 100644 index 00000000000..6f8dd6bd997 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.rad2deg.md @@ -0,0 +1,30 @@ +## [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) +``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.reciprocal.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.reciprocal.md index dafca099f53..35e7dda0bb7 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.reciprocal.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.reciprocal.md @@ -1,5 +1,5 @@ ## [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, @@ -7,7 +7,7 @@ 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, From b31c4fba1c29c78b4b9de97cdbbf037924a1c9c1 Mon Sep 17 00:00:00 2001 From: carloscjl Date: Tue, 25 Apr 2023 16:03:19 +0800 Subject: [PATCH 2/3] add the api mapping NO 40 1 --- .../convert_from_pytorch/api_difference/ops/torch.logit.md | 1 + .../convert_from_pytorch/api_difference/ops/torch.pow.md | 1 + .../convert_from_pytorch/api_difference/ops/torch.rad2deg.md | 1 + .../convert_from_pytorch/api_difference/ops/torch.reciprocal.md | 1 + 4 files changed, 4 insertions(+) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.logit.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.logit.md index d579fa26196..3395655e81e 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.logit.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.logit.md @@ -22,6 +22,7 @@ Pytorch 相比 Paddle 支持更多其他参数,具体如下: | eps | eps | 将输入向量的范围控制在 [eps,1−eps] | | out | - | 表示输出的 Tensor , Paddle 无此参数,需要进行转写。 | +### 转写示例 #### out:指定输出 ```python # Pytorch 写法 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.pow.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.pow.md index 5d393435c68..e389e5613ec 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.pow.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.pow.md @@ -1,4 +1,5 @@ ## [torch 参数更多 ]torch.pow + ### [torch.pow](https://pytorch.org/docs/1.13/generated/torch.pow.html?highlight=pow#torch.pow) ```python diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.rad2deg.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.rad2deg.md index 6f8dd6bd997..ac79916435b 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.rad2deg.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.rad2deg.md @@ -1,4 +1,5 @@ ## [torch 参数更多 ]torch.rad2deg + ### [torch.rad2deg](https://pytorch.org/docs/1.13/generated/torch.rad2deg.html?highlight=torch+rad2deg#torch.rad2deg) ```python diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.reciprocal.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.reciprocal.md index 35e7dda0bb7..aec3cd1459b 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.reciprocal.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.reciprocal.md @@ -1,4 +1,5 @@ ## [torch 参数更多]torch.reciprocal + ### [torch.reciprocal](https://pytorch.org/docs/1.13/generated/torch.reciprocal.html?highlight=torch+reciprocal#torch.reciprocal) ```python From b7b33158de27856ebbf83b158d208ebd55b0a2cb Mon Sep 17 00:00:00 2001 From: carloscjl Date: Tue, 9 May 2023 17:18:07 +0800 Subject: [PATCH 3/3] paddle-40-PR --- .../api_difference/ops/torch.nan_to_num.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.nan_to_num.md diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.nan_to_num.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.nan_to_num.md new file mode 100644 index 00000000000..ee2cea7ec3d --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.nan_to_num.md @@ -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) +```