From 5abdca13874bfef3bed19c16c8819c3138c13d9a Mon Sep 17 00:00:00 2001 From: Liyulingyue <852433440@qq.com> Date: Sun, 12 Mar 2023 23:15:39 +0800 Subject: [PATCH 01/31] add gcd --- .../api_difference/ops/torch.gcd.md | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.gcd.md diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.gcd.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.gcd.md new file mode 100644 index 00000000000..285d9716cf7 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.gcd.md @@ -0,0 +1,35 @@ +## [ 仅参数名不一致 ]torch.Tensor.gcd.md + +同 torch.gcd + +### [torch.Tensor.gcd](https://pytorch.org/docs/stable/generated/torch.gcd.html?highlight=gcd) + +```python +torch.gcd(input, other, *, out=None) +``` + +### [paddle.gcd(x, y, name=None)](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/gcd_cn.html) + +```python +paddle.gcd(x, y, name=None) +``` + +其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: + +### 参数映射 +| PyTorch | PaddlePaddle | 备注 | +|----------------------------------|------------------------------| ------------------------------------------------------ | +| input | x | 输入的 Tensor ,仅参数名不同。 | +| other | y | 输入的 Tensor ,仅参数名不同 +| out | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 | + +### 转写示例 + +#### out:指定输出 +```python +# Pytorch 写法 +torch.gcd([-3, -5], out=y) # 同 y = torch.gcd([-3, -5]) + +# Paddle 写法 +y = paddle.gcd([-3, -5]) +``` From f3f3d4c8c88ff7f399e1aa20d7963fbb243c2a7a Mon Sep 17 00:00:00 2001 From: Liyulingyue <852433440@qq.com> Date: Sun, 12 Mar 2023 23:19:32 +0800 Subject: [PATCH 02/31] add gcd --- .../api_difference/ops/{torch.gcd.md => torch.Tensor.gcd.md} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename docs/guides/model_convert/convert_from_pytorch/api_difference/ops/{torch.gcd.md => torch.Tensor.gcd.md} (90%) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.gcd.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.Tensor.gcd.md similarity index 90% rename from docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.gcd.md rename to docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.Tensor.gcd.md index 285d9716cf7..d50c1a812a8 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.gcd.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.Tensor.gcd.md @@ -2,7 +2,7 @@ 同 torch.gcd -### [torch.Tensor.gcd](https://pytorch.org/docs/stable/generated/torch.gcd.html?highlight=gcd) +### [torch.Tensor.gcd](https://pytorch.org/docs/1.13/generated/torch.Tensor.gcd.html?highlight=torch+tensor+gcd#torch.Tensor.gcd) ```python torch.gcd(input, other, *, out=None) From f0e42f998eed68c1935e92a31ac8ff7e58434b87 Mon Sep 17 00:00:00 2001 From: Liyulingyue <852433440@qq.com> Date: Sun, 12 Mar 2023 23:22:00 +0800 Subject: [PATCH 03/31] add ge --- .../api_difference/ops/torch.ge.md | 33 +++++++++++++++++++ .../api_difference/ops/torch.greater_equal.md | 33 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.ge.md create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.greater_equal.md diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.ge.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.ge.md new file mode 100644 index 00000000000..8bfbd84bd3b --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.ge.md @@ -0,0 +1,33 @@ +## [ 仅参数名不一致 ]torch.ge + +### [torch.ge](https://pytorch.org/docs/1.13/generated/torch.ge.html#torch.ge) + +```python +torch.ge(input, other, *, out=None) +``` + +### [paddle.greater_equal](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/greater_equal_cn.html#greater-equal) + +```python +paddle.greater_equal(x, y, name=None) +``` + +其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: + +### 参数映射 +| PyTorch | PaddlePaddle | 备注 | +|----------------------------------|------------------------------| ------------------------------------------------------ | +| input | x | 输入的 Tensor ,仅参数名不同。 | +| other | y | 输入的 Tensor ,仅参数名不同 +| out | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 | + +### 转写示例 + +#### out:指定输出 +```python +# Pytorch 写法 +torch.ge(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]), out = y) # 同 y = torch.ge(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + +# Paddle 写法 +y = paddle.greater_equal(paddle.to_tensor([[1, 2], [3, 4]]), paddle.to_tensor([[1, 1], [4, 4]])) +``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.greater_equal.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.greater_equal.md new file mode 100644 index 00000000000..4975a7ee388 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.greater_equal.md @@ -0,0 +1,33 @@ +## [ 仅参数名不一致 ]torch.greater_equal + +### [torch.ge](https://pytorch.org/docs/1.13/generated/torch.greater_equal.html#torch.greater_equal) + +```python +torch.greater_equal(input, other, *, out=None) +``` + +### [paddle.greater_equal](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/greater_equal_cn.html#greater-equal) + +```python +paddle.greater_equal(x, y, name=None) +``` + +其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: + +### 参数映射 +| PyTorch | PaddlePaddle | 备注 | +|----------------------------------|------------------------------| ------------------------------------------------------ | +| input | x | 输入的 Tensor ,仅参数名不同。 | +| other | y | 输入的 Tensor ,仅参数名不同 +| out | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 | + +### 转写示例 + +#### out:指定输出 +```python +# Pytorch 写法 +torch.greater_equal(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]), out = y) # 同 y = torch.greater_equal(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + +# Paddle 写法 +y = paddle.greater_equal(paddle.to_tensor([[1, 2], [3, 4]]), paddle.to_tensor([[1, 1], [4, 4]])) +``` From c7860f27fa5932ecc411c7c08564cf301fb2adaa Mon Sep 17 00:00:00 2001 From: Liyulingyue <852433440@qq.com> Date: Sun, 12 Mar 2023 23:22:56 +0800 Subject: [PATCH 04/31] add outer --- .../api_difference/ops/torch.outer.md | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.outer.md diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.outer.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.outer.md new file mode 100644 index 00000000000..8e6e818a7d0 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.outer.md @@ -0,0 +1,36 @@ +## [ 仅参数名不一致 ]torch.outer + +### [torch.outer](https://pytorch.org/docs/1.13/generated/torch.outer.html#torch.outer) + +```python +torch.outer(input, vec2, *, out=None) +``` + +### [paddle.outer](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/outer_cn.html) + +```python +paddle.outer(x, y, name=None) +``` + +其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: + +### 参数映射 +| PyTorch | PaddlePaddle | 备注 | +|----------------------------------|------------------------------| ------------------------------------------------------ | +| input | x | 输入的 Tensor ,仅参数名不同。 | +| vec2 | y | 输入的 Tensor ,仅参数名不同 +| out | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 | + +### 转写示例 + +#### out:指定输出 +```python +# Pytorch 写法 +v1 = torch.arange(1., 5.) +v2 = torch.arange(1., 4.) +torch.outer(v1, v2, out = out) # 同 out = torch.outer(v1, v2) + +# Paddle 写法 +v1 = paddle.arange(1, 5).astype('float32') +v2 = paddle.arange(1, 4).astype('float32') +out = paddle.outer(v1, v2) From 767362896a4b0a87b45a38536f2b2259bd584ba2 Mon Sep 17 00:00:00 2001 From: Liyulingyue <852433440@qq.com> Date: Sun, 12 Mar 2023 23:23:24 +0800 Subject: [PATCH 05/31] add get_divice --- .../api_difference/ops/torch.Tensor.get_device.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.Tensor.get_device.md diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.Tensor.get_device.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.Tensor.get_device.md new file mode 100644 index 00000000000..56df5c5f80c --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.Tensor.get_device.md @@ -0,0 +1,15 @@ +## [ 仅参数名不一致 ]torch.all + +### [torch.Tensor.get_device](https://pytorch.org/docs/1.13/generated/torch.Tensor.get_device.html?highlight=torch+tensor+get_device#torch.Tensor.get_device) + +```python +torch.Tensor.get_device() +``` + +### [paddle.device.get_device](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/device/get_device_cn.html#get-device) + +```python +paddle.device.get_device() +``` + +函数功能类似,但不完全相同。torch.Tensor.get_device()用于获取某个 Tensor 的位置,paddle.device.get_device()用于获取当前的运行环境。 From c44f9a61eff871b8379213555b3ea135b7e961f2 Mon Sep 17 00:00:00 2001 From: Liyulingyue <852433440@qq.com> Date: Sun, 12 Mar 2023 23:25:13 +0800 Subject: [PATCH 06/31] add gt --- .../api_difference/ops/torch.greater.md | 33 +++++++++++++++++++ .../api_difference/ops/torch.gt.md | 33 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.greater.md create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.gt.md diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.greater.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.greater.md new file mode 100644 index 00000000000..5bd3d774f88 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.greater.md @@ -0,0 +1,33 @@ +## [ 仅参数名不一致 ]torch.gt + +### [torch.gt](https://pytorch.org/docs/1.13/generated/torch.gt.html#torch.gt) + +```python +torch.gt(input, other, *, out=None) +``` + +### [paddle.greater_than](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/greater_than_cn.html) + +```python +paddle.greater_than(x, y, name=None) +``` + +其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: + +### 参数映射 +| PyTorch | PaddlePaddle | 备注 | +|----------------------------------|------------------------------| ------------------------------------------------------ | +| input | x | 输入的 Tensor ,仅参数名不同。 | +| other | y | 输入的 Tensor ,仅参数名不同 +| out | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 | + +### 转写示例 + +#### out:指定输出 +```python +# Pytorch 写法 +torch.gt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]), out = y) # 同 y = torch.gt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + +# Paddle 写法 +y = paddle.greater_than(paddle.to_tensor([[1, 2], [3, 4]]), paddle.to_tensor([[1, 1], [4, 4]])) +``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.gt.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.gt.md new file mode 100644 index 00000000000..dcf75782f64 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.gt.md @@ -0,0 +1,33 @@ +## [ 仅参数名不一致 ]torch.greater + +### [torch.greater](https://pytorch.org/docs/1.13/generated/torch.greater.html#torch.greater) + +```python +torch.greater(input, other, *, out=None) +``` + +### [paddle.greater_than](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/greater_than_cn.html) + +```python +paddle.greater_than(x, y, name=None) +``` + +其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: + +### 参数映射 +| PyTorch | PaddlePaddle | 备注 | +|----------------------------------|------------------------------| ------------------------------------------------------ | +| input | x | 输入的 Tensor ,仅参数名不同。 | +| other | y | 输入的 Tensor ,仅参数名不同 +| out | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 | + +### 转写示例 + +#### out:指定输出 +```python +# Pytorch 写法 +torch.greater(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]), out = y) # 同 y = torch.greater(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) + +# Paddle 写法 +y = paddle.greater_than(paddle.to_tensor([[1, 2], [3, 4]]), paddle.to_tensor([[1, 1], [4, 4]])) +``` From 7d64f27943ca55123f0a844a3d7f2d9aa8abd41a Mon Sep 17 00:00:00 2001 From: Liyulingyue <852433440@qq.com> Date: Sun, 12 Mar 2023 23:29:16 +0800 Subject: [PATCH 07/31] add hardshrink --- .../ops/torch.nn.functional.hardshrink.md | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.nn.functional.hardshrink.md diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.nn.functional.hardshrink.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.nn.functional.hardshrink.md new file mode 100644 index 00000000000..d005527d076 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.nn.functional.hardshrink.md @@ -0,0 +1,20 @@ +## [ 仅参数名不一致 ]torch.nn.functional.hardshrink + +### [torch.nn.functional.hardshrink](https://pytorch.org/docs/1.13/generated/torch.nn.functional.hardshrink.html#torch.nn.functional.hardshrink) + +```python +torch.nn.functional.hardshrink(input, lambd=0.5) +``` + +### [paddle.nn.functional.hardshrink](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/functional/hardshrink_cn.html#hardshrink) + +```python +paddle.nn.functional.hardshrink(x, threshold=0.5, name=None) +``` + +两者功能一致且参数用法一致,仅参数名不同,具体如下: + +### 参数差异 +| PyTorch | PaddlePaddle | 备注 | +| ------------- | ------------ | ------------------------------------------------------ | +| input | x | 输入的 Tensor。 | From f1df7f213f0ef0135f7cf136458dc6be41460fc9 Mon Sep 17 00:00:00 2001 From: Liyulingyue <852433440@qq.com> Date: Sun, 12 Mar 2023 23:32:43 +0800 Subject: [PATCH 08/31] add heaviside --- .../api_difference/ops/torch.heaviside.md | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.heaviside.md diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.heaviside.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.heaviside.md new file mode 100644 index 00000000000..e1612bdf879 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.heaviside.md @@ -0,0 +1,37 @@ +## [ 仅参数名不一致 ]torch.heaviside + +### [torch.heaviside](https://pytorch.org/docs/1.13/generated/torch.heaviside.html#torch.heaviside) + +```python +torch.heaviside(input, values, *, out=None) +``` + +### [paddle.heaviside](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/heaviside_cn.html#heaviside) + +```python +paddle.heaviside(x, y, name=None) +``` + +其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: + +### 参数映射 +| PyTorch | PaddlePaddle | 备注 | +|-----------------------------------|------------------------------| ------------------------------------------------------ | +| input | x | 输入的 Tensor ,仅参数名不同。 | +| values | y | 输入的 Tensor ,仅参数名不同 +| out | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 | + +### 转写示例 + +#### out:指定输出 +```python +# Pytorch 写法 +input = torch.tensor([-1.5, 0, 2.0]) +values = torch.tensor([0.5]) +torch.heaviside(input, values, out = out) + +# Paddle 写法 +input = paddle.to_tensor([-1.5, 0, 2.0]) +values = paddle.to_tensor([0.5]) +out = paddle.heaviside(input, values) +``` From ba39462c3dd32d879fb4f725028beed3332cd63a Mon Sep 17 00:00:00 2001 From: Liyulingyue <852433440@qq.com> Date: Sun, 12 Mar 2023 23:36:03 +0800 Subject: [PATCH 09/31] add hist --- .../api_difference/ops/torch.histc.md | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.histc.md diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.histc.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.histc.md new file mode 100644 index 00000000000..6c78281580b --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.histc.md @@ -0,0 +1,30 @@ +## [ 仅参数名不一致 ]torch.histc + +### [torch.histc](https://pytorch.org/docs/1.13/generated/torch.histc.html#torch.histc) + +```python +torch.histc(input, bins=100, min=0, max=0, *, out=None) +``` + +### [paddle.histogram](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/histogram_cn.html#histogram) + +```python +paddle.histogram(input, bins=100, min=0, max=0, name=None) +``` + +其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: + +### 参数映射 +| PyTorch | PaddlePaddle | 备注 | +|-----------------------------------|------------------------------| ------------------------------------------------------ | +| out | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 | + +### 转写示例 + +#### out:指定输出 +```python +# Pytorch 写法 +torch.histc(torch.tensor([1., 2, 1]), bins=4, min=0, max=3, out = y) + +# Paddle 写法 +y = paddle.histogram(paddle.to_tensor([1, 2, 1]), bins=4, min=0, max=3) From 7675de6ecdd02848ebb907cd954f4ece5b138b18 Mon Sep 17 00:00:00 2001 From: Liyulingyue <852433440@qq.com> Date: Mon, 17 Apr 2023 05:50:27 +0800 Subject: [PATCH 10/31] fix --- .../api_difference/{ops => Tensor}/torch.Tensor.gcd.md | 2 +- .../api_difference/{ops => Tensor}/torch.Tensor.get_device.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename docs/guides/model_convert/convert_from_pytorch/api_difference/{ops => Tensor}/torch.Tensor.gcd.md (96%) rename docs/guides/model_convert/convert_from_pytorch/api_difference/{ops => Tensor}/torch.Tensor.get_device.md (93%) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.Tensor.gcd.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gcd.md similarity index 96% rename from docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.Tensor.gcd.md rename to docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gcd.md index d50c1a812a8..11d644c4afe 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.Tensor.gcd.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gcd.md @@ -1,4 +1,4 @@ -## [ 仅参数名不一致 ]torch.Tensor.gcd.md +## [ torch 参数更多 ]torch.Tensor.gcd.md 同 torch.gcd diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.Tensor.get_device.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md similarity index 93% rename from docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.Tensor.get_device.md rename to docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md index 56df5c5f80c..47131301bfe 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.Tensor.get_device.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md @@ -1,4 +1,4 @@ -## [ 仅参数名不一致 ]torch.all +## [ 无参数 ]torch.Tensor.get_device ### [torch.Tensor.get_device](https://pytorch.org/docs/1.13/generated/torch.Tensor.get_device.html?highlight=torch+tensor+get_device#torch.Tensor.get_device) From 6dc4b77c59e3328f1ea453bff0bdea3bc3ab5e59 Mon Sep 17 00:00:00 2001 From: Liyulingyue <852433440@qq.com> Date: Mon, 17 Apr 2023 06:00:20 +0800 Subject: [PATCH 11/31] fix --- .../api_difference/Tensor/torch.Tensor.gcd.md | 4 ++-- .../{ops/torch.ge.md => Tensor/torch.Tensor.ge.md} | 8 ++++---- .../{ops/torch.outer.md => Tensor/torch.Tensor.ger.md} | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) rename docs/guides/model_convert/convert_from_pytorch/api_difference/{ops/torch.ge.md => Tensor/torch.Tensor.ge.md} (74%) rename docs/guides/model_convert/convert_from_pytorch/api_difference/{ops/torch.outer.md => Tensor/torch.Tensor.ger.md} (80%) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gcd.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gcd.md index 11d644c4afe..e706174eaea 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gcd.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gcd.md @@ -5,7 +5,7 @@ ### [torch.Tensor.gcd](https://pytorch.org/docs/1.13/generated/torch.Tensor.gcd.html?highlight=torch+tensor+gcd#torch.Tensor.gcd) ```python -torch.gcd(input, other, *, out=None) +torch.Tensor.gcd(input, other, *, out=None) ``` ### [paddle.gcd(x, y, name=None)](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/gcd_cn.html) @@ -28,7 +28,7 @@ paddle.gcd(x, y, name=None) #### out:指定输出 ```python # Pytorch 写法 -torch.gcd([-3, -5], out=y) # 同 y = torch.gcd([-3, -5]) +torch.Tensor.gcd([-3, -5], out=y) # 同 y = torch.Tensor.gcd([-3, -5]) # Paddle 写法 y = paddle.gcd([-3, -5]) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.ge.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ge.md similarity index 74% rename from docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.ge.md rename to docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ge.md index 8bfbd84bd3b..72e507fe8e7 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.ge.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ge.md @@ -1,9 +1,9 @@ -## [ 仅参数名不一致 ]torch.ge +## [ torch 参数更多 ]torch.Tensor.ge -### [torch.ge](https://pytorch.org/docs/1.13/generated/torch.ge.html#torch.ge) +### [torch.Tensor.ge](https://pytorch.org/docs/1.13/generated/torch.Tensor.ge.html?highlight=torch+tensor+ge#torch.Tensor.ge) ```python -torch.ge(input, other, *, out=None) +torch.Tensor.ge(input, other, *, out=None) ``` ### [paddle.greater_equal](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/greater_equal_cn.html#greater-equal) @@ -26,7 +26,7 @@ paddle.greater_equal(x, y, name=None) #### out:指定输出 ```python # Pytorch 写法 -torch.ge(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]), out = y) # 同 y = torch.ge(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) +torch.Tensor.ge(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]), out = y) # 同 y = torch.Tensor.ge(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) # Paddle 写法 y = paddle.greater_equal(paddle.to_tensor([[1, 2], [3, 4]]), paddle.to_tensor([[1, 1], [4, 4]])) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.outer.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ger.md similarity index 80% rename from docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.outer.md rename to docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ger.md index 8e6e818a7d0..a19c9eb257c 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.outer.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ger.md @@ -1,9 +1,9 @@ -## [ 仅参数名不一致 ]torch.outer +## [ torch 参数更多 ]torch.Tensor.ger -### [torch.outer](https://pytorch.org/docs/1.13/generated/torch.outer.html#torch.outer) +### [torch.Tensor.ger](https://pytorch.org/docs/1.13/generated/torch.Tensor.ger.html?highlight=torch+tensor+ger#torch.Tensor.ger) ```python -torch.outer(input, vec2, *, out=None) +torch.Tensor.ger(input, vec2, *, out=None) ``` ### [paddle.outer](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/outer_cn.html) @@ -28,7 +28,7 @@ paddle.outer(x, y, name=None) # Pytorch 写法 v1 = torch.arange(1., 5.) v2 = torch.arange(1., 4.) -torch.outer(v1, v2, out = out) # 同 out = torch.outer(v1, v2) +torch.Tensor.ger(v1, v2, out = out) # 同 out = torch.Tensor.ger(v1, v2) # Paddle 写法 v1 = paddle.arange(1, 5).astype('float32') From c45ce337a5495e351380a6c1d18a9cdd1fa71e76 Mon Sep 17 00:00:00 2001 From: Liyulingyue <852433440@qq.com> Date: Mon, 17 Apr 2023 06:04:32 +0800 Subject: [PATCH 12/31] fix --- .../{ops/torch.gt.md => Tensor/torch.Tensor.greater.md} | 8 ++++---- .../torch.Tensor.greater_equal.md} | 8 ++++---- .../{ops/torch.greater.md => Tensor/torch.Tensor.gt.md} | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) rename docs/guides/model_convert/convert_from_pytorch/api_difference/{ops/torch.gt.md => Tensor/torch.Tensor.greater.md} (72%) rename docs/guides/model_convert/convert_from_pytorch/api_difference/{ops/torch.greater_equal.md => Tensor/torch.Tensor.greater_equal.md} (70%) rename docs/guides/model_convert/convert_from_pytorch/api_difference/{ops/torch.greater.md => Tensor/torch.Tensor.gt.md} (74%) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.gt.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.greater.md similarity index 72% rename from docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.gt.md rename to docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.greater.md index dcf75782f64..e7ba4ba2f27 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.gt.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.greater.md @@ -1,9 +1,9 @@ -## [ 仅参数名不一致 ]torch.greater +## [ torch 参数更多 ]torch.Tensor.greater -### [torch.greater](https://pytorch.org/docs/1.13/generated/torch.greater.html#torch.greater) +### [torch.Tensor.greater](https://pytorch.org/docs/1.13/generated/torch.Tensor.greater.html?highlight=torch+tensor+greater#torch.Tensor.greater) ```python -torch.greater(input, other, *, out=None) +torch.Tensor.greater(input, other, *, out=None) ``` ### [paddle.greater_than](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/greater_than_cn.html) @@ -26,7 +26,7 @@ paddle.greater_than(x, y, name=None) #### out:指定输出 ```python # Pytorch 写法 -torch.greater(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]), out = y) # 同 y = torch.greater(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) +torch.Tensor.greater(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]), out = y) # 同 y = torch.Tensor.greater(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) # Paddle 写法 y = paddle.greater_than(paddle.to_tensor([[1, 2], [3, 4]]), paddle.to_tensor([[1, 1], [4, 4]])) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.greater_equal.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.greater_equal.md similarity index 70% rename from docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.greater_equal.md rename to docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.greater_equal.md index 4975a7ee388..6aeeda6d786 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.greater_equal.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.greater_equal.md @@ -1,9 +1,9 @@ -## [ 仅参数名不一致 ]torch.greater_equal +## [ torch 参数更多 ]torch.Tensor.greater_equal -### [torch.ge](https://pytorch.org/docs/1.13/generated/torch.greater_equal.html#torch.greater_equal) +### [torch.Tensor.greater_equal](https://pytorch.org/docs/1.13/generated/torch.Tensor.greater_equal.html?highlight=torch+tensor+greater_equal#torch.Tensor.greater_equal) ```python -torch.greater_equal(input, other, *, out=None) +torch.Tensor.greater_equal(input, other, *, out=None) ``` ### [paddle.greater_equal](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/greater_equal_cn.html#greater-equal) @@ -26,7 +26,7 @@ paddle.greater_equal(x, y, name=None) #### out:指定输出 ```python # Pytorch 写法 -torch.greater_equal(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]), out = y) # 同 y = torch.greater_equal(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) +torch.Tensor.greater_equal(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]), out = y) # 同 y = torch.Tensor.greater_equal(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) # Paddle 写法 y = paddle.greater_equal(paddle.to_tensor([[1, 2], [3, 4]]), paddle.to_tensor([[1, 1], [4, 4]])) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.greater.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gt.md similarity index 74% rename from docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.greater.md rename to docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gt.md index 5bd3d774f88..6cdbf0a91f4 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.greater.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gt.md @@ -1,9 +1,9 @@ -## [ 仅参数名不一致 ]torch.gt +## [ torch 参数更多 ]torch.Tensor.gt -### [torch.gt](https://pytorch.org/docs/1.13/generated/torch.gt.html#torch.gt) +### [torch.Tensor.gt](https://pytorch.org/docs/1.13/generated/torch.Tensor.gt.html?highlight=torch+tensor+gt#torch.Tensor.gt) ```python -torch.gt(input, other, *, out=None) +torch.Tensor.gt(input, other, *, out=None) ``` ### [paddle.greater_than](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/greater_than_cn.html) @@ -26,7 +26,7 @@ paddle.greater_than(x, y, name=None) #### out:指定输出 ```python # Pytorch 写法 -torch.gt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]), out = y) # 同 y = torch.gt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) +torch.Tensor.gt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]), out = y) # 同 y = torch.Tensor.gt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) # Paddle 写法 y = paddle.greater_than(paddle.to_tensor([[1, 2], [3, 4]]), paddle.to_tensor([[1, 1], [4, 4]])) From 743688cbb557b82bc87a8ee002b80077e43cd6db Mon Sep 17 00:00:00 2001 From: Liyulingyue <852433440@qq.com> Date: Mon, 17 Apr 2023 06:08:10 +0800 Subject: [PATCH 13/31] fix --- .../torch.Tensor.hardshrink.md} | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) rename docs/guides/model_convert/convert_from_pytorch/api_difference/{ops/torch.nn.functional.hardshrink.md => Tensor/torch.Tensor.hardshrink.md} (60%) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.nn.functional.hardshrink.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md similarity index 60% rename from docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.nn.functional.hardshrink.md rename to docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md index d005527d076..c5a6b200f35 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.nn.functional.hardshrink.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md @@ -1,9 +1,9 @@ -## [ 仅参数名不一致 ]torch.nn.functional.hardshrink +## [ torch 参数更多 ]torch.Tensor.hardshrink -### [torch.nn.functional.hardshrink](https://pytorch.org/docs/1.13/generated/torch.nn.functional.hardshrink.html#torch.nn.functional.hardshrink) +### [torch.Tensor.hardshrink](https://pytorch.org/docs/1.13/generated/torch.Tensor.hardshrink.html?highlight=torch+tensor+hardshrink#torch.Tensor.hardshrink) ```python -torch.nn.functional.hardshrink(input, lambd=0.5) +torch.Tensor.hardshrink(input, lambd=0.5) ``` ### [paddle.nn.functional.hardshrink](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/functional/hardshrink_cn.html#hardshrink) @@ -18,3 +18,4 @@ paddle.nn.functional.hardshrink(x, threshold=0.5, name=None) | PyTorch | PaddlePaddle | 备注 | | ------------- | ------------ | ------------------------------------------------------ | | input | x | 输入的 Tensor。 | +| lambd | threshold | Hardshrink 激活计算公式中的 threshold 值。默认值为 0.5。 | From 34432162c20401bbbb8b084b65941bda64de8cfc Mon Sep 17 00:00:00 2001 From: Liyulingyue <852433440@qq.com> Date: Mon, 17 Apr 2023 06:10:09 +0800 Subject: [PATCH 14/31] fix --- .../torch.Tensor.heaviside.md} | 8 ++++---- .../{ops/torch.histc.md => Tensor/torch.Tensor.histc.md} | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) rename docs/guides/model_convert/convert_from_pytorch/api_difference/{ops/torch.heaviside.md => Tensor/torch.Tensor.heaviside.md} (80%) rename docs/guides/model_convert/convert_from_pytorch/api_difference/{ops/torch.histc.md => Tensor/torch.Tensor.histc.md} (73%) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.heaviside.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.heaviside.md similarity index 80% rename from docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.heaviside.md rename to docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.heaviside.md index e1612bdf879..c904f25874d 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.heaviside.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.heaviside.md @@ -1,9 +1,9 @@ -## [ 仅参数名不一致 ]torch.heaviside +## [ torch 参数更多 ]torch.Tensor.heaviside -### [torch.heaviside](https://pytorch.org/docs/1.13/generated/torch.heaviside.html#torch.heaviside) +### [torch.Tensor.heaviside](https://pytorch.org/docs/1.13/generated/torch.Tensor.heaviside.html?highlight=torch+tensor+heaviside#torch.Tensor.heaviside) ```python -torch.heaviside(input, values, *, out=None) +torch.Tensor.heaviside(input, values, *, out=None) ``` ### [paddle.heaviside](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/heaviside_cn.html#heaviside) @@ -28,7 +28,7 @@ paddle.heaviside(x, y, name=None) # Pytorch 写法 input = torch.tensor([-1.5, 0, 2.0]) values = torch.tensor([0.5]) -torch.heaviside(input, values, out = out) +torch.Tensor.heaviside(input, values, out = out) # Paddle 写法 input = paddle.to_tensor([-1.5, 0, 2.0]) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.histc.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md similarity index 73% rename from docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.histc.md rename to docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md index 6c78281580b..2e92faf4d5c 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.histc.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md @@ -1,9 +1,9 @@ -## [ 仅参数名不一致 ]torch.histc +## [ torch 参数更多 ]torch.Tensor.histc -### [torch.histc](https://pytorch.org/docs/1.13/generated/torch.histc.html#torch.histc) +### [torch.Tensor.histc](https://pytorch.org/docs/1.13/generated/torch.Tensor.histc.html?highlight=torch+tensor+histc#torch.Tensor.histc) ```python -torch.histc(input, bins=100, min=0, max=0, *, out=None) +torch.Tensor.histc(input, bins=100, min=0, max=0, *, out=None) ``` ### [paddle.histogram](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/histogram_cn.html#histogram) @@ -24,7 +24,7 @@ paddle.histogram(input, bins=100, min=0, max=0, name=None) #### out:指定输出 ```python # Pytorch 写法 -torch.histc(torch.tensor([1., 2, 1]), bins=4, min=0, max=3, out = y) +torch.Tensor.histc(torch.tensor([1., 2, 1]), bins=4, min=0, max=3, out = y) # Paddle 写法 y = paddle.histogram(paddle.to_tensor([1, 2, 1]), bins=4, min=0, max=3) From a08c515a44a77f5ac95b5445710c9b65904d02e0 Mon Sep 17 00:00:00 2001 From: Liyulingyue <852433440@qq.com> Date: Mon, 17 Apr 2023 22:17:33 +0800 Subject: [PATCH 15/31] fix --- .../api_difference/Tensor/torch.Tensor.gcd.md | 28 ++++--------------- .../api_difference/Tensor/torch.Tensor.ge.md | 26 ++++------------- 2 files changed, 12 insertions(+), 42 deletions(-) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gcd.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gcd.md index e706174eaea..dcb60440a63 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gcd.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gcd.md @@ -1,35 +1,19 @@ -## [ torch 参数更多 ]torch.Tensor.gcd.md - -同 torch.gcd +## [ 仅参数名不一致 ]torch.Tensor.gcd ### [torch.Tensor.gcd](https://pytorch.org/docs/1.13/generated/torch.Tensor.gcd.html?highlight=torch+tensor+gcd#torch.Tensor.gcd) ```python -torch.Tensor.gcd(input, other, *, out=None) +torch.Tensor.gcd(other) ``` -### [paddle.gcd(x, y, name=None)](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/gcd_cn.html) +### [paddle.Tensor.gcd(x, y, name=None)](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#gcd-x-y-name-none) ```python -paddle.gcd(x, y, name=None) +paddle.Tensor.gcd(y, name=None) ``` -其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: - +两者功能一致,仅参数名不一致,具体如下: ### 参数映射 | PyTorch | PaddlePaddle | 备注 | |----------------------------------|------------------------------| ------------------------------------------------------ | -| input | x | 输入的 Tensor ,仅参数名不同。 | -| other | y | 输入的 Tensor ,仅参数名不同 -| out | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 | - -### 转写示例 - -#### out:指定输出 -```python -# Pytorch 写法 -torch.Tensor.gcd([-3, -5], out=y) # 同 y = torch.Tensor.gcd([-3, -5]) - -# Paddle 写法 -y = paddle.gcd([-3, -5]) -``` +| other | y | 输入的 Tensor ,仅参数名不同。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ge.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ge.md index 72e507fe8e7..d8983d51d5a 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ge.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ge.md @@ -1,33 +1,19 @@ -## [ torch 参数更多 ]torch.Tensor.ge +## [ 仅参数名不一致 ]torch.Tensor.ge ### [torch.Tensor.ge](https://pytorch.org/docs/1.13/generated/torch.Tensor.ge.html?highlight=torch+tensor+ge#torch.Tensor.ge) ```python -torch.Tensor.ge(input, other, *, out=None) +torch.Tensor.ge(other) ``` -### [paddle.greater_equal](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/greater_equal_cn.html#greater-equal) +### [paddle.Tensor.greater_equal](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#greater-equal-y-name-none) ```python -paddle.greater_equal(x, y, name=None) +paddle.Tensor.greater_equal(y, name=None) ``` -其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: - +两者功能一致,仅参数名不一致,具体如下: ### 参数映射 | PyTorch | PaddlePaddle | 备注 | |----------------------------------|------------------------------| ------------------------------------------------------ | -| input | x | 输入的 Tensor ,仅参数名不同。 | -| other | y | 输入的 Tensor ,仅参数名不同 -| out | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 | - -### 转写示例 - -#### out:指定输出 -```python -# Pytorch 写法 -torch.Tensor.ge(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]), out = y) # 同 y = torch.Tensor.ge(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) - -# Paddle 写法 -y = paddle.greater_equal(paddle.to_tensor([[1, 2], [3, 4]]), paddle.to_tensor([[1, 1], [4, 4]])) -``` +| other | y | 输入的 Tensor ,仅参数名不同。 | From 056ae22092f62fa01d866134d6b0c4515dbbd277 Mon Sep 17 00:00:00 2001 From: Liyulingyue <852433440@qq.com> Date: Tue, 18 Apr 2023 04:43:40 +0800 Subject: [PATCH 16/31] fix --- .../api_difference/Tensor/torch.Tensor.ger.md | 33 +++++-------------- .../Tensor/torch.Tensor.get_device.md | 8 ++--- .../Tensor/torch.Tensor.greater.md | 26 ++++----------- .../Tensor/torch.Tensor.greater_equal.md | 26 ++++----------- .../api_difference/Tensor/torch.Tensor.gt.md | 26 ++++----------- .../Tensor/torch.Tensor.hardshrink.md | 16 +++------ .../Tensor/torch.Tensor.heaviside.md | 30 ++++------------- .../Tensor/torch.Tensor.histc.md | 23 +++---------- 8 files changed, 45 insertions(+), 143 deletions(-) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ger.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ger.md index a19c9eb257c..734ce411aa6 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ger.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ger.md @@ -1,36 +1,19 @@ -## [ torch 参数更多 ]torch.Tensor.ger +## [ 仅参数名不一致 ]torch.Tensor.ger ### [torch.Tensor.ger](https://pytorch.org/docs/1.13/generated/torch.Tensor.ger.html?highlight=torch+tensor+ger#torch.Tensor.ger) ```python -torch.Tensor.ger(input, vec2, *, out=None) +torch.Tensor.ger(vec2) ``` -### [paddle.outer](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/outer_cn.html) +### [paddle.Tensor.outer]() ```python -paddle.outer(x, y, name=None) +paddle.Tensor.outer(y, name=None) ``` -其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: - +两者功能一致,仅参数名不一致,具体如下: ### 参数映射 -| PyTorch | PaddlePaddle | 备注 | -|----------------------------------|------------------------------| ------------------------------------------------------ | -| input | x | 输入的 Tensor ,仅参数名不同。 | -| vec2 | y | 输入的 Tensor ,仅参数名不同 -| out | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 | - -### 转写示例 - -#### out:指定输出 -```python -# Pytorch 写法 -v1 = torch.arange(1., 5.) -v2 = torch.arange(1., 4.) -torch.Tensor.ger(v1, v2, out = out) # 同 out = torch.Tensor.ger(v1, v2) - -# Paddle 写法 -v1 = paddle.arange(1, 5).astype('float32') -v2 = paddle.arange(1, 4).astype('float32') -out = paddle.outer(v1, v2) +| PyTorch | PaddlePaddle | 备注 | +|--------------------------------|------------------------------| ------------------------------------------------------ | +| vec2 | y | 输入的 Tensor ,仅参数名不同。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md index 47131301bfe..47d36db1918 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md @@ -1,4 +1,4 @@ -## [ 无参数 ]torch.Tensor.get_device +## torch.Tensor.get_device ### [torch.Tensor.get_device](https://pytorch.org/docs/1.13/generated/torch.Tensor.get_device.html?highlight=torch+tensor+get_device#torch.Tensor.get_device) @@ -6,10 +6,10 @@ torch.Tensor.get_device() ``` -### [paddle.device.get_device](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/device/get_device_cn.html#get-device) +### [paddle.device.get_device]() ```python -paddle.device.get_device() +paddle.Tensor.get_device() ``` -函数功能类似,但不完全相同。torch.Tensor.get_device()用于获取某个 Tensor 的位置,paddle.device.get_device()用于获取当前的运行环境。 +两者功能一致且用法一致。 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.greater.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.greater.md index e7ba4ba2f27..e08c066f1dd 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.greater.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.greater.md @@ -1,33 +1,19 @@ -## [ torch 参数更多 ]torch.Tensor.greater +## [ 仅参数名不一致 ]torch.Tensor.greater ### [torch.Tensor.greater](https://pytorch.org/docs/1.13/generated/torch.Tensor.greater.html?highlight=torch+tensor+greater#torch.Tensor.greater) ```python -torch.Tensor.greater(input, other, *, out=None) +torch.Tensor.greater(other) ``` -### [paddle.greater_than](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/greater_than_cn.html) +### [paddle.Tensor.greater_than](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#greater-than-y-name-none) ```python -paddle.greater_than(x, y, name=None) +paddle.Tensor.greater_than(y, name=None) ``` -其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: - +两者功能一致,仅参数名不一致,具体如下: ### 参数映射 | PyTorch | PaddlePaddle | 备注 | |----------------------------------|------------------------------| ------------------------------------------------------ | -| input | x | 输入的 Tensor ,仅参数名不同。 | -| other | y | 输入的 Tensor ,仅参数名不同 -| out | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 | - -### 转写示例 - -#### out:指定输出 -```python -# Pytorch 写法 -torch.Tensor.greater(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]), out = y) # 同 y = torch.Tensor.greater(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) - -# Paddle 写法 -y = paddle.greater_than(paddle.to_tensor([[1, 2], [3, 4]]), paddle.to_tensor([[1, 1], [4, 4]])) -``` +| other | y | 输入的 Tensor ,仅参数名不同。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.greater_equal.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.greater_equal.md index 6aeeda6d786..38379873c00 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.greater_equal.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.greater_equal.md @@ -1,33 +1,19 @@ -## [ torch 参数更多 ]torch.Tensor.greater_equal +## [ 仅参数名不一致 ]torch.Tensor.greater_equal ### [torch.Tensor.greater_equal](https://pytorch.org/docs/1.13/generated/torch.Tensor.greater_equal.html?highlight=torch+tensor+greater_equal#torch.Tensor.greater_equal) ```python -torch.Tensor.greater_equal(input, other, *, out=None) +torch.Tensor.greater_equal(other) ``` -### [paddle.greater_equal](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/greater_equal_cn.html#greater-equal) +### [paddle.Tensor.greater_equal](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#greater-equal-y-name-none) ```python -paddle.greater_equal(x, y, name=None) +paddle.Tensor.greater_equal(y, name=None) ``` -其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: - +两者功能一致,仅参数名不一致,具体如下: ### 参数映射 | PyTorch | PaddlePaddle | 备注 | |----------------------------------|------------------------------| ------------------------------------------------------ | -| input | x | 输入的 Tensor ,仅参数名不同。 | -| other | y | 输入的 Tensor ,仅参数名不同 -| out | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 | - -### 转写示例 - -#### out:指定输出 -```python -# Pytorch 写法 -torch.Tensor.greater_equal(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]), out = y) # 同 y = torch.Tensor.greater_equal(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) - -# Paddle 写法 -y = paddle.greater_equal(paddle.to_tensor([[1, 2], [3, 4]]), paddle.to_tensor([[1, 1], [4, 4]])) -``` +| other | y | 输入的 Tensor ,仅参数名不同。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gt.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gt.md index 6cdbf0a91f4..fe1bc2d1e8d 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gt.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gt.md @@ -1,33 +1,19 @@ -## [ torch 参数更多 ]torch.Tensor.gt +## [ 仅参数名不一致 ]torch.Tensor.gt ### [torch.Tensor.gt](https://pytorch.org/docs/1.13/generated/torch.Tensor.gt.html?highlight=torch+tensor+gt#torch.Tensor.gt) ```python -torch.Tensor.gt(input, other, *, out=None) +torch.Tensor.gt(other) ``` -### [paddle.greater_than](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/greater_than_cn.html) +### [paddle.Tensor.greater_than](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#greater-than-y-name-none) ```python -paddle.greater_than(x, y, name=None) +paddle.Tensor.greater_than(y, name=None) ``` -其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: - +两者功能一致,仅参数名不一致,具体如下: ### 参数映射 | PyTorch | PaddlePaddle | 备注 | |----------------------------------|------------------------------| ------------------------------------------------------ | -| input | x | 输入的 Tensor ,仅参数名不同。 | -| other | y | 输入的 Tensor ,仅参数名不同 -| out | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 | - -### 转写示例 - -#### out:指定输出 -```python -# Pytorch 写法 -torch.Tensor.gt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]), out = y) # 同 y = torch.Tensor.gt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]])) - -# Paddle 写法 -y = paddle.greater_than(paddle.to_tensor([[1, 2], [3, 4]]), paddle.to_tensor([[1, 1], [4, 4]])) -``` +| other | y | 输入的 Tensor ,仅参数名不同。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md index c5a6b200f35..3f978d28811 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md @@ -1,21 +1,15 @@ -## [ torch 参数更多 ]torch.Tensor.hardshrink +## torch.Tensor.hardshrink ### [torch.Tensor.hardshrink](https://pytorch.org/docs/1.13/generated/torch.Tensor.hardshrink.html?highlight=torch+tensor+hardshrink#torch.Tensor.hardshrink) ```python -torch.Tensor.hardshrink(input, lambd=0.5) +torch.Tensor.hardshrink(lambd=0.5) ``` -### [paddle.nn.functional.hardshrink](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/functional/hardshrink_cn.html#hardshrink) +### [paddle.Tensor.hardshrink]() ```python -paddle.nn.functional.hardshrink(x, threshold=0.5, name=None) +paddle.Tensor.hardshrink(threshold=0.5, name=None) ``` -两者功能一致且参数用法一致,仅参数名不同,具体如下: - -### 参数差异 -| PyTorch | PaddlePaddle | 备注 | -| ------------- | ------------ | ------------------------------------------------------ | -| input | x | 输入的 Tensor。 | -| lambd | threshold | Hardshrink 激活计算公式中的 threshold 值。默认值为 0.5。 | +两者功能一致且参数用法一致。 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.heaviside.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.heaviside.md index c904f25874d..5f326d18f50 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.heaviside.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.heaviside.md @@ -1,37 +1,19 @@ -## [ torch 参数更多 ]torch.Tensor.heaviside +## [ 仅参数名不一致 ]torch.Tensor.heaviside ### [torch.Tensor.heaviside](https://pytorch.org/docs/1.13/generated/torch.Tensor.heaviside.html?highlight=torch+tensor+heaviside#torch.Tensor.heaviside) ```python -torch.Tensor.heaviside(input, values, *, out=None) +torch.Tensor.heaviside(values) ``` -### [paddle.heaviside](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/heaviside_cn.html#heaviside) +### [paddle.heaviside](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#heaviside-y-name-none) ```python -paddle.heaviside(x, y, name=None) +paddle.Tensor.heaviside(y, name=None) ``` -其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: - +两者功能一致,仅参数名不一致,具体如下: ### 参数映射 | PyTorch | PaddlePaddle | 备注 | |-----------------------------------|------------------------------| ------------------------------------------------------ | -| input | x | 输入的 Tensor ,仅参数名不同。 | -| values | y | 输入的 Tensor ,仅参数名不同 -| out | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 | - -### 转写示例 - -#### out:指定输出 -```python -# Pytorch 写法 -input = torch.tensor([-1.5, 0, 2.0]) -values = torch.tensor([0.5]) -torch.Tensor.heaviside(input, values, out = out) - -# Paddle 写法 -input = paddle.to_tensor([-1.5, 0, 2.0]) -values = paddle.to_tensor([0.5]) -out = paddle.heaviside(input, values) -``` +| values | y | 输入的 Tensor ,仅参数名不同。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md index 2e92faf4d5c..662b39b2fc4 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md @@ -1,30 +1,15 @@ -## [ torch 参数更多 ]torch.Tensor.histc +## torch.Tensor.histc ### [torch.Tensor.histc](https://pytorch.org/docs/1.13/generated/torch.Tensor.histc.html?highlight=torch+tensor+histc#torch.Tensor.histc) ```python -torch.Tensor.histc(input, bins=100, min=0, max=0, *, out=None) +torch.Tensor.histc(bins=100, min=0, max=0) ``` ### [paddle.histogram](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/histogram_cn.html#histogram) ```python -paddle.histogram(input, bins=100, min=0, max=0, name=None) +paddle.Tensor.histogram(bins=100, min=0, max=0, name=None) ``` -其中 Pytorch 相比 Paddle 支持更多其他参数,具体如下: - -### 参数映射 -| PyTorch | PaddlePaddle | 备注 | -|-----------------------------------|------------------------------| ------------------------------------------------------ | -| out | - | 表示输出的 Tensor,PaddlePaddle 无此参数,需要进行转写。 | - -### 转写示例 - -#### out:指定输出 -```python -# Pytorch 写法 -torch.Tensor.histc(torch.tensor([1., 2, 1]), bins=4, min=0, max=3, out = y) - -# Paddle 写法 -y = paddle.histogram(paddle.to_tensor([1, 2, 1]), bins=4, min=0, max=3) +两者功能一致且用法一致。 From ff0a095c34f6f7f043c10243cfcff9ce7c37bd65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Sun, 23 Apr 2023 00:11:17 +0800 Subject: [PATCH 17/31] Update torch.Tensor.gcd.md --- .../api_difference/Tensor/torch.Tensor.gcd.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gcd.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gcd.md index dcb60440a63..23ea30fbc23 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gcd.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.gcd.md @@ -6,7 +6,7 @@ torch.Tensor.gcd(other) ``` -### [paddle.Tensor.gcd(x, y, name=None)](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#gcd-x-y-name-none) +### [paddle.Tensor.gcd](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#gcd-x-y-name-none) ```python paddle.Tensor.gcd(y, name=None) From 40b73bbfa37dd5e0bd2939889f08fd8326c15499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Sun, 23 Apr 2023 00:12:26 +0800 Subject: [PATCH 18/31] Apply suggestions from code review --- .../api_difference/Tensor/torch.Tensor.get_device.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md index 47d36db1918..b365491ce32 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md @@ -1,4 +1,4 @@ -## torch.Tensor.get_device +## [ 无参数 ]torch.Tensor.get_device ### [torch.Tensor.get_device](https://pytorch.org/docs/1.13/generated/torch.Tensor.get_device.html?highlight=torch+tensor+get_device#torch.Tensor.get_device) From 47851820bdc3789d3aedeab72f01a8703c1ca2c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Sun, 23 Apr 2023 00:12:56 +0800 Subject: [PATCH 19/31] Apply suggestions from code review --- .../api_difference/Tensor/torch.Tensor.get_device.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md index b365491ce32..428e4f9e699 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md @@ -9,7 +9,7 @@ torch.Tensor.get_device() ### [paddle.device.get_device]() ```python -paddle.Tensor.get_device() +paddle.device.get_device() ``` 两者功能一致且用法一致。 From 7c33909a9833b0f9012e45259fde4eb9c56e092c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Sun, 23 Apr 2023 00:13:18 +0800 Subject: [PATCH 20/31] Apply suggestions from code review --- .../api_difference/Tensor/torch.Tensor.get_device.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md index 428e4f9e699..ebb95735262 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.get_device.md @@ -12,4 +12,4 @@ torch.Tensor.get_device() paddle.device.get_device() ``` -两者功能一致且用法一致。 +两者功能一致且无参数。 From ecb4de457745c38a2e4dbb9e0ed2a03c15b61a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Sun, 23 Apr 2023 00:13:51 +0800 Subject: [PATCH 21/31] Apply suggestions from code review --- .../api_difference/Tensor/torch.Tensor.hardshrink.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md index 3f978d28811..4db64b5c33a 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md @@ -1,4 +1,4 @@ -## torch.Tensor.hardshrink +## [ 仅参数名不一致 ]torch.Tensor.hardshrink ### [torch.Tensor.hardshrink](https://pytorch.org/docs/1.13/generated/torch.Tensor.hardshrink.html?highlight=torch+tensor+hardshrink#torch.Tensor.hardshrink) From b9e54e1d533861bca8f27323172431b0738dd8a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Sun, 23 Apr 2023 00:14:35 +0800 Subject: [PATCH 22/31] Apply suggestions from code review --- .../api_difference/Tensor/torch.Tensor.heaviside.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.heaviside.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.heaviside.md index 5f326d18f50..2e4c0da3185 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.heaviside.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.heaviside.md @@ -6,7 +6,7 @@ torch.Tensor.heaviside(values) ``` -### [paddle.heaviside](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#heaviside-y-name-none) +### [paddle.Tensor.heaviside](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#heaviside-y-name-none) ```python paddle.Tensor.heaviside(y, name=None) From 9ab6d8724a958f94ec207b8999839199456d3a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Sun, 23 Apr 2023 00:15:32 +0800 Subject: [PATCH 23/31] Apply suggestions from code review --- .../api_difference/Tensor/torch.Tensor.histc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md index 662b39b2fc4..bf940b8d796 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md @@ -6,7 +6,7 @@ torch.Tensor.histc(bins=100, min=0, max=0) ``` -### [paddle.histogram](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/histogram_cn.html#histogram) +### [paddle.Tensor.histogram](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#histogram-bins-100-min-0-max-0) ```python paddle.Tensor.histogram(bins=100, min=0, max=0, name=None) From 029fe4bc0face77a609b01c48c164765cc6ee9c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Sun, 23 Apr 2023 00:16:47 +0800 Subject: [PATCH 24/31] Apply suggestions from code review --- .../api_difference/Tensor/torch.Tensor.histc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md index bf940b8d796..b9d76d76e50 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md @@ -12,4 +12,4 @@ torch.Tensor.histc(bins=100, min=0, max=0) paddle.Tensor.histogram(bins=100, min=0, max=0, name=None) ``` -两者功能一致且用法一致。 +两者功能一致且参数完全一致。 From 41a15510f8d10554d2a42d81081fcbadb79fdcc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Sun, 23 Apr 2023 00:17:07 +0800 Subject: [PATCH 25/31] Apply suggestions from code review --- .../api_difference/Tensor/torch.Tensor.histc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md index b9d76d76e50..7a7db457fec 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md @@ -1,4 +1,4 @@ -## torch.Tensor.histc +## [ 参数完全一致 ]torch.Tensor.histc ### [torch.Tensor.histc](https://pytorch.org/docs/1.13/generated/torch.Tensor.histc.html?highlight=torch+tensor+histc#torch.Tensor.histc) From 3238104e530476e68c77ce92361a287f1f8f3cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Sun, 23 Apr 2023 00:19:04 +0800 Subject: [PATCH 26/31] Update torch.Tensor.hardshrink.md --- .../api_difference/Tensor/torch.Tensor.hardshrink.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md index 4db64b5c33a..44f072737e6 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md @@ -13,3 +13,7 @@ paddle.Tensor.hardshrink(threshold=0.5, name=None) ``` 两者功能一致且参数用法一致。 + +| PyTorch | PaddlePaddle | 备注 | +|-----------------------------------|------------------------------| ------------------------------------------------------ | +| lambd | threshold | Hardshrink 阈值,仅参数名不同。 | From daee291ba32d450bcac394bef45d6c7f5efad51a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Sun, 23 Apr 2023 12:29:20 +0800 Subject: [PATCH 27/31] Update torch.Tensor.hardshrink.md --- .../api_difference/Tensor/torch.Tensor.hardshrink.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md index 44f072737e6..9a3efb681fc 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hardshrink.md @@ -14,6 +14,8 @@ paddle.Tensor.hardshrink(threshold=0.5, name=None) 两者功能一致且参数用法一致。 +### 参数映射 + | PyTorch | PaddlePaddle | 备注 | |-----------------------------------|------------------------------| ------------------------------------------------------ | | lambd | threshold | Hardshrink 阈值,仅参数名不同。 | From fbddab079e7c36a69baac71d581b750c4c0ae730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Sun, 23 Apr 2023 19:53:37 +0800 Subject: [PATCH 28/31] Apply suggestions from code review --- .../api_difference/Tensor/torch.Tensor.histc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md index 7a7db457fec..2aafbc8fe96 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md @@ -11,5 +11,5 @@ torch.Tensor.histc(bins=100, min=0, max=0) ```python paddle.Tensor.histogram(bins=100, min=0, max=0, name=None) ``` - +### 参数映射 两者功能一致且参数完全一致。 From 93f4b9000d2148f04fab0c4bf937e85f2ea14f34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Sun, 23 Apr 2023 19:54:28 +0800 Subject: [PATCH 29/31] Apply suggestions from code review --- .../api_difference/Tensor/torch.Tensor.histc.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md index 2aafbc8fe96..b5bcb292153 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md @@ -10,6 +10,4 @@ torch.Tensor.histc(bins=100, min=0, max=0) ```python paddle.Tensor.histogram(bins=100, min=0, max=0, name=None) -``` -### 参数映射 两者功能一致且参数完全一致。 From cdd1b44a36b1c305eccf9d5455e7a33d53b0f385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Sun, 23 Apr 2023 19:56:57 +0800 Subject: [PATCH 30/31] Update torch.Tensor.histc.md --- .../api_difference/Tensor/torch.Tensor.histc.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md index b5bcb292153..7a7db457fec 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md @@ -10,4 +10,6 @@ torch.Tensor.histc(bins=100, min=0, max=0) ```python paddle.Tensor.histogram(bins=100, min=0, max=0, name=None) +``` + 两者功能一致且参数完全一致。 From 313ce830a6279e90b4e1333d38f06c256eafe502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Sun, 23 Apr 2023 20:00:07 +0800 Subject: [PATCH 31/31] Update torch.Tensor.histc.md --- .../api_difference/Tensor/torch.Tensor.histc.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md index 7a7db457fec..089aa6da17d 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.histc.md @@ -13,3 +13,11 @@ paddle.Tensor.histogram(bins=100, min=0, max=0, name=None) ``` 两者功能一致且参数完全一致。 + +### 参数映射 + +| PyTorch | PaddlePaddle | 备注 | +|-----------------------------------|------------------------------| ------------------------------------------------------ | +| bins | bins | 直方图 bins(直条)的个数,默认为 100。 | +| min | min | range 的下边界(包含),默认为 0。 | +| max | max | range 的上边界(包含),默认为 0。 |