diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.bitwise_left_shift.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.bitwise_left_shift.md new file mode 100644 index 00000000000..bb10be9c733 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.bitwise_left_shift.md @@ -0,0 +1,32 @@ +## [ paddle 参数更多 ]torch.Tensor.bitwise_left_shift + +### [torch.Tensor.bitwise_left_shift](https://pytorch.org/docs/stable/generated/torch.Tensor.bitwise_left_shift.html#torch-tensor-bitwise-left-shift) + +```python +torch.Tensor.bitwise_left_shift(other) +``` + +### [paddle.Tensor.bitwise_left_shift]() + +```python +paddle.Tensor.bitwise_left_shift(y, is_arithmetic=True) +``` + +其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下: + +### 参数映射 + +| PyTorch | PaddlePaddle | 备注 | +| ------- | ------------- | ------------------------------------------------------------------- | +| other | y | 表示输入的 Tensor ,仅参数名不一致。 | +| - | is_arithmetic | 用于表明是否执行算术位移, PyTorch 无此参数, Paddle 保持默认即可。 | + +### 转写示例 + +```python +# PyTorch 写法 +out = x.bitwise_left_shift(y) + +# Paddle 写法 +out = x.bitwise_left_shift(y) +``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.bitwise_left_shift_.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.bitwise_left_shift_.md new file mode 100644 index 00000000000..0f2b244024a --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.bitwise_left_shift_.md @@ -0,0 +1,32 @@ +## [ paddle 参数更多 ]torch.Tensor.bitwise_left_shift_ + +### [torch.Tensor.bitwise_left_shift_](https://pytorch.org/docs/stable/generated/torch.Tensor.bitwise_left_shift_.html#torch-tensor-bitwise-left-shift) + +```python +torch.Tensor.bitwise_left_shift_(other) +``` + +### [paddle.Tensor.bitwise_left_shift_]() + +```python +paddle.Tensor.bitwise_left_shift_(y, is_arithmetic=True) +``` + +其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下: + +### 参数映射 + +| PyTorch | PaddlePaddle | 备注 | +| ------- | ------------- | ------------------------------------------------------------------- | +| other | y | 表示输入的 Tensor ,仅参数名不一致。 | +| - | is_arithmetic | 用于表明是否执行算术位移, PyTorch 无此参数, Paddle 保持默认即可。 | + +### 转写示例 + +```python +# PyTorch 写法 +out = x.bitwise_left_shift_(y) + +# Paddle 写法 +out = x.bitwise_left_shift_(y) +``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.bitwise_right_shift.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.bitwise_right_shift.md new file mode 100644 index 00000000000..f6951ca69f5 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.bitwise_right_shift.md @@ -0,0 +1,32 @@ +## [ paddle 参数更多 ]torch.Tensor.bitwise_right_shift + +### [torch.Tensor.bitwise_right_shift](https://pytorch.org/docs/stable/generated/torch.Tensor.bitwise_right_shift.html#torch-tensor-bitwise-right-shift) + +```python +torch.Tensor.bitwise_right_shift(other) +``` + +### [paddle.Tensor.bitwise_right_shift]() + +```python +paddle.Tensor.bitwise_right_shift(y, is_arithmetic=True) +``` + +其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下: + +### 参数映射 + +| PyTorch | PaddlePaddle | 备注 | +| ------- | ------------- | ------------------------------------------------------------------- | +| other | y | 表示输入的 Tensor ,仅参数名不一致。 | +| - | is_arithmetic | 用于表明是否执行算术位移, PyTorch 无此参数, Paddle 保持默认即可。 | + +### 转写示例 + +```python +# PyTorch 写法 +out = x.bitwise_right_shift(y) + +# Paddle 写法 +out = x.bitwise_right_shift(y) +``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.bitwise_right_shift_.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.bitwise_right_shift_.md new file mode 100644 index 00000000000..0b0c66d154f --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.bitwise_right_shift_.md @@ -0,0 +1,32 @@ +## [ paddle 参数更多 ]torch.Tensor.bitwise_right_shift_ + +### [torch.Tensor.bitwise_right_shift_](https://pytorch.org/docs/stable/generated/torch.Tensor.bitwise_right_shift_.html#torch-tensor-bitwise-right-shift) + +```python +torch.Tensor.bitwise_right_shift_(other) +``` + +### [paddle.Tensor.bitwise_right_shift_]() + +```python +paddle.Tensor.bitwise_right_shift_(y, is_arithmetic=True) +``` + +其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下: + +### 参数映射 + +| PyTorch | PaddlePaddle | 备注 | +| ------- | ------------- | ------------------------------------------------------------------- | +| other | y | 表示输入的 Tensor ,仅参数名不一致。 | +| - | is_arithmetic | 用于表明是否执行算术位移, PyTorch 无此参数, Paddle 保持默认即可。 | + +### 转写示例 + +```python +# PyTorch 写法 +out = x.bitwise_right_shift_(y) + +# Paddle 写法 +out = x.bitwise_right_shift_(y) +``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.col_indices.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.col_indices.md new file mode 100644 index 00000000000..d6f2ecf7398 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.col_indices.md @@ -0,0 +1,15 @@ +## [ 无参数 ] torch.Tensor.col_indices + +### [torch.Tensor.col_indices](https://pytorch.org/docs/stable/generated/torch.Tensor.col_indices.html) + +```python +torch.Tensor.col_indices() +``` + +### [paddle.Tensor.cols]() + +```python +paddle.Tensor.cols() +``` + +两者功能一致,无参数。 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.crow_indices.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.crow_indices.md new file mode 100644 index 00000000000..83f29326b54 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.crow_indices.md @@ -0,0 +1,15 @@ +## [ 无参数 ] torch.Tensor.crow_indices + +### [torch.Tensor.crow_indices](https://pytorch.org/docs/stable/generated/torch.Tensor.crow_indices.html) + +```python +torch.Tensor.crow_indices() +``` + +### [paddle.Tensor.crows]() + +```python +paddle.Tensor.crows() +``` + +两者功能一致,无参数。 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.data_ptr.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.data_ptr.md new file mode 100644 index 00000000000..41909acfb0f --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.data_ptr.md @@ -0,0 +1,15 @@ +## [ 无参数 ] torch.Tensor.data_ptr + +### [torch.Tensor.data_ptr](https://pytorch.org/docs/stable/generated/torch.Tensor.data_ptr.html) + +```python +torch.Tensor.data_ptr() +``` + +### [paddle.Tensor.data_ptr](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html) + +```python +paddle.Tensor.data_ptr() +``` + +两者功能一致。 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.dim_order.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.dim_order.md new file mode 100644 index 00000000000..a71aa26a485 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.dim_order.md @@ -0,0 +1,19 @@ +## [ 组合替代实现 ] torch.Tensor.dim_order + +### [torch.Tensor.dim_order](https://pytorch.org/docs/stable/generated/torch.Tensor.dim_order.html?highlight=dim_order#torch.Tensor.dim_order) + +```python +torch.Tensor.dim_order() +``` + +Paddle 无此 API,需要组合实现。获取张量在内存中的物理布局,PaddlePaddle 的 Tensor 默认是 contiguous 的, 因此可直接返回一个从 0 到 Tensor 的维度长度的列表即可。 + +### 转写示例 + +```python +# PyTorch 写法 +y = x.dim_order() + +# Paddle 写法 +y = tuple([i for i in range(len(x.shape))]) +``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_sparse_csr.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_sparse_csr.md new file mode 100644 index 00000000000..5d29dc300a3 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_sparse_csr.md @@ -0,0 +1,25 @@ +## [ 无参数 ] torch.Tensor.is_sparse_csr + +### [torch.Tensor.is_sparse_csr](https://pytorch.org/docs/stable/generated/torch.Tensor.is_sparse_csr.html) + +```python +torch.Tensor.is_sparse_csr +``` + +### [paddle.Tensor.is_sparse_csr](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html) + +```python +paddle.Tensor.is_sparse_csr() +``` + +两者功能一致,但使用方式不一致,前者可以直接访问属性,后者需要调用方法,具体如下: + +### 转写示例 + +```python +# torch 版本可以直接访问属性 +x.is_sparse_csr + +# Paddle 版本需要调用 +x.is_sparse_csr() +``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.itemsize.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.itemsize.md new file mode 100644 index 00000000000..8e56dd2dea0 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.itemsize.md @@ -0,0 +1,15 @@ +## [ 无参数 ]torch.Tensor.item_size + +### [torch.Tensor.item_size](https://pytorch.org/docs/stable/generated/torch.Tensor.itemsize.html) + +```python +torch.Tensor.item_size() +``` + +### [paddle.Tensor.element_size](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#element-size) + +```python +paddle.Tensor.element_size() +``` + +两者功能一致,无参数。 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.nbytes.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.nbytes.md new file mode 100644 index 00000000000..34f171c46b9 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.nbytes.md @@ -0,0 +1,19 @@ +## [ 组合替代实现 ]torch.Tensor.nbytes + +### [torch.Tensor.nbytes](https://pytorch.org/docs/stable/generated/torch.Tensor.nbytes.html) + +```python +torch.Tensor.nbytes +``` + +Paddle 无此 API,需要组合实现。 + +### 转写示例 + +```python +# PyTorch 写法 +y = a.nbytes + +# Paddle 写法 +y = a.size * a.element_size() +``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.stride.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.stride.md new file mode 100644 index 00000000000..82f800a5293 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.stride.md @@ -0,0 +1,35 @@ +## [ torch 参数更多 ] torch.Tensor.stride + +### [torch.Tensor.stride](https://pytorch.org/docs/stable/generated/torch.Tensor.stride.html#torch-tensor-stride) + +```python +torch.Tensor.stride(dim=None) +``` + +### [paddle.Tensor.get_strides](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#tensor) + +```python +paddle.Tensor.get_strides() +``` + +PyTorch 相比 Paddle 支持更多其他参数,具体如下: + +### 参数映射 + + +| PyTorch | PaddlePaddle | 备注 | +| ------- | ------------ | --------------------------------------------------------------------------------------------- | +| dim | - | 返回指定维度的步长, Pytorch 为可选值,默认返回全部步长,此时无需转写,当有输入值时,需要转写。 | + +### 转写示例 + +```python +# torch 版本, 默认返回全部 +x.stride(dim=None) + +# Paddle 版本 +if dim is not None: + x.get_strides()[dim] +else: + x.get_strides() +``` diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.to_sparse_coo.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.to_sparse_coo.md new file mode 100644 index 00000000000..739d6833be8 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.to_sparse_coo.md @@ -0,0 +1,22 @@ +## [ paddle 参数更多 ]torch.Tensor.to_sparse_coo + +### [torch.Tensor.to_sparse_coo](https://pytorch.org/docs/stable/generated/torch.Tensor.to_sparse_coo.html) + +```python +torch.Tensor.to_sparse_coo() +``` + +### [paddle.Tensor.to_sparse_coo]() + +```python +paddle.Tensor.to_sparse_coo(sparse_dim) +``` + +其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下: + +### 参数映射 + + +| PyTorch | PaddlePaddle | 备注 | +| ------- | ------------ | --------------------------------------------------------------------------------------------- | +| - | sparse_dim | 在新的稀疏张量中包含的稀疏维度的数量,pytorch 中无此参数,paddle 令其为 tensor 输入维度即可。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.bitwise_left_shift.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.bitwise_left_shift.md new file mode 100644 index 00000000000..8e7926fa3f2 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.bitwise_left_shift.md @@ -0,0 +1,24 @@ +## [ paddle 参数更多 ]torch.bitwise_left_shift + +### [torch.bitwise_left_shift](https://pytorch.org/docs/stable/generated/torch.bitwise_left_shift.html) + +```python +torch.bitwise_left_shift(input, other, *, out=None) +``` + +### [paddle.bitwise_left_shift](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/bitwise_left_shift_cn.html#bitwise-left-shift) + +```python +paddle.bitwise_left_shift(x, y, is_arithmetic=True, out=None, name=None) +``` + +其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下: + +### 参数映射 + +| PyTorch | PaddlePaddle | 备注 | +| ------- | ------------- | ------------------------------------------------------------------- | +| input | x | 表示输入的 Tensor ,仅参数名不一致。 | +| other | y | 表示输入的 Tensor ,仅参数名不一致。 | +| out | out | 表示输出的 Tensor。 | +| - | is_arithmetic | 用于表明是否执行算术位移, PyTorch 无此参数, Paddle 保持默认即可。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.bitwise_right_shift.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.bitwise_right_shift.md new file mode 100644 index 00000000000..c301fc5a992 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.bitwise_right_shift.md @@ -0,0 +1,24 @@ +## [ paddle 参数更多 ]torch.bitwise_right_shift + +### [torch.bitwise_right_shift](https://pytorch.org/docs/stable/generated/torch.bitwise_right_shift.html) + +```python +torch.bitwise_right_shift(input, other, *, out=None) +``` + +### [paddle.bitwise_right_shift](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/bitwise_right_shift_cn.html#bitwise-right-shift) + +```python +paddle.bitwise_right_shift(x, y, is_arithmetic=True, out=None, name=None) +``` + +其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下: + +### 参数映射 + +| PyTorch | PaddlePaddle | 备注 | +| ------- | ------------- | ------------------------------------------------------------------- | +| input | x | 表示输入的 Tensor ,仅参数名不一致。 | +| other | y | 表示输入的 Tensor ,仅参数名不一致。 | +| out | out | 表示输出的 Tensor。 | +| - | is_arithmetic | 用于表明是否执行算术位移, PyTorch 无此参数, Paddle 保持默认即可。 |