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..11cf8ee860c --- /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..ce7bec62c72 --- /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..685e9efe165 --- /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..0741d26407b --- /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..0e823ead190 --- /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..ad4ab0dd5f8 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_sparse.md @@ -0,0 +1,26 @@ +## [ 无参数 ] 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() +``` + +两者功能一致,但使用方式不一致,前者可以直接访问属性,后者需要调用方法,具体如下: + +### 转写示例 +``` +# 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/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..53f41bc0923 --- /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..30e44c292ec --- /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..aaac2b09551 --- /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..23467e4bb25 --- /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 | 指定是否是像素中心对齐 |