From c599bdfdc3de2d211eb2c51d8e1b065d5db9da60 Mon Sep 17 00:00:00 2001
From: zpceng314 <95727760+zpceng314@users.noreply.github.com>
Date: Mon, 29 May 2023 20:50:59 +0800
Subject: [PATCH] add sinc etc. (#5894)
* model_convert add torch.is_nonzero .etc
* model_convert add is_nonzero .etc
* model_convert add is_nonzero .etc
* model_convert add is_nonzero .etc
* add xlogy.etc
* add randn_like .etc
* comment
* add vdot etc.
* add aminmax etc.
* fix parameter
* add bucketizr etc.
* add bucketizr etc.
* add bucketizr etc.
* add sinc etc.
* add sinc etc.
* add sinc etc.
---
.../Tensor/tensor.Torch.count_nonzero.md | 20 ------
.../Tensor/torch.Tensor.histc.md | 14 +++-
.../Tensor/torch.Tensor.hypot.md | 19 ++++++
.../Tensor/torch.Tensor.istft.md | 36 ++++++++++
.../Tensor/torch.Tensor.logdet.md | 15 ++--
.../Tensor/torch.Tensor.pinverse.md | 22 ++++++
.../Tensor/torch.Tensor.reshape_as.md | 19 ++++++
.../Tensor/torch.Tensor.select.md | 21 +++---
.../Tensor/torch.Tensor.sinc.md | 20 ++++++
.../linalg/torch.linalg.slogdet.md | 31 +++++++++
.../api_difference/nn/torch.nn.LayerNorm.md | 2 +-
.../nn/torch.nn.SyncBatchNorm.md | 68 +++++++++++++++++++
.../api_difference/ops/torch.hypot.md | 19 ++++++
.../api_difference/ops/torch.select.md | 19 ++++++
.../api_difference/ops/torch.sinc.md | 20 ++++++
.../api_difference/ops/torch.slogdet.md | 17 ++++-
.../others/torch.random.get_rng_state.md | 32 +++++++++
.../others/torch.random.seed.md | 19 ++++++
.../others/torch.random.set_rng_state.md | 33 +++++++++
.../others/torch.special.sinc.md | 20 ++++++
20 files changed, 423 insertions(+), 43 deletions(-)
delete mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/tensor.Torch.count_nonzero.md
create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hypot.md
create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.istft.md
create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.pinverse.md
create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.reshape_as.md
create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.sinc.md
create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.slogdet.md
create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.SyncBatchNorm.md
create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.hypot.md
create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.select.md
create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.sinc.md
create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.random.get_rng_state.md
create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.random.seed.md
create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.random.set_rng_state.md
create mode 100644 docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.sinc.md
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/tensor.Torch.count_nonzero.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/tensor.Torch.count_nonzero.md
deleted file mode 100644
index 81299abf1f1..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/tensor.Torch.count_nonzero.md
+++ /dev/null
@@ -1,20 +0,0 @@
-## [ 仅 Paddle 参数更多 ] torch.Tensor.count_nonzero
-
-### [torch.Tensor.count_nonzero](https://pytorch.org/docs/stable/generated/torch.Tensor.count_nonzero.html?highlight=count_non#torch.Tensor.count_nonzero)
-
-```python
-torch.Tensor.count_nonzero(dim=None)
-```
-
-### [paddle.Tensor.count_nonzero](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/Tensor_cn.html#count-nonzero-axis-none-keepdim-false-name-none)
-
-```python
-paddle.Tensor.count_nonzero(axis=None, keepdim=False, name=None)
-```
-
-两者功能一致,仅 paddle 参数更多,具体如下:
-### 参数映射
-| PyTorch | PaddlePaddle | 备注 |
-|---------|--------------| ----------------------------------------------------- |
-| dim | axis | 指定对 x 进行计算的轴,仅参数名不一致。 |
-| - | keepdim | 是否在输出 Tensor 中保留减小的维度,PyTorch 无此参数, Paddle 保持默认即可。 |
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 089aa6da17d..ebc2a2280c0 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)
@@ -12,7 +12,7 @@ torch.Tensor.histc(bins=100, min=0, max=0)
paddle.Tensor.histogram(bins=100, min=0, max=0, name=None)
```
-两者功能一致且参数完全一致。
+返回 Tensor 的数据类型不一致,Pytorch 返回数据类型与输入 Tensor 一致, Paddle 默认返回 int64 类型。
### 参数映射
@@ -21,3 +21,13 @@ paddle.Tensor.histogram(bins=100, min=0, max=0, name=None)
| bins | bins | 直方图 bins(直条)的个数,默认为 100。 |
| min | min | range 的下边界(包含),默认为 0。 |
| max | max | range 的上边界(包含),默认为 0。 |
+
+### 转写示例
+
+```python
+# Pytorch 写法
+y = a.histc(bins=3, min=2, max=4)
+
+# Paddle 写法
+y = a.histogram(bins=3, min=2, max=4).astype(a.dtype)
+```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hypot.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hypot.md
new file mode 100644
index 00000000000..9c9b9100b49
--- /dev/null
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.hypot.md
@@ -0,0 +1,19 @@
+## [ 组合替代实现 ]torch.Tensor.hypot
+
+### [torch.Tensor.hypot](https://pytorch.org/docs/stable/generated/torch.Tensor.hypot.html#torch.Tensor.hypot)
+
+```python
+torch.Tensor.hypot(other)
+```
+
+给定直角三角形的直角边,求斜边; Paddle 无此 API,需要组合实现。
+
+### 转写示例
+
+```python
+# Pytorch 写法
+y = a.hypot(b)
+
+# Paddle 写法
+y = (a**2 + b**2) ** (1/2)
+```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.istft.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.istft.md
new file mode 100644
index 00000000000..db79783c8e3
--- /dev/null
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.istft.md
@@ -0,0 +1,36 @@
+## [ 参数完全一致 ]torch.Tensor.istft
+### [torch.Tensor.istft](https://pytorch.org/docs/stable/generated/torch.Tensor.istft.html#torch.Tensor.istft)
+
+```python
+torch.Tensor.istft(n_fft, hop_length=None, win_length=None, window=None, center=True, normalized=False, onesided=None, length=None, return_complex=False)
+```
+
+### [paddle.signal.istft](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/signal/istft_cn.html#istft)
+
+```python
+paddle.signal.istft(x,
+ n_fft,
+ hop_length=None,
+ win_length=None,
+ window=None,
+ center=True,
+ normalized=False,
+ onesided=True,
+ length=None,
+ return_complex=False,
+ name=None)
+```
+
+两者功能一致且参数完全一致,具体如下:
+### 参数映射
+| PyTorch | PaddlePaddle | 备注 |
+| ------------- | ------------ | ------------------------------------------------------ |
+| n_fft | n_fft | 表示离散傅里叶变换的样本点个数。 |
+| hop_length | hop_length | 表示相邻两帧偏移的样本点个数。 |
+| win_length | win_length | 表示信号窗的长度。 |
+| window | window | 表示长度为 win_length 的 Tensor 。 |
+| center | center | 表示是否将输入信号进行补长。 |
+| normalized | normalized | 表示是否将傅里叶变换的结果乘以值为 1/sqrt(n) 的缩放系数。 |
+| onesided | onesided | 表示是否返回一个实信号。 |
+| length | length | 表示输出信号的长度。 |
+| return_complex | return_complex | 表示输出的重构信号是否为复信号。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.logdet.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.logdet.md
index b47bd078b14..76e4fffe653 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.logdet.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.logdet.md
@@ -1,15 +1,18 @@
-## [ 无参数 ] torch.Tensor.logdet
+## [ 组合替代实现 ]torch.Tensor.logdet
-### [torch.Tensor.logdet](https://pytorch.org/docs/stable/generated/torch.Tensor.logdet.html)
+### [torch.Tensor.logdet](https://pytorch.org/docs/stable/generated/torch.Tensor.logdet.html#torch.Tensor.logdet)
```python
torch.Tensor.logdet()
```
+Paddle 无此 API,需要组合实现。
-### [paddle.linalg.slogdet](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/slogdet_cn.html)
+### 转写示例
```python
-paddle.linalg.slogdet(x)
-```
+# Pytorch 写法
+y = input.logdet()
-两者功能一致,用于计算矩阵的对数行列式。
+# Paddle 写法
+y = paddle.log(paddle.linalg.det(input))
+```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.pinverse.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.pinverse.md
new file mode 100644
index 00000000000..b36c6d62283
--- /dev/null
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.pinverse.md
@@ -0,0 +1,22 @@
+## [ 仅 Paddle 参数更多 ]torch.Tensor.pinverse
+### [torch.Tensor.pinverse](https://pytorch.org/docs/stable/generated/torch.Tensor.pinverse.html#torch.Tensor.pinverse)
+
+```python
+torch.Tensor.pinverse()
+```
+
+### [paddle.linalg.pinv](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/pinv_cn.html#pinv)
+
+```python
+paddle.linalg.pinv(x,
+ rcond=1e-15,
+ hermitian=False,
+ name=None)
+```
+
+其中 Paddle 相比 Pytorch 支持更多参数,具体如下:
+### 参数映射
+| PyTorch | PaddlePaddle | 备注 |
+| ------------- | ------------ | ------------------------------------------------------ |
+| - | rcond | 奇异值(特征值)被截断的阈值,Pytorch 无此参数,Paddle 保持默认即可。 |
+| - | hermitian | 是否为 hermitian 矩阵或者实对称矩阵,Pytorch 无此参数,Paddle 保持默认即可。|
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.reshape_as.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.reshape_as.md
new file mode 100644
index 00000000000..938d05d1f11
--- /dev/null
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.reshape_as.md
@@ -0,0 +1,19 @@
+## [ 组合替代实现 ]torch.Tensor.reshape_as
+
+### [torch.Tensor.reshape_as](https://pytorch.org/docs/stable/generated/torch.Tensor.reshape_as.html#torch.Tensor.reshape_as)
+
+```python
+torch.Tensor.reshape_as(other)
+```
+
+Paddle 无此 API,需要组合实现。
+
+### 转写示例
+
+```python
+# Pytorch 写法
+y = a.reshape_as(b)
+
+# Paddle 写法
+y = paddle.reshape(a, b.shape)
+```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.select.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.select.md
index 5a65f9638df..3ddc0e40e34 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.select.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.select.md
@@ -1,4 +1,4 @@
-## [ 仅参数名不一致 ]torch.Tensor.select
+## [ 组合替代实现 ]torch.Tensor.select
### [torch.Tensor.select](https://pytorch.org/docs/stable/generated/torch.Tensor.select.html?highlight=select#torch.Tensor.select)
@@ -6,17 +6,14 @@
torch.Tensor.select(dim, index)
```
-### [paddle.index_select](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#index-select-index-axis-0-name-none)
+Paddle 无此 API,需要组合实现。
-```python
-paddle.Tensor.index_select(index, axis=0, name=None)
-```
-
-两者功能一致且参数用法一致,仅参数名不一致,具体如下:
+### 转写示例
-### 参数映射
+```python
+# Pytorch 写法
+y = a.select(dim=dim, index=index)
-| PyTorch | PaddlePaddle | 备注 |
-| ------------- | ------------ | ------------------------------------------------------ |
-| dim | axis | 指定进行运算的轴,仅参数名不同。 |
-| index | index | 包含索引下标的 1-D Tensor |
+# Paddle 写法
+y = paddle.index_select(a, index=paddle.to_tensor([index]), axis=dim).squeeze(dim)
+```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.sinc.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.sinc.md
new file mode 100644
index 00000000000..71374e9c11f
--- /dev/null
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.sinc.md
@@ -0,0 +1,20 @@
+## [ 组合替代实现 ]torch.Tensor.sinc
+
+### [torch.Tensor.sinc](https://pytorch.org/docs/stable/generated/torch.Tensor.sinc.html#torch.Tensor.sinc)
+
+```python
+torch.Tensor.sinc()
+```
+
+Paddle 无此 API,需要组合实现。
+
+### 转写示例
+
+```python
+# Pytorch 写法
+y = a.sinc()
+
+# Paddle 写法
+import numpy
+y = paddle.where(a==0, x=paddle.to_tensor([1], dtype=a.dtype), y=paddle.sin(numpy.pi*a)/(numpy.pi*a))
+```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.slogdet.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.slogdet.md
new file mode 100644
index 00000000000..58749fbb249
--- /dev/null
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.slogdet.md
@@ -0,0 +1,31 @@
+## [ 参数不一致 ]torch.linalg.slogdet
+### [torch.linalg.slogdet](https://pytorch.org/docs/stable/generated/torch.linalg.slogdet.html#torch.linalg.slogdet)
+
+```pythonpa
+torch.linalg.slogdet(A, *, out=None)
+```
+
+### [paddle.linalg.slogdet](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/slogdet_cn.html#slogdet)
+
+```python
+paddle.linalg.slogdet(x)
+```
+
+两者功能一致但参数类型不一致,Pytorch 返回 named tuple,Paddle 返回 Tensor,需要转写。具体如下:
+### 参数映射
+| PyTorch | PaddlePaddle | 备注 |
+| ------------- | ------------ | ------------------------------------------------------ |
+| A | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| out | - | 表示输出的 Tuple ,Paddle 无此参数,暂无转写方式。 |
+
+
+### 转写示例
+#### 返回类型不一致
+```python
+# Pytorch 写法
+y = torch.linalg.slogdet(a)
+
+# Paddle 写法
+result = paddle.linalg.slogdet(a)
+y = tuple([result[0], result[1]])
+```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.LayerNorm.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.LayerNorm.md
index a00320dbe2f..76d66423358 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.LayerNorm.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.LayerNorm.md
@@ -38,7 +38,7 @@ paddle.nn.LayerNorm(normalized_shape,
torch.nn.LayerNorm(normalized_shape=(256, 256), eps=1e-05, elementwise_affine=False)
# paddle 写法
-paddle.nn.GroupNorm(normalized_shape=(256, 256), epsilon=1e-05, weight_attr=paddle.ParamAttr(learning_rate=0.0), bias_attr=paddle.ParamAttr(learning_rate=0.0))
+paddle.nn.GroupNorm(normalized_shape=(256, 256), epsilon=1e-05, weight_attr=False, bias_attr=False)
# 当 PyTorch 的 elementwise_affine 为`True`,torch 写法
torch.nn.LayerNorm(normalized_shape=(256, 256), eps=1e-05, elementwise_affine=True)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.SyncBatchNorm.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.SyncBatchNorm.md
new file mode 100644
index 00000000000..86e2070ca66
--- /dev/null
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.SyncBatchNorm.md
@@ -0,0 +1,68 @@
+## [ 参数不一致 ]torch.nn.SyncBatchNorm
+### [torch.nn.SyncBatchNorm](https://pytorch.org/docs/stable/generated/torch.nn.SyncBatchNorm.html#torch.nn.SyncBatchNorm)
+
+```python
+torch.nn.SyncBatchNorm(num_features, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True, process_group=None, device=None, dtype=None)
+```
+
+### [paddle.nn.SyncBatchNorm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/SyncBatchNorm_cn.html#syncbatchnorm)
+
+```python
+paddle.nn.SyncBatchNorm(num_features, epsilon=1e-5, momentum=0.9, weight_attr=None, bias_attr=None, data_format='NCHW', name=None)
+```
+
+两者功能一致但参数不一致,部分参数名不同,具体如下:
+### 参数映射
+| PyTorch | PaddlePaddle | 备注 |
+| ------------- | ------------ | ------------------------------------------------------ |
+| num_features | num_features | 表示输入 Tensor 通道数。 |
+| eps | epsilon | 为了数值稳定加在分母上的值。 |
+| momentum | momentum | 表示归一化函数中的超参数, PyTorch 和 Paddle 公式实现细节不一致,两者正好是相反的,需要进行转写。 |
+| - | weight_attr | 指定权重参数属性的对象。如果为 False, 则表示每个通道的伸缩固定为 1,不可改变。默认值为 None,表示使用默认的权重参数属性。 |
+| - | bias_attr | 指定偏置参数属性的对象。如果为 False, 则表示每一个通道的偏移固定为 0,不可改变。默认值为 None,表示使用默认的偏置参数属性。 |
+| - | data_format | 指定输入数据格式, Pytorch 无此参数,Paddle 保持默认即可。 |
+| affine | - | 是否进行反射变换, PaddlePaddle 无此参数,需要进行转写。 |
+| track_running_stats | use_global_stats | 表示是否已加载的全局均值和方差。 |
+| process_group | - | 统计信息的同步分别在每个进程组内发生, PaddlePaddle 无此参数,暂无转写方式。 |
+| device | - | 设备类型,PaddlePaddle 无此参数。可直接删除。 |
+| dtype | - | 参数类型,PaddlePaddle 无此参数。需要转写 |
+
+### 转写示例
+#### affine:是否进行反射变换
+```python
+affine=False 时,表示不更新:
+
+# PyTorch 写法
+m = torch.nn.SyncBatchNorm(24, affine=False)
+
+# Paddle 写法
+m = paddle.nn.SyncBatchNorm(24, weight_attr=False, bias_attr=False)
+
+affine=True 时,表示更新:
+
+# PyTorch 写法
+m = torch.nn.SyncBatchNorm(24)
+
+# Paddle 写法
+m = paddle.nn.SyncBatchNorm(24)
+```
+
+#### momentum:
+```python
+# PyTorch 写法
+m = torch.nn.SyncBatchNorm(24, momentum=0.2)
+
+# Paddle 写法
+m = paddle.nn.SyncBatchNorm(24, momentum=0.8)
+```
+
+#### dtype:
+```python
+# PyTorch 写法
+m = torch.nn.SyncBatchNorm(24, momentum=0.2, dtype=torch.float32)
+y = m(x)
+
+# Paddle 写法
+m = paddle.nn.SyncBatchNorm(24, momentum=0.8)
+y = m(x).astype(paddle.float32)
+```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.hypot.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.hypot.md
new file mode 100644
index 00000000000..b53d91b0103
--- /dev/null
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.hypot.md
@@ -0,0 +1,19 @@
+## [ 组合替代实现 ]torch.hypot
+
+### [torch.hypot](https://pytorch.org/docs/stable/generated/torch.hypot.html#torch.hypot)
+
+```python
+torch.hypot(input, other, *, out=None)
+```
+
+给定直角三角形的直角边,求斜边; Paddle 无此 API,需要组合实现。
+
+### 转写示例
+
+```python
+# Pytorch 写法
+y = torch.hypot(a, b)
+
+# Paddle 写法
+y = (a**2 + b**2) ** (1/2)
+```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.select.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.select.md
new file mode 100644
index 00000000000..b9c9ae45095
--- /dev/null
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.select.md
@@ -0,0 +1,19 @@
+## [ 组合替代实现 ]torch.select
+
+### [torch.select](https://pytorch.org/docs/stable/generated/torch.select.html#torch.select)
+
+```python
+torch.select(input, dim, index)
+```
+
+Paddle 无此 API,需要组合实现。
+
+### 转写示例
+
+```python
+# Pytorch 写法
+y = torch.select(a, dim=dim, index=index)
+
+# Paddle 写法
+y = paddle.index_select(a, index=paddle.to_tensor([index]), axis=dim).squeeze(dim)
+```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.sinc.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.sinc.md
new file mode 100644
index 00000000000..c73cb43db1d
--- /dev/null
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.sinc.md
@@ -0,0 +1,20 @@
+## [ 组合替代实现 ]torch.sinc
+
+### [torch.sinc](https://pytorch.org/docs/stable/generated/torch.sinc.html#torch.sinc)
+
+```python
+torch.sinc(input, *, out=None)
+```
+
+Paddle 无此 API,需要组合实现。
+
+### 转写示例
+
+```python
+# Pytorch 写法
+y = torch.sinc(a)
+
+# Paddle 写法
+import numpy
+y = paddle.where(a==0, x=paddle.to_tensor([1], dtype=a.dtype), y=paddle.sin(numpy.pi*a)/(numpy.pi*a))
+```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.slogdet.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.slogdet.md
index 44192dc6114..549a00829be 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.slogdet.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.slogdet.md
@@ -2,7 +2,7 @@
### [torch.slogdet](https://pytorch.org/docs/stable/generated/torch.slogdet.html?highlight=slogdet#torch.slogdet)
```python
-torch.slogdet(input)
+torch.slogdet(input *, out=None)
```
### [paddle.linalg.slogdet](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/slogdet_cn.html#slogdet)
@@ -11,8 +11,21 @@ torch.slogdet(input)
paddle.linalg.slogdet(x)
```
-两者功能一致且参数用法一致,仅参数名不同,具体如下:
+两者功能一致但参数类型不一致,Pytorch 返回 named tuple,Paddle 返回 Tensor,需要转写。具体如下:
### 参数映射
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| out | - | 表示输出的 Tuple ,Paddle 无此参数,暂无转写方式。 |
+
+
+### 转写示例
+#### 返回类型不一致
+```python
+# Pytorch 写法
+y = torch.slogdet(a)
+
+# Paddle 写法
+result = paddle.linalg.slogdet(a)
+y = tuple([result[0], result[1]])
+```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.random.get_rng_state.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.random.get_rng_state.md
new file mode 100644
index 00000000000..db73ecebbe0
--- /dev/null
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.random.get_rng_state.md
@@ -0,0 +1,32 @@
+## [参数不一致] torch.random.get_rng_state
+
+### [torch.random.get_rng_state](https://pytorch.org/docs/stable/random.html#torch.random.get_rng_state)
+
+```python
+torch.random.get_rng_state()
+```
+
+### [paddle.get_cuda_rng_state](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/get_cuda_rng_state_cn.html#get-cuda-rng-state)
+
+```python
+paddle.get_cuda_rng_state()
+```
+
+其中 Pytorch 与 Paddle 的返回参数类型不一致
+
+### 参数映射
+| PyTorch | PaddlePaddle | 备注 |
+| ------------- | ------------ | ------------------------------------------------------ |
+| Tensor | GeneratorState | 返回类型不一致, Pytorch 返回 torch.ByteTensor,Paddle 返回 GeneratorState 对象。需要转写。 |
+
+
+
+### 转写示例
+#### 返回参数类型不同
+```python
+# Pytorch 写法
+x = torch.random.get_rng_state()
+
+# Paddle 写法
+x = paddle.get_cuda_rng_state()
+```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.random.seed.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.random.seed.md
new file mode 100644
index 00000000000..af91946d92f
--- /dev/null
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.random.seed.md
@@ -0,0 +1,19 @@
+## [ 组合替代实现 ]torch.random.seed
+
+### [torch.random.seed](https://pytorch.org/docs/stable/random.html#torch.random.seed)
+```python
+torch.random.seed()
+```
+
+将生成随机数的种子设置为非确定性随机数。返回一个用于播种 RNG 的 64 位数字。
+
+PaddlePaddle 目前无对应 API,可使用如下代码组合实现该 API。
+
+### 转写示例
+```python
+# Pytorch 写法
+torch.random.seed()
+
+# Paddle 写法
+paddle.get_cuda_rng_state()[0].current_seed()
+```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.random.set_rng_state.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.random.set_rng_state.md
new file mode 100644
index 00000000000..5e057dd7df7
--- /dev/null
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.random.set_rng_state.md
@@ -0,0 +1,33 @@
+## [参数不一致] torch.random.set_rng_state
+
+### [torch.random.set_rng_state](https://pytorch.org/docs/stable/random.html#torch.random.set_rng_state)
+
+```python
+torch.random.set_rng_state(new_state)
+```
+
+### [paddle.set_cuda_rng_state](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/set_cuda_rng_state_cn.html#set-cuda-rng-state)
+
+```python
+paddle.set_cuda_rng_state(state_list)
+```
+
+其中 Pytorch 与 Paddle 的输入参数类型不一致
+
+### 参数映射
+| PyTorch | PaddlePaddle | 备注 |
+| ------------- | ------------ | ------------------------------------------------------ |
+| new_state | state_list | 表示需要设置的新状态,Pytorch 输入类型为 torch.ByteTensor, Paddle 为 list[GeneratorState], 需要转写。 |
+
+
+
+### 转写示例
+
+#### new_state: 指定输入
+```python
+# Pytorch 写法
+torch.random.set_rng_state(x)
+
+# Paddle 写法
+paddle.set_cuda_rng_state(x)
+```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.sinc.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.sinc.md
new file mode 100644
index 00000000000..7e466ba71fc
--- /dev/null
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.sinc.md
@@ -0,0 +1,20 @@
+## [ 组合替代实现 ]torch.special.sinc
+
+### [torch.special.sinc](https://pytorch.org/docs/stable/special.html#torch.special.sinc)
+
+```python
+torch.special.sinc(input, *, out=None)
+```
+
+Paddle 无此 API,需要组合实现。
+
+### 转写示例
+
+```python
+# Pytorch 写法
+y = torch.special.sinc(a)
+
+# Paddle 写法
+import numpy
+y = paddle.where(a==0, x=paddle.to_tensor([1], dtype=a.dtype), y=paddle.sin(numpy.pi*a)/(numpy.pi*a))
+```