From 2c8a03c52cd3a2ad351f08f40807a2959fbd4d87 Mon Sep 17 00:00:00 2001 From: Ryan <44900829+DrRyanHuang@users.noreply.github.com> Date: Sat, 11 Mar 2023 08:17:00 +0000 Subject: [PATCH 1/3] add task 2 --- .../api_difference/Tensor/.gitkeep | 0 .../api_difference/Tensor/torch.Tensor.T.md | 15 +++++++++++ .../Tensor/torch.Tensor.device.md | 15 +++++++++++ .../Tensor/torch.Tensor.grad.md | 15 +++++++++++ .../Tensor/torch.Tensor.imag.md | 15 +++++++++++ .../Tensor/torch.Tensor.is_leaf.md | 15 +++++++++++ .../Tensor/torch.Tensor.is_sparse.md | 15 +++++++++++ .../Tensor/torch.Tensor.ndim.md | 15 +++++++++++ .../Tensor/torch.Tensor.real.md | 15 +++++++++++ .../Tensor/torch.Tensor.shape.md | 15 +++++++++++ .../torch.nn.functional.affine_grid.md | 26 +++++++++++++++++++ 11 files changed, 161 insertions(+) delete mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/.gitkeep create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.T.md create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.device.md create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.grad.md create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.imag.md create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_leaf.md create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_sparse.md create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ndim.md create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.real.md create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.shape.md create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.affine_grid.md diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/.gitkeep b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.T.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.T.md new file mode 100644 index 00000000000..612b320433f --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.T.md @@ -0,0 +1,15 @@ +## torch.Tensor.T + +### [torch.Tensor.T](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.T) + +```python +torch.Tensor.T +``` + +### [paddle.Tensor.T](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#tensor) + +```python +paddle.Tensor.T +``` + +两者功能一致,均无参数 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.device.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.device.md new file mode 100644 index 00000000000..7b1a7165a3a --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.device.md @@ -0,0 +1,15 @@ +## torch.Tensor.device + +### [torch.Tensor.device](https://pytorch.org/docs/stable/generated/torch.Tensor.device.html) + +```python +torch.Tensor.device +``` + +### [paddle.Tensor.place](https://www.paddlepaddle.org.cn/documentation/docs/api/paddle/Tensor_cn.html#place) + +```python +paddle.Tensor.place +``` + +两者功能一致,均无参数,都用来查看一个 Tensor 的设备位置 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.grad.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.grad.md new file mode 100644 index 00000000000..821cdba478c --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.grad.md @@ -0,0 +1,15 @@ +## torch.Tensor.grad + +### [torch.Tensor.grad](https://pytorch.org/docs/stable/generated/torch.Tensor.grad.html) + +```python +torch.Tensor.grad +``` + +### [paddle.Tensor.grad](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#grad) + +```python +paddle.Tensor.grad +``` + +两者功能一致,均无参数,都用来查看一个 Tensor 的梯度 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.imag.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.imag.md new file mode 100644 index 00000000000..f8674b17c89 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.imag.md @@ -0,0 +1,15 @@ +## torch.Tensor.imag + +### [torch.Tensor.imag](https://pytorch.org/docs/stable/generated/torch.Tensor.imag.html) + +```python +torch.Tensor.imag +``` + +### [paddle.Tensor.imag](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#imag-name-none) + +```python +paddle.Tensor.imag +``` + +两者功能一致,均无参数,用于返回原复数 Tensor 的虚部数值 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_leaf.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_leaf.md new file mode 100644 index 00000000000..9e313dbc413 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_leaf.md @@ -0,0 +1,15 @@ +## torch.Tensor.is_leaf + +### [torch.Tensor.is_leaf](https://pytorch.org/docs/stable/generated/torch.Tensor.is_leaf.html) + +```python +torch.Tensor.is_leaf +``` + +### [paddle.Tensor.is_leaf](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#is-leaf) + +```python +paddle.Tensor.is_leaf +``` + +两者功能一致,均为参数,判断 Tensor 是否为叶子 Tensor diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_sparse.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_sparse.md new file mode 100644 index 00000000000..fb61cf7b599 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_sparse.md @@ -0,0 +1,15 @@ +## torch.Tensor.is_sparse + +### [torch.Tensor.is_sparse](https://pytorch.org/docs/stable/generated/torch.Tensor.is_sparse.html) + +```python +torch.Tensor.is_sparse +``` + +### [paddle.Tensor.is_sparse](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html) + +```python +paddle.Tensor.is_sparse() +``` + +两者功能一致,前者可以直接访问, 后者需要调用 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ndim.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ndim.md new file mode 100644 index 00000000000..1a876d67fb9 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ndim.md @@ -0,0 +1,15 @@ +## torch.Tensor.ndim + +### [torch.Tensor.ndim](https://pytorch.org/docs/stable/generated/torch.Tensor.ndim.html) + +```python +torch.Tensor.ndim +``` + +### [paddle.Tensor.ndim](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#ndim) + +```python +paddle.Tensor.ndim +``` + +两者功能一致,均无参数,查看一个 Tensor 的维度 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.real.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.real.md new file mode 100644 index 00000000000..6005360bf43 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.real.md @@ -0,0 +1,15 @@ +## torch.Tensor.real + +### [torch.Tensor.real](https://pytorch.org/docs/stable/generated/torch.Tensor.real.html) + +```python +torch.Tensor.real +``` + +### [paddle.Tensor.real](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#real-name-none) + +```python +paddle.Tensor.real +``` + +两者功能一致,均无参数,用于返回 Tensor 的实部数值 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.shape.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.shape.md new file mode 100644 index 00000000000..441559c3a53 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.shape.md @@ -0,0 +1,15 @@ +## torch.Tensor.shape + +### [torch.Tensor.shape](https://pytorch.org/docs/stable/generated/torch.Tensor.shape.html) + +```python +torch.Tensor.shape +``` + +### [paddle.Tensor.shape](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#shape) + +```python +paddle.Tensor.shape +``` + +两者功能一致,均无参数,都用来查看一个 Tensor 的 shape,shape 是 Tensor 的一个重要的概念,其描述了 tensor 在每个维度上的元素数量。 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.affine_grid.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.affine_grid.md new file mode 100644 index 00000000000..a6ce79a4130 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.affine_grid.md @@ -0,0 +1,26 @@ +## torch.nn.functional.affine_grid + +### [torch.nn.functional.affine_grid](https://pytorch.org/docs/stable/generated/torch.nn.functional.affine_grid.html?highlight=affine_grid#torch.nn.functional.affine_grid) + +```python +torch.nn.functional.affine_grid(theta, +size, +align_corners=None) +``` + +### [paddle.nn.functional.affine_grid](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/functional/affine_grid_cn.html) + +```python +paddle.nn.functional.affine_grid(theta, +out_shape, +align_corners=True, +name=None) +``` + +两者功能一致,仅参数名不一致,具体如下: +### 参数差异 +| PyTorch | PaddlePaddle | 备注 | +| ------------- | ------------ | ------------------------------------------------------ | +| theta | theta | 指定仿射变换矩阵 | +| size | out_shape | 指定目标输出图像大小 | +| align_corners | align_corners | 指定是否是像素中心对齐 | From c9171f62e2d4d674172a159ee1f84e86a85c47f8 Mon Sep 17 00:00:00 2001 From: Ryan <44900829+DrRyanHuang@users.noreply.github.com> Date: Mon, 13 Mar 2023 13:40:52 +0000 Subject: [PATCH 2/3] update conversion --- .../api_difference/Tensor/torch.Tensor.T.md | 4 ++-- .../api_difference/Tensor/torch.Tensor.device.md | 4 ++-- .../api_difference/Tensor/torch.Tensor.grad.md | 4 ++-- .../api_difference/Tensor/torch.Tensor.imag.md | 4 ++-- .../api_difference/Tensor/torch.Tensor.is_leaf.md | 4 ++-- .../api_difference/Tensor/torch.Tensor.is_sparse.md | 4 ++-- .../api_difference/Tensor/torch.Tensor.ndim.md | 4 ++-- .../api_difference/Tensor/torch.Tensor.real.md | 4 ++-- .../api_difference/Tensor/torch.Tensor.shape.md | 2 +- .../functional/torch.nn.functional.affine_grid.md | 12 ++++++------ 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.T.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.T.md index 612b320433f..11cf8ee860c 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.T.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.T.md @@ -1,4 +1,4 @@ -## torch.Tensor.T +## [ 无参数 ] torch.Tensor.T ### [torch.Tensor.T](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.T) @@ -12,4 +12,4 @@ torch.Tensor.T paddle.Tensor.T ``` -两者功能一致,均无参数 +两者功能一致,均无参数。 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.device.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.device.md index 7b1a7165a3a..ce7bec62c72 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.device.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.device.md @@ -1,4 +1,4 @@ -## torch.Tensor.device +## [ 无参数 ] torch.Tensor.device ### [torch.Tensor.device](https://pytorch.org/docs/stable/generated/torch.Tensor.device.html) @@ -12,4 +12,4 @@ torch.Tensor.device paddle.Tensor.place ``` -两者功能一致,均无参数,都用来查看一个 Tensor 的设备位置 +两者功能一致,均无参数,都用来查看一个 Tensor 的设备位置。 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.grad.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.grad.md index 821cdba478c..685e9efe165 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.grad.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.grad.md @@ -1,4 +1,4 @@ -## torch.Tensor.grad +## [ 无参数 ] torch.Tensor.grad ### [torch.Tensor.grad](https://pytorch.org/docs/stable/generated/torch.Tensor.grad.html) @@ -12,4 +12,4 @@ torch.Tensor.grad paddle.Tensor.grad ``` -两者功能一致,均无参数,都用来查看一个 Tensor 的梯度 +两者功能一致,均无参数,都用来查看一个 Tensor 的梯度。 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.imag.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.imag.md index f8674b17c89..0741d26407b 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.imag.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.imag.md @@ -1,4 +1,4 @@ -## torch.Tensor.imag +## [ 无参数 ] torch.Tensor.imag ### [torch.Tensor.imag](https://pytorch.org/docs/stable/generated/torch.Tensor.imag.html) @@ -12,4 +12,4 @@ torch.Tensor.imag paddle.Tensor.imag ``` -两者功能一致,均无参数,用于返回原复数 Tensor 的虚部数值 +两者功能一致,均无参数,用于返回原复数 Tensor 的虚部数值。 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_leaf.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_leaf.md index 9e313dbc413..0e823ead190 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_leaf.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_leaf.md @@ -1,4 +1,4 @@ -## torch.Tensor.is_leaf +## [ 无参数 ] torch.Tensor.is_leaf ### [torch.Tensor.is_leaf](https://pytorch.org/docs/stable/generated/torch.Tensor.is_leaf.html) @@ -12,4 +12,4 @@ torch.Tensor.is_leaf paddle.Tensor.is_leaf ``` -两者功能一致,均为参数,判断 Tensor 是否为叶子 Tensor +两者功能一致,均无参数,判断 Tensor 是否为叶子 Tensor。 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_sparse.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_sparse.md index fb61cf7b599..abcf6a36371 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_sparse.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_sparse.md @@ -1,4 +1,4 @@ -## torch.Tensor.is_sparse +## [ 无参数 ] torch.Tensor.is_sparse ### [torch.Tensor.is_sparse](https://pytorch.org/docs/stable/generated/torch.Tensor.is_sparse.html) @@ -12,4 +12,4 @@ torch.Tensor.is_sparse paddle.Tensor.is_sparse() ``` -两者功能一致,前者可以直接访问, 后者需要调用 +两者功能一致,前者可以直接访问, 后者需要调用。 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ndim.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ndim.md index 1a876d67fb9..53f41bc0923 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ndim.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.ndim.md @@ -1,4 +1,4 @@ -## torch.Tensor.ndim +## [ 无参数 ] torch.Tensor.ndim ### [torch.Tensor.ndim](https://pytorch.org/docs/stable/generated/torch.Tensor.ndim.html) @@ -12,4 +12,4 @@ torch.Tensor.ndim paddle.Tensor.ndim ``` -两者功能一致,均无参数,查看一个 Tensor 的维度 +两者功能一致,均无参数,查看一个 Tensor 的维度。 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.real.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.real.md index 6005360bf43..30e44c292ec 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.real.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.real.md @@ -1,4 +1,4 @@ -## torch.Tensor.real +## [ 无参数 ] torch.Tensor.real ### [torch.Tensor.real](https://pytorch.org/docs/stable/generated/torch.Tensor.real.html) @@ -12,4 +12,4 @@ torch.Tensor.real paddle.Tensor.real ``` -两者功能一致,均无参数,用于返回 Tensor 的实部数值 +两者功能一致,均无参数,用于返回 Tensor 的实部数值。 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.shape.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.shape.md index 441559c3a53..aaac2b09551 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.shape.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.shape.md @@ -1,4 +1,4 @@ -## torch.Tensor.shape +## [ 无参数 ] torch.Tensor.shape ### [torch.Tensor.shape](https://pytorch.org/docs/stable/generated/torch.Tensor.shape.html) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.affine_grid.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.affine_grid.md index a6ce79a4130..b7f0a9db7f6 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.affine_grid.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.affine_grid.md @@ -1,20 +1,20 @@ -## torch.nn.functional.affine_grid +## [ 仅参数名不一致 ] torch.nn.functional.affine_grid ### [torch.nn.functional.affine_grid](https://pytorch.org/docs/stable/generated/torch.nn.functional.affine_grid.html?highlight=affine_grid#torch.nn.functional.affine_grid) ```python torch.nn.functional.affine_grid(theta, -size, -align_corners=None) + size, + align_corners=None) ``` ### [paddle.nn.functional.affine_grid](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/functional/affine_grid_cn.html) ```python paddle.nn.functional.affine_grid(theta, -out_shape, -align_corners=True, -name=None) + out_shape, + align_corners=True, + name=None) ``` 两者功能一致,仅参数名不一致,具体如下: From a6b9e8597c067d2973c3a6184a8300997ed06024 Mon Sep 17 00:00:00 2001 From: Ryan <44900829+DrRyanHuang@users.noreply.github.com> Date: Tue, 14 Mar 2023 16:09:01 +0000 Subject: [PATCH 3/3] fix conversation --- .../api_difference/Tensor/torch.Tensor.is_sparse.md | 13 ++++++++++++- .../functional/torch.nn.functional.affine_grid.md | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_sparse.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_sparse.md index abcf6a36371..ad4ab0dd5f8 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_sparse.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_sparse.md @@ -12,4 +12,15 @@ torch.Tensor.is_sparse paddle.Tensor.is_sparse() ``` -两者功能一致,前者可以直接访问, 后者需要调用。 +两者功能一致,但使用方式不一致,前者可以直接访问属性,后者需要调用方法,具体如下: + +### 转写示例 +``` +# torch 版本可以直接访问属性 +# x = torch.rand(3) +# print(x.is_sparse) + +# Paddle 版本需要调用 +x = paddle.rand([3]) +print(x.is_sparse()) +``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.affine_grid.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.affine_grid.md index b7f0a9db7f6..23467e4bb25 100644 --- a/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.affine_grid.md +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.affine_grid.md @@ -18,9 +18,9 @@ paddle.nn.functional.affine_grid(theta, ``` 两者功能一致,仅参数名不一致,具体如下: -### 参数差异 +### 参数映射 | PyTorch | PaddlePaddle | 备注 | | ------------- | ------------ | ------------------------------------------------------ | | theta | theta | 指定仿射变换矩阵 | -| size | out_shape | 指定目标输出图像大小 | +| size | out_shape | 表示指定目标输出图像大小,仅参数名不一致。 | | align_corners | align_corners | 指定是否是像素中心对齐 |