diff --git a/ci_scripts/hooks/pre-doc-compile.sh b/ci_scripts/hooks/pre-doc-compile.sh
index 75cdb05af69..fc4e6ba521d 100755
--- a/ci_scripts/hooks/pre-doc-compile.sh
+++ b/ci_scripts/hooks/pre-doc-compile.sh
@@ -120,3 +120,27 @@ else
echo "ERROR: Generated API mapping file not found at $GENERATED_FILE"
handle_failure
fi
+
+python "${APIMAPPING_ROOT}/tools/validate_api_difference_format.py"
+
+# 获取上一条命令的退出状态码
+exit_code=$?
+
+# 根据退出状态码决定后续操作
+if [ $exit_code -eq 0 ]; then
+ echo "API DIFFERENCE FORMAT VALIDATE SUCCESS!"
+ # 在这里继续添加您需要执行的命令
+else
+ echo "ERROR: API DIFFERENCE FORMAT VALIDATE FAILURE! error code: $exit_code" >&2
+ exit 1
+fi
+
+python "${APIMAPPING_ROOT}/tools/validate_pytorch_api_mapping.py" --skip-url-check
+exit_code=$?
+
+if [ $exit_code -eq 0 ]; then
+ echo "PYTORCH API MAPPING VALIDATE SUCCESS!"
+else
+ echo "ERROR: PYTORCH API MAPPING VALIDATE FAILURE! error code: $exit_code" >&2
+ exit 1
+fi
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_default_value_diff/torch.linalg.diagonal.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_default_value_diff/torch.linalg.diagonal.md
index 1dadcd1084a..db75a1c35ec 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_default_value_diff/torch.linalg.diagonal.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_default_value_diff/torch.linalg.diagonal.md
@@ -19,7 +19,7 @@ paddle.diagonal(x,
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| A | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| A | x | 表示输入的 Tensor ,仅参数名不一致。 |
| offset | offset | 表示对角线偏移量。 |
-| dim1 | axis1 | 获取对角线的二维平面的第一维,参数默认值不一致。PyTorch 默认为`-2`,Paddle 默认为`0`,Paddle 需设置为与 PyTorch 一致。 |
-| dim2 | axis2 | 获取对角线的二维平面的第二维,参数默认值不一致。PyTorch 默认为`-1`,Paddle 默认为`1`,Paddle 需设置为与 PyTorch 一致。 |
+| dim1 | axis1 | 获取对角线的二维平面的第一维,参数默认值不一致。PyTorch 默认为`-2`,Paddle 默认为`0`,Paddle 需设置为与 PyTorch 一致。 |
+| dim2 | axis2 | 获取对角线的二维平面的第二维,参数默认值不一致。PyTorch 默认为`-1`,Paddle 默认为`1`,Paddle 需设置为与 PyTorch 一致。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.gcd.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.gcd.md
index f017c8de5a4..49e5f0a2bf9 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.gcd.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.gcd.md
@@ -14,4 +14,4 @@ paddle.Tensor.gcd(y, name=None)
| PyTorch | PaddlePaddle | 备注 |
|----------------------------------|------------------------------| ------------------------------------------------------ |
-| other | y | 输入的 Tensor ,仅参数名不一致。 |
+| other | y | 输入的 Tensor ,仅参数名不一致。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.gcd_.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.gcd_.md
index 910c38344cf..0714a3d8e0f 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.gcd_.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.gcd_.md
@@ -14,4 +14,4 @@ paddle.Tensor.gcd_(y)
| PyTorch | PaddlePaddle | 备注 |
|----------------------------------|------------------------------| ------------------------------------------------------ |
-| other | y | 输入的 Tensor ,仅参数名不一致。 |
+| other | y | 输入的 Tensor ,仅参数名不一致。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.ger.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.ger.md
index 0e334276ee5..61cb4a622d9 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.ger.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.ger.md
@@ -14,4 +14,4 @@ paddle.Tensor.outer(y, name=None)
| PyTorch | PaddlePaddle | 备注 |
|--------------------------------|------------------------------| ------------------------------------------------------ |
-| vec2 | y | 输入的 Tensor ,仅参数名不一致。 |
+| vec2 | y | 输入的 Tensor ,仅参数名不一致。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.hardshrink.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.hardshrink.md
index 1ade21729ae..0fb7c1d452d 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.hardshrink.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.hardshrink.md
@@ -15,4 +15,4 @@ paddle.nn.functional.hardshrink(x, threshold=0.5, name=None)
| PyTorch | PaddlePaddle | 备注 |
|-----------------------------------|------------------------------| ------------------------------------------------------ |
-| lambd | threshold | Hardshrink 阈值,仅参数名不一致。 |
+| lambd | threshold | Hardshrink 阈值,仅参数名不一致。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.heaviside.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.heaviside.md
index 3deb6eddc04..2aad2be0b5f 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.heaviside.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.heaviside.md
@@ -14,4 +14,4 @@ paddle.Tensor.heaviside(y, name=None)
| PyTorch | PaddlePaddle | 备注 |
|-----------------------------------|------------------------------| ------------------------------------------------------ |
-| values | y | 输入的 Tensor ,仅参数名不一致。 |
+| values | y | 输入的 Tensor ,仅参数名不一致。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.igamma.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.igamma.md
index b9f226e3882..b5dc891cbc8 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.igamma.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.igamma.md
@@ -15,4 +15,4 @@ paddle.Tensor.gammainc(y, name=None)
| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | --------------------------- |
-| other | y | 正参数 Tensor,仅参数名不同 |
+| other | y | 正参数 Tensor,仅参数名不同。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.igamma_.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.igamma_.md
index b9708a9a44e..58f4fd2a782 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.igamma_.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.igamma_.md
@@ -15,4 +15,4 @@ paddle.Tensor.gammainc_(y, name=None)
| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | --------------------------- |
-| other | y | 正参数 Tensor,仅参数名不同 |
+| other | y | 正参数 Tensor,仅参数名不同。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.igammac.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.igammac.md
index bb5fb2f3756..5a87a3469e6 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.igammac.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.igammac.md
@@ -15,4 +15,4 @@ paddle.Tensor.gammaincc(y, name=None)
| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | --------------------------- |
-| other | y | 正参数 Tensor,仅参数名不同 |
+| other | y | 正参数 Tensor,仅参数名不同。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.igammac_.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.igammac_.md
index 85a780c85e3..3a4366985f4 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.igammac_.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.igammac_.md
@@ -15,4 +15,4 @@ paddle.Tensor.gammaincc_(y, name=None)
| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | --------------------------- |
-| other | y | 正参数 Tensor,仅参数名不同 |
+| other | y | 正参数 Tensor,仅参数名不同。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.index_fill.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.index_fill.md
index 8413d60d2ee..681e00ab806 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.index_fill.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.index_fill.md
@@ -15,6 +15,6 @@ paddle.Tensor.index_fill(index, axis, value, name=None)
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| dim | axis | 表示进行运算的轴,仅参数名不一致。 |
-| index | index | 包含索引下标的 1-D Tensor。 |
-| value | value | 填充的值。 |
+| dim | axis | 表示进行运算的轴,仅参数名不一致。 |
+| index | index | 包含索引下标的 1-D Tensor。 |
+| value | value | 填充的值。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.index_fill_.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.index_fill_.md
index 85e57e9d30b..4fa6472a370 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.index_fill_.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.index_fill_.md
@@ -15,6 +15,6 @@ paddle.Tensor.index_fill_(index, axis, value, name=None)
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| dim | axis | 表示进行运算的轴,仅参数名不一致。 |
-| index | index | 包含索引下标的 1-D Tensor。 |
-| value | value | 填充的值。 |
+| dim | axis | 表示进行运算的轴,仅参数名不一致。 |
+| index | index | 包含索引下标的 1-D Tensor。 |
+| value | value | 填充的值。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.index_put_.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.index_put_.md
index 22479789b44..ef0597f6ba2 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.index_put_.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.index_put_.md
@@ -15,6 +15,6 @@ paddle.Tensor.index_put_(indices, value, accumulate=False)
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| indices | indices | 包含用来索引的 tensors 的元组。数据类型为 int32,int64,bool。 |
-| values | value | 用来给 x 赋值的 Tensor,仅参数名不一致。 |
-| accumulate | accumulate | 指定是否将 value 加到 x 的参数。 默认值为 False。 |
+| indices | indices | 包含用来索引的 tensors 的元组。数据类型为 int32,int64,bool。 |
+| values | value | 用来给 x 赋值的 Tensor,仅参数名不一致。 |
+| accumulate | accumulate | 指定是否将 value 加到 x 的参数。 默认值为 False。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.orgqr.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.orgqr.md
index 65f4939bcde..295f92dafc8 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.orgqr.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.orgqr.md
@@ -15,4 +15,4 @@ paddle.Tensor.householder_product(tau, name=None)
| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | ------------------------------ |
-| input2 | tau | 用于计算矩阵乘积,仅参数名不同 |
+| input2 | tau | 用于计算矩阵乘积,仅参数名不同。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.ormqr.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.ormqr.md
index 4f95e7df0f9..7abb74a61c9 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.ormqr.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.ormqr.md
@@ -15,7 +15,7 @@ paddle.linalg.ormqr(x, tau, y, left=True, transpose=False)
| PyTorch | PaddlePaddle | 备注 |
| --------- | ------------ | ---------------------------------- |
-| input2 | tau | Householder 反射系数,仅参数名不同 |
-| input3 | y | 用于矩阵乘积,仅参数名不同 |
-| left | left | 决定了矩阵乘积运算的顺序 |
-| transpose | transpose | 决定矩阵 Q 是否共轭转置变换 |
+| input2 | tau | Householder 反射系数,仅参数名不同。 |
+| input3 | y | 用于矩阵乘积,仅参数名不同。 |
+| left | left | 决定了矩阵乘积运算的顺序。 |
+| transpose | transpose | 决定矩阵 Q 是否共轭转置变换。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.roll.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.roll.md
deleted file mode 100644
index 3147c16af3a..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.Tensor.roll.md
+++ /dev/null
@@ -1,18 +0,0 @@
-## [ 仅参数名不一致 ]torch.Tensor.roll
-### [torch.Tensor.roll](https://pytorch.org/docs/stable/generated/torch.Tensor.roll.html?highlight=torch+tensor+roll#torch.Tensor.roll)
-```python
-torch.Tensor.roll(shifts, dims)
-```
-
-### [paddle.Tensor.roll](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/roll_cn.html#roll)
-```python
-paddle.Tensor.roll(shifts, axis=None)
-```
-
-两者功能一致且参数用法一致,仅参数名不一致,具体如下:
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------------- | ------------ | ------------------------------------------------------ |
-| shifts | shifts | 表示偏移量。 |
-| dims | axis | 表示滚动的轴,仅参数名不一致。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.cdist.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.cdist.md
index 8243e93540d..0cde1c2fe01 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.cdist.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.cdist.md
@@ -16,5 +16,5 @@ paddle.cdist(x, y, p=2.0, compute_mode='use_mm_for_euclid_dist_if_necessary', na
| ------------- | ------------ | ------------------------------------------------------ |
| x1 | x | 表示第一个输入的 Tensor ,仅参数名不一致。 |
| x2 | y | 表示第二个输入的 Tensor ,仅参数名不一致。 |
-| p | p | 计算每个向量对之间的 p 范数距离的值。默认值为 2.0 |
+| p | p | 计算每个向量对之间的 p 范数距离的值。默认值为 2.0。 |
| compute_mode | compute_mode |表示计算模式。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.cholesky_solve.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.cholesky_solve.md
index 482c71f923b..8de75d9c570 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.cholesky_solve.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.cholesky_solve.md
@@ -15,6 +15,6 @@ paddle.linalg.cholesky_solve(x, y, upper=False, name=None)
| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | ---------------------------------------------------------------------------------- |
-| input | x | 表示线性方程中的 B 矩阵。仅参数名不一致 |
-| input2 | y | 表示线性方程中 A 矩阵的 Cholesky 分解矩阵 u。仅参数名不一致 |
+| input | x | 表示线性方程中的 B 矩阵。仅参数名不一致。 |
+| input2 | y | 表示线性方程中 A 矩阵的 Cholesky 分解矩阵 u。仅参数名不一致。 |
| upper | upper | 表示输入 x 是否是上三角矩阵,True 为上三角矩阵,False 为下三角矩阵。|
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.corrcoef.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.corrcoef.md
index 42f04946c1d..ed7b08f31ae 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.corrcoef.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.corrcoef.md
@@ -16,5 +16,5 @@ paddle.linalg.corrcoef(x,
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 一个 N(N<=2) 维矩阵,包含多个变量。默认矩阵的每行是一个观测变量,由参数 rowvar 设置。 |
-| - | rowvar | 以行或列作为一个观测变量, PyTorch 无此参数, Paddle 保持默认即可。 |
+| input | x | 一个 N(N<=2) 维矩阵,包含多个变量。默认矩阵的每行是一个观测变量,由参数 rowvar 设置。 |
+| - | rowvar | 以行或列作为一个观测变量, PyTorch 无此参数, Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.cuda.nvtx.range_push.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.cuda.nvtx.range_push.md
deleted file mode 100644
index cd1bef02350..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.cuda.nvtx.range_push.md
+++ /dev/null
@@ -1,18 +0,0 @@
-## [ 仅参数名不一致 ]torch.cuda.nvtx.range_push
-### [torch.cuda.nvtx.range_push](https://pytorch.org/docs/stable/generated/torch.cuda.nvtx.range_push.html?highlight=range_push#torch.cuda.nvtx.range_push)
-```python
-torch.cuda.nvtx.range_push(msg)
-```
-
-### [paddle.framework.core.nvprof_nvtx_push](https://github.com/PaddlePaddle/Paddle/blob/645dfb4040a15712cea9ccfed4dcb0655aeeb0ea/paddle/fluid/pybind/pybind.cc#L2465)
-```python
-paddle.framework.core.nvprof_nvtx_push(arg0)
-```
-
-两者功能一致且参数用法一致,仅参数名不一致,具体如下:
-
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------- | ------------ | ------------------------------------------ |
-| msg | arg0 | 关联 range 的 ASCII 消息,仅参数名不一致。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.det.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.det.md
index 16a01b8907d..e845bc8b7ab 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.det.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.det.md
@@ -14,4 +14,4 @@ paddle.linalg.det(x)
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.diagflat.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.diagflat.md
index 5ed9aea5de1..6c3f658b610 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.diagflat.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.diagflat.md
@@ -17,5 +17,5 @@ paddle.diagflat(x,
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
| offset | offset | 表示对角线偏移量。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.diagonal.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.diagonal.md
index ca75b58049c..2d34c8345cc 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.diagonal.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.diagonal.md
@@ -21,7 +21,7 @@ paddle.diagonal(x,
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
| offset | offset | 表示对角线偏移量。 |
-| dim1 | axis1 | 获取对角线的二维平面的第一维,仅参数名不一致。 |
-| dim2 | axis2 | 获取对角线的二维平面的第二维,仅参数名不一致。 |
+| dim1 | axis1 | 获取对角线的二维平面的第一维,仅参数名不一致。 |
+| dim2 | axis2 | 获取对角线的二维平面的第二维,仅参数名不一致。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.diagonal_scatter.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.diagonal_scatter.md
index a08f7f3562d..b26bdd8ada8 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.diagonal_scatter.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.diagonal_scatter.md
@@ -23,8 +23,8 @@ paddle.diagonal_scatter(x,
| PyTorch | PaddlePaddle | 备注 |
|---------|--------------| -------------------------------------------------- |
-| input | x | 输入张量,被嵌入的张量,仅参数名不一致。 |
-| src | y | 用于嵌入的张量,仅参数名不一致。 |
-| offset | offset | 从指定的二维平面嵌入对角线的位置,默认值为 0,即主对角线。 |
-| dim1 | axis1 | 对角线的第一个维度,默认值为 0,仅参数名不一致。 |
-| dim2 | axis2 | 对角线的第二个维度,默认值为 1,仅参数名不一致。 |
+| input | x | 输入张量,被嵌入的张量,仅参数名不一致。 |
+| src | y | 用于嵌入的张量,仅参数名不一致。 |
+| offset | offset | 从指定的二维平面嵌入对角线的位置,默认值为 0,即主对角线。 |
+| dim1 | axis1 | 对角线的第一个维度,默认值为 0,仅参数名不一致。 |
+| dim2 | axis2 | 对角线的第二个维度,默认值为 1,仅参数名不一致。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.dist.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.dist.md
index c9235a89230..3888e5dc70c 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.dist.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.dist.md
@@ -18,6 +18,6 @@ paddle.dist(x,
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| other | y | 表示输入的 Tensor ,仅参数名不一致。 |
-| p | p | 表示需要计算的范数 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| other | y | 表示输入的 Tensor ,仅参数名不一致。 |
+| p | p | 表示需要计算的范数。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.flip.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.flip.md
index 564eb5e7b21..9563bdee0dd 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.flip.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.flip.md
@@ -17,5 +17,5 @@ paddle.flip(x,
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| dims | axis | 表示进行运算的轴,仅参数名不一致。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| dims | axis | 表示进行运算的轴,仅参数名不一致。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.isclose.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.isclose.md
index 8f5f653f06d..e20bbde7cb4 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.isclose.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.isclose.md
@@ -23,8 +23,8 @@ paddle.isclose(x,
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| other | y | 表示输入的 Tensor ,仅参数名不一致。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| other | y | 表示输入的 Tensor ,仅参数名不一致。 |
| rtol | rtol | 表示相对容忍误差。 |
| atol | atol | 表示绝对容忍误差。 |
| equal_nan | equal_nan | 表示是否将两个 NaN 数值视为相等。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.masked_fill.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.masked_fill.md
index f569abd1c6d..bf4f311071c 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.masked_fill.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.masked_fill.md
@@ -16,5 +16,5 @@ paddle.masked_fill(x, mask, value, name=None)
| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | ------------------------------- |
| input | x | 输入的 Tensor,仅参数名不一致。 |
-| mask | mask | 布尔张量,表示要填充的位置 |
-| value | value | 用于填充目标张量的值 |
+| mask | mask | 布尔张量,表示要填充的位置。 |
+| value | value | 用于填充目标张量的值。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.moveaxis.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.moveaxis.md
index 6b9c1f88283..d73052ffc29 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.moveaxis.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.moveaxis.md
@@ -19,6 +19,6 @@ paddle.moveaxis(x,
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| source | source | 表示将被移动的轴的位置,仅参数名不一致。 |
-| destination | destination | 表示轴被移动后的目标位置,仅参数名不一致。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| source | source | 表示将被移动的轴的位置,仅参数名不一致。 |
+| destination | destination | 表示轴被移动后的目标位置,仅参数名不一致。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.movedim.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.movedim.md
index b0535462a0f..d6562e341ba 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.movedim.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.movedim.md
@@ -19,6 +19,6 @@ paddle.moveaxis(x,
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| source | source | 表示将被移动的轴的位置,仅参数名不一致。 |
-| destination | destination | 表示轴被移动后的目标位置,仅参数名不一致。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| source | source | 表示将被移动的轴的位置,仅参数名不一致。 |
+| destination | destination | 表示轴被移动后的目标位置,仅参数名不一致。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.nn.Module.named_buffers.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.nn.Module.named_buffers.md
index fcf3176f1b1..a112c895abd 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.nn.Module.named_buffers.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.nn.Module.named_buffers.md
@@ -17,4 +17,4 @@ paddle.nn.Layer.named_buffers(prefix='', include_sublayers=True, remove_duplicat
| -------------- | ------------ | ------------------------------------------------------------- |
| prefix | prefix | 在所有参数名称前加的前缀。 |
| recurse | include_sublayers | 生成该模块和所有子模块的缓冲区,仅参数名不一致。 |
-| remove_duplicate | remove_duplicate | 是否删除结果中重复的模块实例 |
+| remove_duplicate | remove_duplicate | 是否删除结果中重复的模块实例。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.nn.functional.affine_grid.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.nn.functional.affine_grid.md
index 7e1ead5cb7f..941f97dd641 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.nn.functional.affine_grid.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.nn.functional.affine_grid.md
@@ -19,6 +19,6 @@ paddle.nn.functional.affine_grid(theta,
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| theta | theta | 指定仿射变换矩阵 |
+| theta | theta | 指定仿射变换矩阵。 |
| size | out_shape | 表示指定目标输出图像大小,仅参数名不一致。 |
-| align_corners | align_corners | 指定是否是像素中心对齐 |
+| align_corners | align_corners | 指定是否是像素中心对齐。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.sparse.addmm.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.sparse.addmm.md
index cb3aef83f4d..ce36af87813 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.sparse.addmm.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.sparse.addmm.md
@@ -19,5 +19,5 @@ paddle.sparse.addmm(input, x, y, beta=1.0, alpha=1.0, name=None)
|input | input| 输入 Tensor。|
|mat1 | x |输入 Tensor,仅参数名不一致。|
|mat2|y| 输入 Tensor,仅参数名不一致。|
-|beta|beta| input 的系数,默认 1.0。两者完全一致|
-|alpha|alpha| x * y 的系数,默认 1.0。两者完全一致|
+|beta|beta| input 的系数,默认 1.0。两者完全一致。|
+|alpha|alpha| x * y 的系数,默认 1.0。两者完全一致。|
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.squeeze.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.squeeze.md
deleted file mode 100644
index 9c3f568676f..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/args_name_diff/torch.squeeze.md
+++ /dev/null
@@ -1,21 +0,0 @@
-## [ 仅参数名不一致 ]torch.squeeze
-### [torch.squeeze](https://pytorch.org/docs/stable/generated/torch.squeeze.html?highlight=squeeze#torch.squeeze)
-```python
-torch.squeeze(input,
- dim=None)
-```
-
-### [paddle.squeeze](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/squeeze_cn.html#squeeze)
-```python
-paddle.squeeze(x,
- axis=None,
- name=None)
-```
-
-两者功能一致且参数用法一致,仅参数名不一致,具体如下:
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| dim | axis | 表示要压缩的轴,仅参数名不一致。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.float_power.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.float_power.md
index 9aa44ac92a8..248ab84be1d 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.float_power.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.float_power.md
@@ -10,16 +10,9 @@ Paddle 无此 API,需要组合实现。
```python
# PyTorch 写法
torch.float_power(x, y)
-
-# Paddle 写法
-paddle.pow(x.cast(paddle.float64), y)
-```
-
-#### out:指定输出
-```python
-# PyTorch 写法
torch.float_power(x, y, out=out)
# Paddle 写法
+paddle.pow(x.cast(paddle.float64), y)
paddle.assign(paddle.pow(x.cast(paddle.float64), y), out)
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.narrow_copy.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.narrow_copy.md
index 714764ad547..4340a157340 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.narrow_copy.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.narrow_copy.md
@@ -7,7 +7,7 @@ torch.narrow_copy(input, dim, start, length, *, out=None)
Paddle 目前无此 API,需要组合替代实现
### 转写示例
-``` python
+```python
# PyTorch 写法:
torch.narrow_copy(x, 0, 1, 2)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.optim.lr_scheduler.ConstantLR.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.optim.lr_scheduler.ConstantLR.md
index 3c4292526d8..8eff7cae29f 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.optim.lr_scheduler.ConstantLR.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.optim.lr_scheduler.ConstantLR.md
@@ -23,8 +23,8 @@ paddle.optimizer.lr.PiecewiseDecay(boundaries,
| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | ------------------------------------------------------------------------------------------ |
| optimizer | - | torch.optim.Optimizer 类,Paddle 无此参数。 |
-| factor | values | PyTorch 表示乘以学习率的因子,Paddle 表示学习率列表。需要转写,转写思路为:values=[factor*optimizer.lr, optimizer.lr]。 |
-| total_iters | boundaries | PyTorch 表示衰减学习率的步数,Paddle 表示指定学习率的边界值列表。需要转写,转写思路为:boundaries = [total_iters]。 |
+| factor | values | PyTorch 表示乘以学习率的因子,Paddle 表示学习率列表。转写思路为:values=[factor*optimizer.lr, optimizer.lr]。 |
+| total_iters | boundaries | PyTorch 表示衰减学习率的步数,Paddle 表示指定学习率的边界值列表,转写思路为:boundaries = [total_iters]。 |
| last_epoch | last_epoch | 上一轮的轮数,重启训练时设置为上一轮的 epoch 数。参数完全一致。 |
| verbose | verbose | 如果是 True,则在每一轮更新时在标准输出 stdout 输出一条信息。参数完全一致。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.optim.lr_scheduler.OneCycleLR.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.optim.lr_scheduler.OneCycleLR.md
index b3e2c4abfbe..1ba937cb45f 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.optim.lr_scheduler.OneCycleLR.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.optim.lr_scheduler.OneCycleLR.md
@@ -53,6 +53,7 @@ paddle.optimizer.lr.OneCycleLR(max_learning_rate,
| verbose | verbose | 如果是 True,则在每一轮更新时在标准输出 stdout 输出一条信息。参数完全一致。 |
### 转写示例
+#### total_steps, epochs, steps_per_epoch 参数转写
```python
# PyTorch 写法
linear = torch.nn.Linear(10, 10)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.std_mean.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.std_mean.md
index 8754ef4059c..29a497f60bc 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.std_mean.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.std_mean.md
@@ -6,9 +6,9 @@ torch.std_mean(input, unbiased=True)
# 用法二:
torch.std_mean(input, dim, unbiased=True, keepdim=False)
```
+用于实现返回 Tensor 的标准差和均值,PaddlePaddle 目前暂无对应 API,可使用如下代码组合实现该 API。
-### 功能介绍用于实现返回 Tensor 的标准差和均值,PaddlePaddle 目前暂无对应 API,可使用如下代码组合实现该 API。
-
+### 转写示例
```python
# PyTorch 写法
std, mean = torch.std_mean(x, dim=1)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.var_mean.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.var_mean.md
index f23595e41b7..c69e2759ef8 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.var_mean.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/torch.var_mean.md
@@ -10,9 +10,9 @@ torch.var_mean(input,
keepdim=False,
unbiased=True)
```
+用于实现返回 Tensor 的方差和均值,PaddlePaddle 目前暂无对应 API,可使用如下代码组合实现该 API。
-### 功能介绍用于实现返回 Tensor 的方差和均值,PaddlePaddle 目前暂无对应 API,可使用如下代码组合实现该 API。
-
+### 转写示例
```python
# PyTorch 写法
var, mean = torch.var_mean(x, dim=1)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/transformers.PreTrainedModel.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/transformers.PreTrainedModel.md
index 69e7da52ae0..4b7bf6b826e 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/transformers.PreTrainedModel.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/composite_implement/transformers.PreTrainedModel.md
@@ -8,5 +8,3 @@ transformers.PreTrainedModel(config: PretrainedConfig, *inputs, **kwargs)
```python
paddlenlp.transformers.PreTrainedModel(*args, **kwargs)
```
-
-两者功能和参数均一致。
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.Tensor.qr.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.Tensor.qr.md
index 7e5b9963436..1b65d2682fb 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.Tensor.qr.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.Tensor.qr.md
@@ -19,7 +19,7 @@ paddle.Tensor.qr(mode='reduced')
### 转写示例
-### some:控制 QR 分解的行为
+#### some:控制 QR 分解的行为
```python
# 当进行完整的 QR 分解时
# PyTorch 写法
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.Tensor.slice_scatter.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.Tensor.slice_scatter.md
index 02e11e5e1e5..d293b4cb1ea 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.Tensor.slice_scatter.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.Tensor.slice_scatter.md
@@ -16,12 +16,13 @@ paddle.Tensor.slice_scatter(value, axes, starts, ends, strides, name=None)
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| src | value | 嵌入的值,仅参数名不一致。 |
-| dim | axes | 嵌入的维度,PyTorch 为 int 类型,Paddle 为 list of int。 |
-| start | starts | 嵌入起始索引,PyTorch 为 int 类型,Paddle 为 list of int。 |
-| end | ends | 嵌入截至索引,PyTorch 为 int 类型,Paddle 为 list of int。 |
-| step | strides | 嵌入步长,PyTorch 为 int 类型,Paddle 为 list of int。 |
+| dim | axes | 嵌入的维度,PyTorch 为 int 类型,Paddle 为 list of int。需要转写。 |
+| start | starts | 嵌入起始索引,PyTorch 为 int 类型,Paddle 为 list of int。需要转写。 |
+| end | ends | 嵌入截至索引,PyTorch 为 int 类型,Paddle 为 list of int。需要转写。 |
+| step | strides | 嵌入步长,PyTorch 为 int 类型,Paddle 为 list of int。需要转写。 |
### 转写示例
+#### dim、start、end、step 转写
```python
# PyTorch 写法
x.slice_scatter(src, dim=0, start=1, end=5, step=2)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.block_diag.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.block_diag.md
index c8e20090ac1..4a11de265cc 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.block_diag.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.block_diag.md
@@ -15,7 +15,7 @@ paddle.block_diag(inputs, name=None)
| PyTorch | PaddlePaddle | 备注 |
| -------- | ------------ | ------------------------------------------------------------ |
-| *tensors | inputs | 一组输入 Tensor,PyTorch 参数 tensors 为可变参数,Paddle 参数 inputs 为 list(Tensor) 或 tuple(Tensor) 的形式。 |
+| *tensors | inputs | 一组输入 Tensor,PyTorch 参数 tensors 为可变参数,Paddle 参数 inputs 为 list(Tensor) 或 tuple(Tensor) 的形式。需要转写。 |
### 转写示例
#### *tensors:一组输入 Tensor
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.broadcast_tensors.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.broadcast_tensors.md
index 079efa7d6d1..8e0fee27256 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.broadcast_tensors.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.broadcast_tensors.md
@@ -15,7 +15,7 @@ paddle.broadcast_tensors(input,
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| *tensors | input | 一组输入 Tensor , PyTorch 参数 tensors 为可变参, Paddle 参数 inputs 为 list(Tensor) 或 tuple(Tensor) 的形式。 |
+| *tensors | input | 一组输入 Tensor , PyTorch 参数 tensors 为可变参, Paddle 参数 inputs 为 list(Tensor) 或 tuple(Tensor) 的形式。 需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cartesian_prod.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cartesian_prod.md
index 29721810cf2..e8b1a2878c8 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cartesian_prod.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cartesian_prod.md
@@ -15,7 +15,7 @@ paddle.cartesian_prod(x, name=None)
| PyTorch | PaddlePaddle | 备注 |
| -------- | ------------ | ------------------------------------------------------------ |
-| *tensors | x | 一组输入 Tensor , PyTorch 参数 tensors 为可变参, Paddle 参数 x 为 list(Tensor) 或 tuple(Tensor) 的形式。 |
+| *tensors | x | 一组输入 Tensor , PyTorch 参数 tensors 为可变参, Paddle 参数 x 为 list(Tensor) 或 tuple(Tensor) 的形式。需要转写。 |
### 转写示例
#### *tensors:一组输入 Tensor
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cpu.set_device.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cpu.set_device.md
index edb13d99ab3..6d26012d6c8 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cpu.set_device.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cpu.set_device.md
@@ -14,7 +14,7 @@ paddle.device.set_device(device)
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ |------------------------------------------------|
-| device | device | PyTorch 支持 torch.device 。PaddlePaddle 支持 str。 |
+| device | device | PyTorch 支持 torch.device 。PaddlePaddle 支持 str。需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cuda.device.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cuda.device.md
deleted file mode 100644
index eded3f7514b..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cuda.device.md
+++ /dev/null
@@ -1,35 +0,0 @@
-## [ 输入参数类型不一致 ]torch.cuda.device
-### [torch.cuda.device](https://pytorch.org/docs/stable/generated/torch.cuda.device.html#torch.cuda.device)
-```python
-torch.cuda.device(device)
-```
-
-### [paddle.device._convert_to_place](https://github.com/PaddlePaddle/Paddle/blob/c8ccc9b154632ef41ade1b8e97b87d54fde7e8f8/python/paddle/device/__init__.py#L174)
-```python
-paddle.device._convert_to_place(device)
-```
-
-其中 PyTorch 与 Paddle 的参数支持类型不一致,具体如下:
-
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------- | ------------ | -------------------------------------------------------------------------------- |
-| device | device | GPU 的设备 ID, PyTorch 支持 torch.device 和 int,Paddle 支持 str,需要转写。 |
-
-### 转写示例
-#### device: 特定的运行设备
-```python
-# PyTorch 写法
-torch.cuda.device('cuda:0')
-
-# Paddle 写法
-paddle.device._convert_to_place('gpu:0')
-
-# PyTorch 写法
-torch.cuda.device(2)
-
-# Paddle 写法
-paddle.device._convert_to_place('gpu:2')
-
-```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cuda.set_rng_state_all.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cuda.set_rng_state_all.md
index 0930a79dfbc..697e5c845b5 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cuda.set_rng_state_all.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cuda.set_rng_state_all.md
@@ -19,7 +19,7 @@ paddle.set_rng_state(state_list, device='gpu')
| - | device | 返回随机数生成器状态的设备,Paddle 取值 gpu。 |
### 转写示例
-#### 参数类型不同
+#### new_states 参数
```python
# PyTorch 写法
x = torch.cuda.get_rng_state_all()
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cuda.synchronize.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cuda.synchronize.md
index f53dfb90470..6c35afdb554 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cuda.synchronize.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.cuda.synchronize.md
@@ -15,7 +15,7 @@ paddle.device.synchronize(device)
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ |-----------------------------------------------------------------------|
-| device | device | PyTorch 支持 torch.device 和 int。 PaddlePaddle 支持 paddle.CUDAPlace、int 、str,需要转写 |
+| device | device | PyTorch 支持 torch.device 和 int。 PaddlePaddle 支持 paddle.CUDAPlace、int 、str,需要转写。 |
### 转写示例
#### device: 特定的运行设备
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.distributed.reduce_scatter_tensor.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.distributed.reduce_scatter_tensor.md
index 5e0daec46a8..27268eeec0c 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.distributed.reduce_scatter_tensor.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.distributed.reduce_scatter_tensor.md
@@ -35,3 +35,11 @@ else:
input_list = paddle.split(input, num_or_sections=world_size, axis=0)
paddle.distributed.reduce_scatter(output, input_list)
```
+#### async_op 参数:异步操作
+```python
+# PyTorch 写法:
+torch.distributed.reduce_scatter_tensor(output, input, async_op=True)
+
+# Paddle 写法:
+paddle.distributed.reduce_scatter(output, input_list, sync_op=False)
+```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.nn.ReflectionPad1d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.nn.ReflectionPad1d.md
deleted file mode 100644
index 0553756f21b..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.nn.ReflectionPad1d.md
+++ /dev/null
@@ -1,37 +0,0 @@
-## [ 输入参数类型不一致 ]torch.nn.ReflectionPad1d
-### [torch.nn.ReflectionPad1d](https://pytorch.org/docs/stable/generated/torch.nn.ReflectionPad1d.html?highlight=pad#torch.nn.ReflectionPad1d)
-```python
-torch.nn.ReflectionPad1d(padding)
-```
-
-### [paddle.nn.Pad1D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Pad1D_cn.html#pad1d)
-```python
-paddle.nn.Pad1D(padding,
- mode='constant',
- value=0.0,
- data_format='NCL',
- name=None)
-```
-
-其中 Paddle 与 PyTorch 的 padding 所支持的参数类型不一致,具体如下:
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------------- | ------------ | ------------------------------------------------------ |
-| padding | padding | 填充大小,PyTorch 和 Paddle 的 padding 参数的类型分别为 (int/tuple) 和 (int/Tensor/list),需要转写。 |
-| - | mode | padding 的四种模式,PyTorch 无此参数,Paddle 需设置为`reflect`。 |
-| - | value | 表示填充值,PyTorch 无此参数,Paddle 保持默认即可。 |
-| - | data_format | 输入和输出的数据格式,PyTorch 无此参数,Paddle 保持默认即可。 |
-
-
-### 转写示例
-#### padding:填充大小
-```python
-# PyTorch 写法
-m = nn.ReflectionPad1d((3, 1))
-m(input)
-
-# Paddle 写法
-m = nn.Pad1D([3, 1], mode='reflect')
-m(input)
-```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.nn.ReflectionPad2d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.nn.ReflectionPad2d.md
deleted file mode 100644
index 4278abd5aa2..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.nn.ReflectionPad2d.md
+++ /dev/null
@@ -1,37 +0,0 @@
-## [ 输入参数类型不一致 ]torch.nn.ReflectionPad2d
-### [torch.nn.ReflectionPad2d](https://pytorch.org/docs/stable/generated/torch.nn.ReflectionPad2d.html?highlight=pad#torch.nn.ReflectionPad2d)
-```python
-torch.nn.ReflectionPad2d(padding)
-```
-
-### [paddle.nn.Pad2D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Pad2D_cn.html#pad2d)
-```python
-paddle.nn.Pad2D(padding,
- mode='constant',
- value=0.0,
- data_format='NCHW',
- name=None)
-```
-
-其中 Paddle 与 PyTorch 的 padding 所支持的参数类型不一致,具体如下:
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------------- | ------------ | ------------------------------------------------------ |
-| padding | padding | 填充大小,PyTorch 和 Paddle 的 padding 参数的类型分别为 (int/tuple) 和 (int/Tensor/list)。 |
-| - | mode | padding 的四种模式,PyTorch 无此参数,Paddle 需设置为`reflect`。 |
-| - | value | 表示填充值,PyTorch 无此参数,Paddle 保持默认即可。 |
-| - | data_format | 输入和输出的数据格式,PyTorch 无此参数,Paddle 保持默认即可。 |
-
-
-### 转写示例
-#### padding:填充大小
-```python
-# PyTorch 写法
-m = nn.ReflectionPad2d((1, 0, 1, 2))
-m(input)
-
-# Paddle 写法
-m = nn.Pad2D([1, 0, 1, 2], mode='reflect')
-m(input)
-```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.nn.ReflectionPad3d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.nn.ReflectionPad3d.md
deleted file mode 100644
index 58a0b256ac6..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.nn.ReflectionPad3d.md
+++ /dev/null
@@ -1,37 +0,0 @@
-## [ 输入参数类型不一致 ]torch.nn.ReflectionPad3d
-### [torch.nn.ReflectionPad3d](https://pytorch.org/docs/stable/generated/torch.nn.ReflectionPad3d.html?highlight=pad#torch.nn.ReflectionPad3d)
-```python
-torch.nn.ReflectionPad3d(padding)
-```
-
-### [paddle.nn.Pad3D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Pad3D_cn.html#pad3d)
-```python
-paddle.nn.Pad3D(padding,
- mode='constant',
- value=0.0,
- data_format='NCDHW',
- name=None)
-```
-
-其中 Paddle 与 PyTorch 的 padding 所支持的参数类型不一致,具体如下:
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------------- | ------------ | ------------------------------------------------------ |
-| padding | padding | 填充大小,PyTorch 和 Paddle 的 padding 参数的类型分别为 (int/tuple) 和 (int/Tensor/list)。 |
-| - | mode | padding 的四种模式,PyTorch 无此参数,Paddle 需设置为`reflect`。 |
-| - | value | 表示填充值,PyTorch 无此参数,Paddle 保持默认即可。 |
-| - | data_format | 输入和输出的数据格式,PyTorch 无此参数,Paddle 保持默认即可。 |
-
-
-### 转写示例
-#### padding:填充大小
-```python
-# PyTorch 写法
-m = nn.ReflectionPad3d((1, 0, 1, 2, 0, 0))
-m(input)
-
-# Paddle 写法
-m = nn.Pad3D([1, 0, 1, 2, 0, 0], mode='reflect')
-m(input)
-```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.nn.ReplicationPad1d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.nn.ReplicationPad1d.md
deleted file mode 100644
index 59a8d4c0fe0..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.nn.ReplicationPad1d.md
+++ /dev/null
@@ -1,38 +0,0 @@
-## [ 输入参数类型不一致 ]torch.nn.ReplicationPad1d
-### [torch.nn.ReplicationPad1d](https://pytorch.org/docs/stable/generated/torch.nn.ReplicationPad1d.html?highlight=pad#torch.nn.ReplicationPad1d)
-```python
-torch.nn.ReplicationPad1d(padding)
-```
-
-### [paddle.nn.Pad1D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Pad1D_cn.html#pad1d)
-```python
-paddle.nn.Pad1D(padding,
- mode='constant',
- value=0.0,
- data_format='NCL',
- name=None)
-```
-
-其中 Paddle 与 PyTorch 的 padding 所支持的参数类型不一致,具体如下:
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------------- | ------------ | ------------------------------------------------------ |
-| padding | padding | 填充大小,PyTorch 和 Paddle 的 padding 参数的类型分别为 (int/tuple) 和 (int/Tensor/list)。 |
-| - | mode | padding 的四种模式,PyTorch 无此参数,Paddle 需设置为`replicate`。 |
-| - | value | 表示填充值,PyTorch 无此参数,Paddle 保持默认即可。 |
-| - | data_format | 输入和输出的数据格式,PyTorch 无此参数,Paddle 保持默认即可。 |
-
-
-### 转写示例
-#### padding:填充大小
-```python
-# PyTorch 写法
-m = nn.ReplicationPad1d((3, 1))
-m(input)
-
-# Paddle 写法
-pad = paddle.to_tensor((3, 1))
-m = nn.Pad1D(pad, mode='replicate')
-m(input)
-```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.nn.ReplicationPad2d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.nn.ReplicationPad2d.md
deleted file mode 100644
index 602105f1f14..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.nn.ReplicationPad2d.md
+++ /dev/null
@@ -1,38 +0,0 @@
-## [ 输入参数类型不一致 ]torch.nn.ReplicationPad2d
-### [torch.nn.ReplicationPad2d](https://pytorch.org/docs/stable/generated/torch.nn.ReplicationPad2d.html?highlight=pad#torch.nn.ReplicationPad2d)
-```python
-torch.nn.ReplicationPad2d(padding)
-```
-
-### [paddle.nn.Pad2D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Pad2D_cn.html#pad2d)
-```python
-paddle.nn.Pad2D(padding,
- mode='constant',
- value=0.0,
- data_format='NCHW',
- name=None)
-```
-
-其中 Paddle 与 PyTorch 的 padding 所支持的参数类型不一致,具体如下:
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------------- | ------------ | ------------------------------------------------------ |
-| padding | padding | 填充大小,PyTorch 和 Paddle 的 padding 参数的类型分别为 (int/tuple) 和 (int/Tensor/list) ,需要转写。 |
-| - | mode | padding 的四种模式,PyTorch 无此参数,Paddle 需设置为`replicate`。 |
-| - | value | 表示填充值,PyTorch 无此参数,Paddle 保持默认即可。 |
-| - | data_format | 输入和输出的数据格式,PyTorch 无此参数,Paddle 保持默认即可。 |
-
-
-### 转写示例
-#### padding:填充大小
-```python
-# PyTorch 写法
-m = nn.ReplicationPad2d((3, 1))
-m(input)
-
-# Paddle 写法
-pad = paddle.to_tensor((3, 1))
-m = nn.Pad2D(pad, mode='replicate')
-m(input)
-```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.nn.ReplicationPad3d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.nn.ReplicationPad3d.md
deleted file mode 100644
index 20b36abd6b7..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.nn.ReplicationPad3d.md
+++ /dev/null
@@ -1,37 +0,0 @@
-## [ 输入参数类型不一致 ]torch.nn.ReplicationPad3d
-### [torch.nn.ReplicationPad3d](https://pytorch.org/docs/stable/generated/torch.nn.ReplicationPad3d.html?highlight=pad#torch.nn.ReplicationPad3d)
-```python
-torch.nn.ReplicationPad3d(padding)
-```
-
-### [paddle.nn.Pad3D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Pad3D_cn.html#pad3d)
-```python
-paddle.nn.Pad3D(padding,
- mode='constant',
- value=0.0,
- data_format='NCDHW',
- name=None)
-```
-
-其中 Paddle 与 PyTorch 的 padding 所支持的参数类型不一致,具体如下:
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------------- | ------------ | ------------------------------------------------------ |
-| padding | padding | 填充大小,PyTorch 和 Paddle 的 padding 参数的类型分别为 (int/tuple) 和 (int/Tensor/list) ,需要转写。 |
-| - | mode | padding 的四种模式,PyTorch 无此参数,Paddle 需设置为`replicate`。 |
-| - | data_format | 输入和输出的数据格式,PyTorch 无此参数,Paddle 保持默认即可。 |
-
-
-### 转写示例
-#### padding:填充大小
-```python
-# PyTorch 写法
-m = nn.ReplicationPad3d((3, 1))
-m(input)
-
-# Paddle 写法
-pad = paddle.to_tensor((3, 1))
-m = nn.Pad3D(pad, mode='replicate')
-m(input)
-```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.set_default_device.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.set_default_device.md
index 4b8f6a9d676..10c6e1b9236 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.set_default_device.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torch.set_default_device.md
@@ -14,7 +14,7 @@ paddle.device.set_device(device)
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ |------------------------------------------------|
-| device | device | PyTorch 支持 torch.device 。PaddlePaddle 支持 str。 |
+| device | device | PyTorch 支持 torch.device 。PaddlePaddle 支持 str。需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torchvision.io.decode_jpeg.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torchvision.io.decode_jpeg.md
index fd83609d456..385d36c91e9 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torchvision.io.decode_jpeg.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_type_diff/torchvision.io.decode_jpeg.md
@@ -30,7 +30,7 @@ torchvision.io.decode_jpeg(input=image_bytes, mode=torchvision.io.ImageReadMode.
paddle.vision.ops.decode_jpeg(x=image_bytes, mode='RGB')
```
-### device:解码后的图像将被存储到的设备
+#### device:解码后的图像将被存储到的设备
```python
# PyTorch 写法
y = torchvision.io.decode_jpeg(input=image_bytes, device=torch.device('cpu'))
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.Tensor.lstsq.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.Tensor.lstsq.md
index 2eba584af93..a22d2fc1c2f 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.Tensor.lstsq.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.Tensor.lstsq.md
@@ -22,7 +22,7 @@ paddle.Tensor.lstsq(y, rcond=None, driver=None, name=None)
| 返回值 | 返回值 | PyTorch 返回 solution、QR ,Paddle 返回 solution、residuals、rank、 singular_values,Paddle 与 PyTorch 仅第一个返回值相同,其他返回值结果不同,暂无转写方式。 |
### 转写示例
-#### A 参数转写
+#### A 参数
```python
# PyTorch 写法:
A = torch.tensor([[1, 1, 1],
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.Tensor.where.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.Tensor.where.md
index 4aee5920bd4..c313a49b773 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.Tensor.where.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.Tensor.where.md
@@ -17,15 +17,14 @@ Pytorch 为 Tensor 类方法,Paddle 为普通函数,具体如下:
| ------------- | ------------ | ------------------------------------------------------ |
| condition | condition | 判断条件。|
| self | x | 当 condition 为 true 时,选择的元素,调用 torch.Tensor 类方法的 self Tensor 传入。|
-| other | y | 当 condition 为 false 时,选择的元素,仅参数名不一致。|
+| other | y | 当 condition 为 false 时,选择的元素,仅参数名不一致。需要转写。|
### 转写示例
+#### other 参数
```python
# torch 写法
-a = torch.tensor([0, 1, 2])
-b = torch.tensor([2, 3, 0])
c = a.where(a > 0, b)
# paddle 写法
-paddle.where(a > 0, a, b)
+c = paddle.where(a > 0, a, b)
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.distributed.all_to_all_single.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.distributed.all_to_all_single.md
index d3b7996cdae..ea8e1ccddb7 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.distributed.all_to_all_single.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.distributed.all_to_all_single.md
@@ -20,7 +20,7 @@ paddle.distributed.alltoall_single(out_tensor, in_tensor, in_split_sizes=None, o
| output_split_sizes | out_split_sizes | 对输出 Tensor 的 dim[0] 进行切分的大小,仅参数名不一致。 |
| input_split_sizes | in_split_sizes | 对输入 Tensor 的 dim[0] 进行切分的大小,仅参数名不一致。 |
| group | group | new_group 返回的 Group 实例,或者设置为 None 表示默认地全局组。 |
-| async_op | sync_op | torch 为是否异步操作,Paddle 为是否同步操作,转写方式取反即可。 |
+| async_op | sync_op | torch 为是否异步操作,Paddle 为是否同步操作,需要转写,转写方式取反即可。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.distributed.optim.DistributedOptimizer.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.distributed.optim.DistributedOptimizer.md
index 3ad526e5384..eb8841a317f 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.distributed.optim.DistributedOptimizer.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.distributed.optim.DistributedOptimizer.md
@@ -16,7 +16,7 @@ paddle.distributed.fleet.distributed_optimizer(optimizer, strategy=None)
| PyTorch | PaddlePaddle | 备注 |
| --------------- | ------------ | --------------------------------------------------------------------- |
| optimizer_class | optimizer | 优化器,PyTorch 输入为 class, Paddle 输入为实例化的 optimizer。 |
-| params_rref | - | 远程引用( RRef )列表,为 RRef 类型,代表要优化的参数。而 Paddle 在实例化 optimizer 时传入,为 Tensor 类型 |
+| params_rref | - | 远程引用( RRef )列表,为 RRef 类型,代表要优化的参数。而 Paddle 在实例化 optimizer 时传入,为 Tensor 类型。 |
| args | - | 优化器实例化参数, Paddle 在实例化 optimizer 时传入。 |
| kwargs | - | 优化器实例化字典参数, Paddle 在实例化 optimizer 时传入。 |
| - | strategy | 用于切分优化器状态,PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.AvgPool1d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.AvgPool1d.md
index 2c75b6715b2..9f6b51076e1 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.AvgPool1d.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.AvgPool1d.md
@@ -27,7 +27,7 @@ paddle.nn.AvgPool1D(kernel_size,
| stride | stride | 表示步长 。 |
| padding | padding | 表示填充大小 。 |
| ceil_mode | ceil_mode | 表示是否用 ceil 函数计算输出的 height 和 width 。 |
-| count_include_pad | - | 是否使用额外 padding 的值计算平均池化结果,默认为 True 。 |
+| count_include_pad | - | 是否使用额外 padding 的值计算平均池化结果,默认为 True 。需要转写。 |
| - | exclusive | 是否不使用额外 padding 的值计算平均池化结果,默认为 True 。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.ConvTranspose1d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.ConvTranspose1d.md
index 17bdbf19a50..3756df3de06 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.ConvTranspose1d.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.ConvTranspose1d.md
@@ -42,7 +42,7 @@ paddle.nn.Conv1DTranspose(in_channels,
| padding | padding | 表示填充大小。 |
| output_padding | output_padding | 表示输出 Tensor 额外添加的大小。 |
| groups | groups | 表示分组数。 |
-| `bias` | - | 是否在输出中添加可学习的 bias。 |
+| bias | - | 是否在输出中添加可学习的 bias。 需要转写。 |
| dilation | dilation | 表示空洞大小。 |
| padding_mode | - | 填充模式,Paddle 无此参数,暂无转写方式。 |
| device | - | 指定 Tensor 的设备,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.ConvTranspose2d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.ConvTranspose2d.md
index ae2c9c0a728..e9d76667ee6 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.ConvTranspose2d.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.ConvTranspose2d.md
@@ -42,7 +42,7 @@ paddle.nn.Conv2DTranspose(in_channels,
| padding | padding | 表示填充大小。 |
| output_padding | output_padding | 表示输出 Tensor 额外添加的大小。 |
| groups | groups | 表示分组数。 |
-| bias | - | 是否在输出中添加可学习的 bias。 |
+| bias | - | 是否在输出中添加可学习的 bias。 需要转写。 |
| dilation | dilation | 表示空洞大小。 |
| padding_mode | - | 填充模式,Paddle 无此参数,暂无转写方式。 |
| device | - | 指定 Tensor 的设备,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.ConvTranspose3d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.ConvTranspose3d.md
index 1b06d12e35e..e73a0ebd17c 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.ConvTranspose3d.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.ConvTranspose3d.md
@@ -44,7 +44,7 @@ paddle.nn.Conv3DTranspose(in_channels,
| padding | padding | 表示填充大小。 |
| output_padding | output_padding | 表示输出 Tensor 额外添加的大小。 |
| groups | groups | 表示分组数。 |
-| bias | - | 是否在输出中添加可学习的 bias。 |
+| bias | - | 是否在输出中添加可学习的 bias。需要转写。 |
| dilation | dilation | 表示空洞大小。 |
| padding_mode | - | 填充模式,Paddle 无此参数,暂无转写方式。 |
| device | - | 指定 Tensor 的设备,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.InstanceNorm1d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.InstanceNorm1d.md
index 30d8da00826..c50c748cdd3 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.InstanceNorm1d.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.InstanceNorm1d.md
@@ -14,8 +14,8 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| num_features | num_features | 指明输入的通道数量 |
-| eps | epsilon | 为了数值稳定加在分母上的值 |
+| num_features | num_features | 指明输入的通道数量。 |
+| eps | epsilon | 为了数值稳定加在分母上的值。 |
| momentum | momentum | 此值用于计算 moving_mean 和 moving_var, 值的大小 Paddle = 1 - PyTorch,需要转写。 |
| affine | - | 是否使用可学习的仿射参数,Paddle 无此参数,需要转写。可通过 weight_attr 和 bias_attr 控制。 |
| track_running_stats | - | 是否跟踪运行时的 mean 和 var, Paddle 无此参数,暂无转写方式。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.LSTM.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.LSTM.md
index 9c0b1ef0255..8651742f7c1 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.LSTM.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.LSTM.md
@@ -40,7 +40,7 @@ paddle.nn.LSTM(input_size,
| bias | bias_ih_attr, bias_hh_attr | 是否使用偏置, Paddle 的 bias_ih_attr, bias_hh_attr 参数均需与 PyTorch 设置一致,需要转写。 |
| batch_first | time_major | PyTorch 表示 batch size 是否为第一维,PaddlePaddle 表示 time steps 是否为第一维,它们的意义相反。需要转写。 |
| dropout | dropout | 表示 dropout 概率。 |
-| bidirectional | direction | PyTorch 表示是否进行双向,Paddle 使用字符串表示是双向 LSTM(`bidirectional`)还是单向 LSTM(`forward`)|
+| bidirectional | direction | PyTorch 表示是否进行双向,Paddle 使用字符串表示是双向 LSTM(`bidirectional`)还是单向 LSTM(`forward`)。|
| proj_size | proj_size | 表示 LSTM 后将 `hidden state` 映射到对应的大小。 |
| device | - | 指定 Tensor 的设备,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
| dtype | - | Tensor 的所需数据类型,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.Linear.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.Linear.md
index 5c88d8f8f92..ea110298bff 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.Linear.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.Linear.md
@@ -24,7 +24,7 @@ paddle.nn.Linear(in_features,
| ------------- | ------------ | ------------------------------------------------------ |
| in_features | in_features | 表示线性变换层输入单元的数目。 |
| out_features | out_features | 表示线性变换层输出单元的数目。 |
-| bias | - | 是否在输出中添加可学习的 bias。 |
+| bias | - | 是否在输出中添加可学习的 bias。 需要转写。 |
| device | - | 指定 Tensor 的设备,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
| dtype | - | Tensor 的所需数据类型,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
| - | weight_attr | 指定权重参数的属性,PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.Module.zero_grad.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.Module.zero_grad.md
index 9db8d1d96c1..363ea745eb7 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.Module.zero_grad.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.Module.zero_grad.md
@@ -15,9 +15,10 @@ PyTorch 的 `Module.zero_grad` 参数与 Paddle 的 `Layer.clear_gradients` 参
| PyTorch | PaddlePaddle | 备注 |
| ----------- | ------------ | ------------------------------------------------ |
-| set_to_none | set_to_zero | 设置如何清空梯度,PyTorch 默认 set_to_none 为 True,Paddle 默认 set_to_zero 为 True,两者功能刚好相反,Paddle 需设置为 False。 |
+| set_to_none | set_to_zero | 设置如何清空梯度,PyTorch 默认 set_to_none 为 True,Paddle 默认 set_to_zero 为 True,需要转写,两者功能刚好相反,Paddle 需设置为 False。 |
### 转写示例
+#### set_to_none 参数
```python
# PyTorch 写法
torch.nn.Module.zero_grad(set_to_none=True)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.functional.avg_pool1d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.functional.avg_pool1d.md
index 6a31ddbba6f..64b02fb43d4 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.functional.avg_pool1d.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.functional.avg_pool1d.md
@@ -15,12 +15,12 @@ paddle.nn.functional.avg_pool1d(x, kernel_size, stride=None, padding=0, exclusiv
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| kernel_size | kernel_size | 池化核的尺寸大小。 |
-| stride | stride | 池化操作步长。 |
-| padding | padding | 池化补零的方式。 |
-| ceil_mode | ceil_mode | 是否用 `ceil` 函数计算输出的 height 和 width,如果设置为 `False`,则使用 `floor` 函数来计算,默认为 `False` |
-| count_include_pad | exclusive | 是否用额外 padding 的值计算平均池化结果,PyTorch 与 Paddle 的功能相反,需要转写 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| kernel_size | kernel_size | 池化核的尺寸大小。 |
+| stride | stride | 池化操作步长。 |
+| padding | padding | 池化补零的方式。 |
+| ceil_mode | ceil_mode | 是否用 `ceil` 函数计算输出的 height 和 width,如果设置为 `False`,则使用 `floor` 函数来计算,默认为 `False`。 |
+| count_include_pad | exclusive | 是否用额外 padding 的值计算平均池化结果,PyTorch 与 Paddle 的功能相反,需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.functional.avg_pool2d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.functional.avg_pool2d.md
index ed62625405b..62daefcfca0 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.functional.avg_pool2d.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.functional.avg_pool2d.md
@@ -14,14 +14,14 @@ paddle.nn.functional.avg_pool2d(x, kernel_size, stride=None, padding=0, ceil_mod
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| kernel_size | kernel_size | 池化核的尺寸大小。 |
-| stride | stride | 池化操作步长。 |
-| padding | padding | 池化补零的方式。 |
-| ceil_mode | ceil_mode | 是否用 `ceil` 函数计算输出的 height 和 width,如果设置为 `False`,则使用 `floor` 函数来计算,默认为 `False` |
-| divisor_override | divisor_override | 如果指定,它将用作除数,否则根据 `kernel_size` 计算除数。默认 `None` |
-| - | data_format | 输入和输出的数据格式, PyTorch 无此参数, 保持默认即可。 |
-| count_include_pad | exclusive | 是否用额外 padding 的值计算平均池化结果,PyTorch 与 Paddle 的功能相反,需要转写 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| kernel_size | kernel_size | 池化核的尺寸大小。 |
+| stride | stride | 池化操作步长。 |
+| padding | padding | 池化补零的方式。 |
+| ceil_mode | ceil_mode | 是否用 `ceil` 函数计算输出的 height 和 width,如果设置为 `False`,则使用 `floor` 函数来计算,默认为 `False`。 |
+| divisor_override | divisor_override | 如果指定,它将用作除数,否则根据 `kernel_size` 计算除数。默认 `None`。 |
+| - | data_format | 输入和输出的数据格式, PyTorch 无此参数, 保持默认即可。 |
+| count_include_pad | exclusive | 是否用额外 padding 的值计算平均池化结果,PyTorch 与 Paddle 的功能相反,需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.functional.avg_pool3d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.functional.avg_pool3d.md
index 9e8cbbd2776..a67f58df09e 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.functional.avg_pool3d.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.functional.avg_pool3d.md
@@ -14,14 +14,14 @@ paddle.nn.functional.avg_pool3d(x, kernel_size, stride=None, padding=0, ceil_mod
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| kernel_size | kernel_size | 池化核的尺寸大小。 |
-| stride | stride | 池化操作步长。 |
-| padding | padding | 池化补零的方式。 |
-| ceil_mode | ceil_mode | 是否用 `ceil` 函数计算输出的 height 和 width,如果设置为 `False`,则使用 `floor` 函数来计算,默认为 `False` |
-| divisor_override | divisor_override | 如果指定,它将用作除数,否则根据 `kernel_size` 计算除数。默认 `None` |
-| - | data_format | 输入和输出的数据格式, PyTorch 无此参数,保持默认即可。 |
-| count_include_pad | exclusive | 是否用额外 padding 的值计算平均池化结果,PyTorch 与 Paddle 的功能相反,需要转写 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| kernel_size | kernel_size | 池化核的尺寸大小。 |
+| stride | stride | 池化操作步长。 |
+| padding | padding | 池化补零的方式。 |
+| ceil_mode | ceil_mode | 是否用 `ceil` 函数计算输出的 height 和 width,如果设置为 `False`,则使用 `floor` 函数来计算,默认为 `False`。 |
+| divisor_override | divisor_override | 如果指定,它将用作除数,否则根据 `kernel_size` 计算除数。默认 `None`。 |
+| - | data_format | 输入和输出的数据格式, PyTorch 无此参数,保持默认即可。 |
+| count_include_pad | exclusive | 是否用额外 padding 的值计算平均池化结果,PyTorch 与 Paddle 的功能相反,需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.functional.instance_norm.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.functional.instance_norm.md
index 1d6f95a484b..36ca3f46a03 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.functional.instance_norm.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.nn.functional.instance_norm.md
@@ -15,12 +15,12 @@ paddle.nn.functional.instance_norm(x, running_mean=None, running_var=None, weigh
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| running_mean | running_mean | 均值的 Tensor |
-| running_var | running_var | 方差的 Tensor |
-| weight | weight | 权重的 Tensor |
-| bias | bias | 偏置的 Tensor |
-| eps | eps | 为了数值稳定加在分母上的值 |
-| momentum | momentum | 此值用于计算 moving_mean 和 moving_var, 值的大小 Paddle = 1 - PyTorch,需要转写 |
+| running_mean | running_mean | 均值的 Tensor。 |
+| running_var | running_var | 方差的 Tensor。 |
+| weight | weight | 权重的 Tensor。 |
+| bias | bias | 偏置的 Tensor。 |
+| eps | eps | 为了数值稳定加在分母上的值。 |
+| momentum | momentum | 此值用于计算 moving_mean 和 moving_var, 值的大小 Paddle = 1 - PyTorch,需要转写。 |
| - | training | 是否可训练。 PyTorch 无此参数。保持默认即可。 |
| - | data_format | 指定输入数据格式。 PyTorch 无此参数。保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.optim.Optimizer.zero_grad.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.optim.Optimizer.zero_grad.md
index 2dae9c1c918..f170fb146f4 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.optim.Optimizer.zero_grad.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.optim.Optimizer.zero_grad.md
@@ -15,9 +15,10 @@ PyTorch 的 `Optimizer.zero_grad` 参数与 Paddle 的 `Optimizer.clear_gradient
| PyTorch | PaddlePaddle | 备注 |
| ----------- | ------------ | ------------------------------------------------ |
-| set_to_none | set_to_zero | 设置如何清空梯度,PyTorch 默认 set_to_none 为 True,Paddle 默认 set_to_zero 为 True,两者功能刚好相反,Paddle 需设置为 False。 |
+| set_to_none | set_to_zero | 设置如何清空梯度,PyTorch 默认 set_to_none 为 True,Paddle 默认 set_to_zero 为 True,两者功能刚好相反,Paddle 需设置为 False。需要转写。 |
### 转写示例
+#### set_to_none 转写为 set_to_zero
```python
# PyTorch 写法
torch.optim.Optimizer.zero_grad(set_to_none=True)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.set_rng_state.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.set_rng_state.md
index 4c0b32aa49b..b95507105d9 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.set_rng_state.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.set_rng_state.md
@@ -15,7 +15,7 @@ paddle.set_rng_state(state_list)
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| new_state | state_list | 表示需要设置的新状态,PyTorch 输入类型为 torch.ByteTensor, Paddle 为 list[GeneratorState] |
+| new_state | state_list | 表示需要设置的新状态,PyTorch 输入类型为 torch.ByteTensor, Paddle 为 list[GeneratorState]。 需要转写。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.slice_scatter.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.slice_scatter.md
index c2b9058e178..8fbc87ffed2 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.slice_scatter.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.slice_scatter.md
@@ -17,12 +17,13 @@ paddle.slice_scatter(x, value, axes, starts, ends, strides, name=None)
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 输入的目标矩阵, 仅参数名不一致。 |
| src | value | 嵌入的值,仅参数名不一致。 |
-| dim | axes | 嵌入的维度,PyTorch 为 int 类型,Paddle 为 list of int。 |
-| start | starts | 嵌入起始索引,PyTorch 为 int 类型,Paddle 为 list of int。 |
-| end | ends | 嵌入截至索引,PyTorch 为 int 类型,Paddle 为 list of int。 |
-| step | strides | 嵌入步长,PyTorch 为 int 类型,Paddle 为 list of int。 |
+| dim | axes | 嵌入的维度,PyTorch 为 int 类型,Paddle 为 list of int。需要转写。 |
+| start | starts | 嵌入起始索引,PyTorch 为 int 类型,Paddle 为 list of int。需要转写。 |
+| end | ends | 嵌入截至索引,PyTorch 为 int 类型,Paddle 为 list of int。需要转写。 |
+| step | strides | 嵌入步长,PyTorch 为 int 类型,Paddle 为 list of int。需要转写。 |
### 转写示例
+#### src、dim、start、end、step 转写
```python
# PyTorch 写法
torch.slice_scatter(input, src, dim=0, start=1, end=5, step=2)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.sparse_coo_tensor.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.sparse_coo_tensor.md
index 2e4a3451518..5bf6a5e1c54 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.sparse_coo_tensor.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.sparse_coo_tensor.md
@@ -24,20 +24,10 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| check_invariants | - | 是否检查稀疏 Tensor 变量,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
### 转写示例
+#### requires_grad 参数
```python
-# PyTorch 写法
-import torch
-
-indices = [[0, 1, 2], [1, 2, 0]]
-values = [1.0, 2.0, 3.0]
-dense_shape = [3, 3]
coo = torch.sparse_coo_tensor(indices, values, dense_shape,requires_grad=False)
# Paddle 写法
-import paddle
-
-indices = [[0, 1, 2], [1, 2, 0]]
-values = [1.0, 2.0, 3.0]
-dense_shape = [3, 3]
coo = paddle.sparse.sparse_coo_tensor(indices, values, dense_shape,stop_gradient=True)
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.utils.data.TensorDataset.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.utils.data.TensorDataset.md
index cfb377ecd10..076b4b2cbc0 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.utils.data.TensorDataset.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/input_args_usage_diff/torch.utils.data.TensorDataset.md
@@ -15,10 +15,10 @@ paddle 参数和 torch 参数用法不一致,具体如下:
| PyTorch | PaddlePaddle | 备注 |
|----------|--------------|------------------------------------------------|
-| *tensors | tensors | 输入的 Tensor, PyTorch 是可变参数用法, Paddle 是列表或元组,需要转写 |
+| *tensors | tensors | 输入的 Tensor, PyTorch 是可变参数用法, Paddle 是列表或元组,需要转写。 |
### 转写示例
-#### tensors:输入的 Tensor
+#### *tensors:输入的 Tensor
```python
# PyTorch 写法
torch.utils.data.TensorDataset(tensor1, tensor2, tensor3)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.Tensor.hardshrink.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.Tensor.hardshrink.md
deleted file mode 100644
index cb5e71976fc..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.Tensor.hardshrink.md
+++ /dev/null
@@ -1,25 +0,0 @@
-## [ 仅 API 调用方式不一致 ]torch.Tensor.hardshrink
-
-### [torch.Tensor.hardshrink](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.hardshrink)
-
-```python
-torch.Tensor.hardshrink()
-```
-
-### [paddle.nn.functional.hardshrink](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/functional/hardshrink_cn.html#paddle/nn/functional/hardshrink_cn#cn-api-paddle-nn-functional-hardshrink)
-
-```python
-paddle.nn.functional.hardshrink(x, threshold=0.5, name=None)
-```
-
-两者功能一致,但调用方式不一致,具体如下:
-
-### 转写示例
-
-```python
-# PyTorch 写法
-result = x.hardshrink()
-
-# Paddle 写法
-result = paddle.nn.functional.hardshrink(x)
-```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.Event.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.Event.md
deleted file mode 100644
index 63ab7639d36..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.Event.md
+++ /dev/null
@@ -1,25 +0,0 @@
-## [ 仅 API 调用方式不一致 ]torch.cuda.Event
-
-### [torch.cuda.Event](https://pytorch.org/docs/stable/generated/torch.cuda.Event.html#torch.cuda.Event)
-
-```python
-torch.cuda.Event(enable_timing=False, blocking=False, interprocess=False)
-```
-
-### [paddle.device.cuda.Event](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/device/cuda/Event_cn.html#paddle/device/cuda/Event_cn#cn-api-paddle-device-cuda-Event)
-
-```python
-paddle.device.cuda.Event(enable_timing=False, blocking=False, interprocess=False)
-```
-
-两者功能一致,但调用方式不一致,具体如下:
-
-### 转写示例
-
-```python
-# PyTorch 写法
-result = torch.cuda.Event(enable_timing=True)
-
-# Paddle 写法
-result = paddle.device.cuda.Event(enable_timing=True)
-```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.manual_seed.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.manual_seed.md
deleted file mode 100644
index 8df630e5af6..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.manual_seed.md
+++ /dev/null
@@ -1,25 +0,0 @@
-## [ 仅 API 调用方式不一致 ]torch.cuda.manual_seed
-
-### [torch.cuda.manual_seed](https://pytorch.org/docs/stable/generated/torch.cuda.manual_seed.html#torch.cuda.manual_seed)
-
-```python
-torch.cuda.manual_seed(seed)
-```
-
-### [paddle.seed](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/seed_cn.html#paddle/seed_cn#cn-api-paddle-seed)
-
-```python
-paddle.seed(seed)
-```
-
-两者功能一致,但调用方式不一致,具体如下:
-
-### 转写示例
-
-```python
-# PyTorch 写法
-torch.cuda.manual_seed(123)
-
-# Paddle 写法
-paddle.seed(123)
-```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.max_memory_allocated.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.max_memory_allocated.md
deleted file mode 100644
index c42af001279..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.max_memory_allocated.md
+++ /dev/null
@@ -1,24 +0,0 @@
-## [ 仅 API 调用方式不一致 ]torch.cuda.max_memory_allocated
-
-### [torch.cuda.max_memory_allocated](https://pytorch.org/docs/stable/generated/torch.cuda.max_memory_allocated.html#torch.cuda.max_memory_allocated)
-
-```python
-torch.cuda.max_memory_allocated(device=None)
-```
-### [paddle.device.cuda.max_memory_allocated](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/device/cuda/max_memory_allocated_cn.html#paddle/device/cuda/max_memory_allocated_cn#cn-api-paddle-device-cuda-max_memory_allocated)
-
-```python
-paddle.device.cuda.max_memory_allocated(device=None)
-```
-
-两者功能一致,但调用方式不一致,具体如下:
-
-### 转写示例
-
-```python
-# PyTorch 写法
-result = torch.cuda.max_memory_allocated()
-
-# Paddle 写法
-result = paddle.device.cuda.max_memory_allocated()
-```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.max_memory_reserved.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.max_memory_reserved.md
deleted file mode 100644
index 6d2124a8c15..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.max_memory_reserved.md
+++ /dev/null
@@ -1,25 +0,0 @@
-## [ 仅 API 调用方式不一致 ]torch.cuda.max_memory_reserved
-
-### [torch.cuda.max_memory_reserved](https://pytorch.org/docs/stable/generated/torch.cuda.max_memory_reserved.html#torch.cuda.max_memory_reserved)
-
-```python
-torch.cuda.max_memory_reserved(device=None)
-```
-
-### [paddle.device.cuda.max_memory_reserved](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/device/cuda/max_memory_reserved_cn.html#paddle/device/cuda/max_memory_reserved_cn#cn-api-paddle-device-cuda-max_memory_reserved)
-
-```python
-paddle.device.cuda.max_memory_reserved(device=None)
-```
-
-两者功能一致,但调用方式不一致,具体如下:
-
-### 转写示例
-
-```python
-# PyTorch 写法
-result = torch.cuda.max_memory_reserved()
-
-# Paddle 写法
-result = paddle.device.cuda.max_memory_reserved()
-```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.nvtx.range_pop.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.nvtx.range_pop.md
deleted file mode 100644
index 76200f4aa84..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.nvtx.range_pop.md
+++ /dev/null
@@ -1,25 +0,0 @@
-## [ 仅 API 调用方式不一致 ]torch.cuda.nvtx.range_pop
-
-### [torch.cuda.nvtx.range_pop](https://pytorch.org/docs/stable/generated/torch.cuda.nvtx.range_pop.html#torch.cuda.nvtx.range_pop)
-
-```python
-torch.cuda.nvtx.range_pop()
-```
-
-### [paddle.core.nvprof_nvtx_pop](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/framework/core/nvprof_nvtx_pop_cn.html#paddle/core/nvprof_nvtx_pop_cn#cn-api-paddle-core-nvprof_nvtx_pop)
-
-```python
-paddle.core.nvprof_nvtx_pop()
-```
-
-两者功能一致,但调用方式不一致,具体如下:
-
-### 转写示例
-
-```python
-# PyTorch 写法
-result = torch.cuda.nvtx.range_pop()
-
-# Paddle 写法
-result = paddle.core.nvprof_nvtx_pop()
-```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.set_stream.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.set_stream.md
deleted file mode 100644
index 4b151ae4c10..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.set_stream.md
+++ /dev/null
@@ -1,25 +0,0 @@
-## [ 仅 API 调用方式不一致 ]torch.cuda.set_stream
-
-### [torch.cuda.set_stream](https://pytorch.org/docs/stable/generated/torch.cuda.set_stream.html#torch.cuda.set_stream)
-
-```python
-torch.cuda.set_stream(stream)
-```
-
-### [paddle.device.set_stream](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/device/set_stream_cn.html#paddle/device/set_stream_cn#cn-api-paddle-device-set_stream)
-
-```python
-paddle.device.set_stream(stream)
-```
-
-两者功能一致,但调用方式不一致,具体如下:
-
-### 转写示例
-
-```python
-# PyTorch 写法
-result = torch.cuda.set_stream(stream)
-
-# Paddle 写法
-result = paddle.device.set_stream(stream)
-```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.distributed.ReduceOp.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.distributed.ReduceOp.md
deleted file mode 100644
index cd276737220..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.distributed.ReduceOp.md
+++ /dev/null
@@ -1,27 +0,0 @@
-## [ 仅 API 调用方式不一致 ]torch.distributed.ReduceOp
-
-### [torch.distributed.ReduceOp](https://pytorch.org/docs/stable/generated/torch.distributed.ReduceOp.html#torch.distributed.ReduceOp)
-
-```python
-torch.distributed.ReduceOp
-```
-
-### [paddle.distributed.ReduceOp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/ReduceOp_cn.html#paddle/distributed/ReduceOp_cn#cn-api-paddle-distributed-ReduceOp)
-
-```python
-paddle.distributed.ReduceOp
-```
-
-两者功能一致,但调用方式不一致,具体如下:
-
-### 转写示例
-
-```python
-# PyTorch 写法
-torch.distributed.init_process_group(backend="nccl")
-print(torch.distributed.ReduceOp)
-
-# Paddle 写法
-paddle.distributed.init_parallel_env()
-print(paddle.distributed.ReduceOp)
-```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.allclose.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.allclose.md
index aa82f38183d..0fff40c3a78 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.allclose.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.allclose.md
@@ -19,7 +19,7 @@ paddle.Tensor.allclose(y, rtol=1e-05, atol=1e-08, equal_nan=False, name=None)
| rtol | rtol | 相对容差。 |
| atol | atol | 绝对容差。 |
| equal_nan | equal_nan | 如果设置为 True,则两个 NaN 数值将被视为相等。 |
-| 返回值 | 返回值 | PyTorch 返回值为标量, Paddle 返回值 0D Tensor。|
+| 返回值 | 返回值 | PyTorch 返回值为标量, Paddle 返回值 0D Tensor。需要转写。|
### 转写示例
#### 返回值
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.histc.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.histc.md
index 1dca5fad24d..1e16202e761 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.histc.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.histc.md
@@ -15,11 +15,13 @@ 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。 |
+| bins | bins | 直方图 bins(直条)的个数,默认为 100。 |
+| min | min | range 的下边界(包含),默认为 0。 |
+| max | max | range 的上边界(包含),默认为 0。 |
+| 返回值 | 返回值 | 返回 Tensor 的数据类型不一致,需要转写。 |
### 转写示例
+#### 返回值
```python
# PyTorch 写法
y = a.histc(bins=3, min=2, max=4)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.max.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.max.md
index efe198e5e6e..adce3bc3e5d 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.max.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.max.md
@@ -1,7 +1,7 @@
## [ 返回参数类型不一致 ]torch.Tensor.max
该 api 有两组参数列表重载,因此有两组差异分析。
------------------------------------------------
+-------------------------------------------------------------------------------------------------
### [torch.Tensor.max](https://pytorch.org/docs/stable/generated/torch.Tensor.max.html)
```python
@@ -33,7 +33,7 @@ result = x.max(dim=1)
result = x.max(dim=1), x.argmax(dim=1)
```
---------------------------------------------------------------
+-------------------------------------------------------------------------------------------------
### [torch.Tensor.max](https://pytorch.org/docs/stable/generated/torch.Tensor.max.html)
```python
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.min.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.min.md
index 0578939105a..5d75e6b6b43 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.min.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.min.md
@@ -1,7 +1,7 @@
## [ 返回参数类型不一致 ]torch.Tensor.min
该 api 有两组参数列表重载,因此有两组差异分析。
------------------------------------------------
+-------------------------------------------------------------------------------------------------
### [torch.Tensor.min](https://pytorch.org/docs/stable/generated/torch.Tensor.min.html)
```python
@@ -33,7 +33,7 @@ result = x.min(dim=1)
result = x.min(dim=1), x.argmin(dim=1)
```
---------------------------------------------------------------
+-------------------------------------------------------------------------------------------------
### [torch.Tensor.min](https://pytorch.org/docs/stable/generated/torch.Tensor.min.html)
```python
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.slogdet.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.slogdet.md
index d2f54726548..869e00ba90b 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.slogdet.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.slogdet.md
@@ -15,7 +15,7 @@ paddle.linalg.slogdet(x)
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| self | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| self | x | 表示输入的 Tensor ,仅参数名不一致。 |
| 返回值 | 返回值 | PyTorch 返回两个 Tesnor,Paddle 返回一个 Tensor,需要转写。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.sort.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.sort.md
index 9f892b0c34e..bb80012d2e2 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.sort.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.Tensor.sort.md
@@ -9,7 +9,7 @@ torch.Tensor.sort(dim=-1, descending=False, stable=False)
paddle.Tensor.sort(axis=-1, descending=False, stable=False)
```
-两者功能一致但返回参数类型不同,具体如下:
+两者功能一致但返回参数类型不同,PyTorch 返回 (Tensor, LongTensor),Paddle 返回 Tensor 。具体如下:
### 参数映射
@@ -20,8 +20,6 @@ paddle.Tensor.sort(axis=-1, descending=False, stable=False)
| stable | stable | 是否使用稳定排序。 |
| 返回值 | 返回值 | 表示以(Tensor, LongTensor)输出的元组,含义是排序后的返回值和对应元素索引。Paddle 无此参数,若返回排序后的元素,需要转写;若需要返回元素和元素索引,需要结合 argsort 进行转写。 |
-注:PyTorch 返回 (Tensor, LongTensor),Paddle 返回 Tensor 。
-
### 转写示例
#### 返回值
```python
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.histc.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.histc.md
index 52b2833b646..53052ebd26d 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.histc.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.histc.md
@@ -23,7 +23,7 @@ paddle.histogram(input, bins=100, min=0, max=0, name=None)
| 返回值 | 返回值 | 表示返回值,PyTorch 的返回值类型为 float32,Paddle 的返回值类型为 int64 , 需要转写。 |
### 转写示例
-#### out:指定输出
+#### out:指定输出、返回值类型转换
```python
# PyTorch 写法
torch.histc(x, out=y)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.linalg.slogdet.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.linalg.slogdet.md
index 47685423cd3..66e3007104d 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.linalg.slogdet.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.linalg.slogdet.md
@@ -15,8 +15,8 @@ paddle.linalg.slogdet(x)
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| A | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| out | - | 表示输出 Tensor,Paddle 无此参数,需要转写。 |
+| A | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| out | - | 表示输出 Tensor,Paddle 无此参数,需要转写。 |
| 返回值 | 返回值 | PyTorch 返回两个 Tensor,Paddle 返回一个 Tensor,需要转写。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.nn.GRUCell.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.nn.GRUCell.md
index fc373f99030..b5ea80d8ebb 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.nn.GRUCell.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.nn.GRUCell.md
@@ -37,7 +37,7 @@ torch.nn.GRUCell(16, 32, bias=False)
# Paddle 写法
paddle.nn.GRUCell(16, 32, bias_ih_attr=False, bias_hh_attr=False)
```
-#### forward 类方法:前向传播
+#### forward 类方法返回值:前向传播
```python
# 返回值个数不一致,Paddle 返回值比 Pytorch 多一个
# PyTorch 写法
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.nn.LSTMCell.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.nn.LSTMCell.md
index 72c64c98a04..05e7d626a70 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.nn.LSTMCell.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.nn.LSTMCell.md
@@ -38,7 +38,7 @@ torch.nn.LSTMCell(16, 32, bias=False)
# Paddle 写法
paddle.nn.LSTMCell(16, 32, bias_ih_attr=False, bias_hh_attr=False)
```
-#### forward 类方法:前向传播
+#### forward 类方法返回值:前向传播
```python
# 返回值个数不一致,Paddle 返回值比 Pytorch 多一个
# PyTorch 写法
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.nn.RNNCell.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.nn.RNNCell.md
index 891ae7f0884..38f45af4d77 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.nn.RNNCell.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.nn.RNNCell.md
@@ -36,7 +36,7 @@ torch.nn.RNNCell(16, 32, bias=False)
# Paddle 写法
paddle.nn.SimpleRNNCell(16, 32, bias_ih_attr=False, bias_hh_attr=False)
```
-#### forward 类方法:前向传播
+#### forward 类方法返回值:前向传播
```python
# 返回值个数不一致,Paddle 返回值比 Pytorch 多一个
# PyTorch 写法
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.slogdet.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.slogdet.md
index 0a772ee1ad8..a9e2ad3e9d6 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.slogdet.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.slogdet.md
@@ -15,8 +15,8 @@ paddle.linalg.slogdet(x)
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| out | - | 表示输出的 Tuple ,Paddle 无此参数,需要转写。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| out | - | 表示输出的 Tuple ,Paddle 无此参数,需要转写。 |
| 返回值 | 返回值 | PyTorch 返回两个 Tesnor,Paddle 返回一个 Tensor,需要转写。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.sparse.sum.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.sparse.sum.md
index 9f6ffda774f..6e8db1b8c79 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.sparse.sum.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/torch.sparse.sum.md
@@ -19,10 +19,10 @@ paddle.sparse.sum(x, axis=None, dtype=None, keepdim=False, name=None)
| dim | axis |输入的第二个 Tensor,仅参数名不一致。|
| dtype | dtype |输出数据的类型。|
| - | keepdim |是否留减少的维度, PyTorch 无此参数, Paddle 保持默认即可。|
-| 返回值 | 返回值 |当不指定 dim 时,PyTorch 返回 0D Tensor, Paddle 返回 Sparse Tensor。|
+| 返回值 | 返回值 |当不指定 dim 时,PyTorch 返回 0D Tensor, Paddle 返回 Sparse Tensor。需要转写。|
### 转写示例
-#### 返回类型:当不指定 dim 时,PyTorch 返回 0D Tensor, Paddle 返回 Sparse Tensor。
+#### 返回值:当不指定 dim 时,PyTorch 返回 0D Tensor, Paddle 返回 Sparse Tensor。
```Python
# PyTorch 写法
y = torch.sparse.sum(x)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/transformers.PreTrainedModel.generate.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/transformers.PreTrainedModel.generate.md
index a70acdc3a04..4572c963e70 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/transformers.PreTrainedModel.generate.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/transformers.PreTrainedModel.generate.md
@@ -17,6 +17,7 @@ paddlenlp.transformers.PreTrainedModel.generate(input_ids, **kwargs)
| 返回值 | 返回值 | PyTorch 返回类型为 Tensor,由 input 和生成的 ids(Tensor) 拼接而成,Paddle 返回类型为 tuple,由生成的 ids(Tensor) 和对应的 scores (Tensor)组成,需要转写。|
### 转写示例
+#### 返回值
```python
# Pytorch 写法
res = transformers.PreTrainedModel.generate(input = input_x)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/transformers.PreTrainedTokenizer.encode.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/transformers.PreTrainedTokenizer.encode.md
index 976d77e250d..47376a41d93 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/transformers.PreTrainedTokenizer.encode.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/output_args_type_diff/transformers.PreTrainedTokenizer.encode.md
@@ -17,6 +17,7 @@ paddlenlp.transformers.PreTrainedTokenizer.encode(text, **kwargs)
| 返回值 | 返回值 | PyTorch 返回 Tensor 类型,Paddle 返回类型为 `BatchEncoding`,是一种 dict-like 对象,key 包含 `input_ids`、`attention_mask` 等属性,需要转写。 |
### 转写示例
+#### 返回值
```python
# Pytorch 写法
transformers.PreTrainedTokenizer.encode(text)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.Tensor.count_nonzero.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.Tensor.count_nonzero.md
index 069dd8bdef2..cd2e4cc5782 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.Tensor.count_nonzero.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.Tensor.count_nonzero.md
@@ -15,5 +15,5 @@ paddle.Tensor.count_nonzero(axis=None, keepdim=False, name=None)
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| dim | axis | 表示进行运算的轴,仅参数名不一致。 |
-| - | keepdim | 是否在输出 Tensor 中保留减小的维度, PyTorch 无此参数, Paddle 保持默认即可。 |
+| dim | axis | 表示进行运算的轴,仅参数名不一致。 |
+| - | keepdim | 是否在输出 Tensor 中保留减小的维度, PyTorch 无此参数, Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.Tensor.cov.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.Tensor.cov.md
index 59c459875dd..d6bd1ca43ed 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.Tensor.cov.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.Tensor.cov.md
@@ -19,7 +19,7 @@ paddle.Tensor.cov(rowvar=True,
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| correction | ddof | 样本量和样本自由度之间的差异, 若为 True ,返回无偏估计结果;若为 False ,返回普通平均值计算结果。 |
+| correction | ddof | 样本量和样本自由度之间的差异, 若为 True ,返回无偏估计结果;若为 False ,返回普通平均值计算结果。 |
| fweights | fweights | 表示每一个观测向量的重复次数。 |
| aweights | aweights | 表示每一个观测向量的重要性。 |
-| - | rowvar | 以行或列作为一个观测变量, PyTorch 无此参数, Paddle 保持默认即可。 |
+| - | rowvar | 以行或列作为一个观测变量, PyTorch 无此参数, Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.count_nonzero.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.count_nonzero.md
index deff1b1c0cc..c9606578065 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.count_nonzero.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.count_nonzero.md
@@ -18,6 +18,6 @@ paddle.count_nonzero(x,
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| dim | axis | 表示进行运算的轴,仅参数名不一致。 |
-| - | keepdim | 是否在输出 Tensor 中保留减小的维度, PyTorch 无此参数, Paddle 保持默认即可。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| dim | axis | 表示进行运算的轴,仅参数名不一致。 |
+| - | keepdim | 是否在输出 Tensor 中保留减小的维度, PyTorch 无此参数, Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cov.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cov.md
index 8b5e8b09a18..160936ac753 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cov.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cov.md
@@ -23,8 +23,8 @@ paddle.linalg.cov(x,
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 输入的 Tensor 。 |
-| correction | ddof | 样本量和样本自由度之间的差异, 若为 True ,返回无偏估计结果;若为 False ,返回普通平均值计算结果。|
+| input | x | 输入的 Tensor 。 |
+| correction | ddof | 样本量和样本自由度之间的差异, 若为 True ,返回无偏估计结果;若为 False ,返回普通平均值计算结果。|
| fweights | fweights | 表示每一个观测向量的重复次数。 |
| aweights | aweights | 表示每一个观测向量的重要性。 |
-| - | rowvar | 以行或列作为一个观测变量, PyTorch 无此参数, Paddle 保持默认即可。 |
+| - | rowvar | 以行或列作为一个观测变量, PyTorch 无此参数, Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.BoolTensor.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.BoolTensor.md
deleted file mode 100644
index f1d722f0933..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.BoolTensor.md
+++ /dev/null
@@ -1,21 +0,0 @@
-## [ paddle 参数更多 ]torch.cuda.BoolTensor
-### [torch.cuda.BoolTensor](https://pytorch.org/docs/stable/tensors.html)
-```python
-torch.cuda.BoolTensor(data)
-```
-
-### [paddle.to_tensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/to_tensor_cn.html#to-tensor)
-```python
-paddle.to_tensor(data, dtype='bool', place='gpu', stop_gradient=True)
-```
-
-Paddle 比 PyTorch 支持更多参数,具体如下:
-
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------- | ------------ | ----------------------------------------------------------- |
-| data | data | 要转换的数据。 |
-| - | dtype | Tensor 的数据类型,PyTorch 无此参数,Paddle 需设置为 'bool'。 |
-| - | place | Tensor 的设备,PyTorch 无此参数,Paddle 需设置为 'gpu' 。 |
-| - | stop_gradient | 是否阻断 Autograd 的梯度传导。PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.ByteTensor.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.ByteTensor.md
deleted file mode 100644
index 48d5e3a72e9..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.ByteTensor.md
+++ /dev/null
@@ -1,21 +0,0 @@
-## [ paddle 参数更多 ]torch.cuda.ByteTensor
-### [torch.cuda.ByteTensor](https://pytorch.org/docs/stable/tensors.html)
-```python
-torch.cuda.ByteTensor(data)
-```
-
-### [paddle.to_tensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/to_tensor_cn.html#to-tensor)
-```python
-paddle.to_tensor(data, dtype='uint8', place='gpu', stop_gradient=True)
-```
-
-Paddle 比 PyTorch 支持更多参数,具体如下:
-
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------- | ------------ | ----------------------------------------------------------- |
-| data | data | 要转换的数据。 |
-| - | dtype | Tensor 的数据类型,PyTorch 无此参数,Paddle 需设置为 'uint8'。 |
-| - | place | Tensor 的设备,PyTorch 无此参数,Paddle 需设置为 'gpu' 。 |
-| - | stop_gradient | 是否阻断 Autograd 的梯度传导。PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.DoubleTensor.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.DoubleTensor.md
deleted file mode 100644
index e01d457202d..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.DoubleTensor.md
+++ /dev/null
@@ -1,19 +0,0 @@
-## [ paddle 参数更多 ]torch.cuda.DoubleTensor
-### [torch.cuda.DoubleTensor](https://pytorch.org/docs/stable/tensors.html)
-```python
-torch.cuda.DoubleTensor(data)
-```
-
-### [paddle.to_tensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/to_tensor_cn.html#to-tensor)
-```python
-paddle.to_tensor(data, dtype='float64', place='gpu')
-```
-
-Paddle 比 PyTorch 支持更多参数,具体如下:
-
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------- | ------------ | ----------------------------------------------------------- |
-| - | dtype | Tensor 的数据类型,PyTorch 无此参数,Paddle 需设置为 'float64'。 |
-| - | place | Tensor 的设备,PyTorch 无此参数,Paddle 需设置为 'gpu' 。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.FloatTensor.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.FloatTensor.md
deleted file mode 100644
index 3851393da3f..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.FloatTensor.md
+++ /dev/null
@@ -1,21 +0,0 @@
-## [ paddle 参数更多 ]torch.cuda.FloatTensor
-### [torch.cuda.FloatTensor](https://pytorch.org/docs/stable/tensors.html)
-```python
-torch.cuda.FloatTensor(data)
-```
-
-### [paddle.to_tensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/to_tensor_cn.html#to-tensor)
-```python
-paddle.to_tensor(data, dtype='float32', place='gpu', stop_gradient=True)
-```
-
-Paddle 比 PyTorch 支持更多参数,具体如下:
-
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------- | ------------ | ----------------------------------------------------------- |
-| data | data | 要转换的数据。 |
-| - | dtype | Tensor 的数据类型,PyTorch 无此参数,Paddle 需设置为 'float32'。 |
-| - | place | Tensor 的设备,PyTorch 无此参数,Paddle 需设置为 'gpu' 。 |
-| - | stop_gradient | 是否阻断 Autograd 的梯度传导。PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.HalfTensor.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.HalfTensor.md
deleted file mode 100644
index ae696161300..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.HalfTensor.md
+++ /dev/null
@@ -1,19 +0,0 @@
-## [ paddle 参数更多 ]torch.cuda.HalfTensor
-### [torch.cuda.HalfTensor](https://pytorch.org/docs/stable/tensors.html)
-```python
-torch.cuda.HalfTensor(data)
-```
-
-### [paddle.to_tensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/to_tensor_cn.html#to-tensor)
-```python
-paddle.to_tensor(data, dtype='float16', place='gpu')
-```
-
-Paddle 比 PyTorch 支持更多参数,具体如下:
-
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-|---------| ------------ |--------------------------------------------------|
-| - | dtype | Tensor 的数据类型,PyTorch 无此参数,Paddle 需设置为 'float16'。 |
-| - | place | Tensor 的设备,PyTorch 无此参数,Paddle 需设置为 'gpu' 。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.IntTensor.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.IntTensor.md
deleted file mode 100644
index bc9be75a891..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.IntTensor.md
+++ /dev/null
@@ -1,21 +0,0 @@
-## [ paddle 参数更多 ]torch.cuda.IntTensor
-### [torch.cuda.IntTensor](https://pytorch.org/docs/stable/tensors.html)
-```python
-torch.cuda.IntTensor(data)
-```
-
-### [paddle.to_tensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/to_tensor_cn.html#to-tensor)
-```python
-paddle.to_tensor(data, dtype='int32', place='gpu', stop_gradient=True)
-```
-
-Paddle 比 PyTorch 支持更多参数,具体如下:
-
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------- | ------------ | ----------------------------------------------------------- |
-| data | data | 要转换的数据。 |
-| - | dtype | Tensor 的数据类型,PyTorch 无此参数,Paddle 需设置为 'int32'。 |
-| - | place | Tensor 的设备,PyTorch 无此参数,Paddle 需设置为 'gpu' 。 |
-| - | stop_gradient | 是否阻断 Autograd 的梯度传导。PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.LongTensor.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.LongTensor.md
deleted file mode 100644
index 2ada8666e9e..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.LongTensor.md
+++ /dev/null
@@ -1,21 +0,0 @@
-## [ paddle 参数更多 ]torch.cuda.LongTensor
-### [torch.cuda.LongTensor](https://pytorch.org/docs/stable/tensors.html)
-```python
-torch.cuda.LongTensor(data)
-```
-
-### [paddle.to_tensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/to_tensor_cn.html#to-tensor)
-```python
-paddle.to_tensor(data, dtype='int64', place='gpu', stop_gradient=True)
-```
-
-Paddle 比 PyTorch 支持更多参数,具体如下:
-
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------- | ------------ | ----------------------------------------------------------- |
-| data | data | 要转换的数据。 |
-| - | dtype | Tensor 的数据类型,PyTorch 无此参数,Paddle 需设置为 'int64'。 |
-| - | place | Tensor 的设备,PyTorch 无此参数,Paddle 需设置为 'gpu' 。 |
-| - | stop_gradient | 是否阻断 Autograd 的梯度传导。PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.ShortTensor.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.ShortTensor.md
deleted file mode 100644
index ea2e5511df1..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.ShortTensor.md
+++ /dev/null
@@ -1,19 +0,0 @@
-## [ paddle 参数更多 ]torch.cuda.ShortTensor
-### [torch.cuda.ShortTensor](https://pytorch.org/docs/stable/tensors.html)
-```python
-torch.cuda.ShortTensor(data)
-```
-
-### [paddle.to_tensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/to_tensor_cn.html#to-tensor)
-```python
-paddle.to_tensor(data, dtype='int16', place='gpu')
-```
-
-Paddle 比 PyTorch 支持更多参数,具体如下:
-
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------- | ------------ | ----------------------------------------------------------- |
-| - | dtype | Tensor 的数据类型,PyTorch 无此参数,Paddle 需设置为 'int16'。 |
-| - | place | Tensor 的设备,PyTorch 无此参数,Paddle 需设置为 'gpu' 。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.amp.autocast.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.amp.autocast.md
deleted file mode 100644
index db1728c0804..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.cuda.amp.autocast.md
+++ /dev/null
@@ -1,24 +0,0 @@
-## [ paddle 参数更多 ]torch.cuda.amp.autocast
-### [torch.cuda.amp.autocast](https://pytorch.org/docs/stable/amp.html#torch.cuda.amp.autocast)
-```python
-torch.cuda.amp.autocast(enabled=True, dtype=torch.float16, cache_enabled=True)
-```
-
-### [paddle.amp.auto_cast](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/amp/auto_cast_cn.html)
-```python
-paddle.amp.auto_cast(enable=True, custom_white_list=None, custom_black_list=None, level='O1', dtype='float16', use_promote=True)
-```
-
-其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下:
-
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------------- | ----------------- | ------------------------------------------------------------ |
-| enabled | enable | 是否开启自动混合精度。 |
-| dtype | dtype | 使用的数据类型。 |
-| cache_enabled | - | 是否启用权重缓存,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。|
-| - | custom_white_list | 自定义算子白名单,PyTorch 无此参数,Paddle 保持默认即可。 |
-| - | custom_black_list | 自定义算子黑名单,PyTorch 无此参数,Paddle 保持默认即可。 |
-| - | level | 混合精度训练模式,PyTorch 无此参数,Paddle 保持默认即可。 |
-| - | use_promote | 当一个算子存在 float32 类型的输入时,按照 Promote to the Widest 原则,选择 float32 数据类型进行计算。仅在 AMP-O2 训练时可配置。默认为 True。PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.fliplr.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.fliplr.md
index 6737ba1c66e..a2cec8d6692 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.fliplr.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.fliplr.md
@@ -17,5 +17,5 @@ paddle.flip(x,
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| - | axis | 表示进行运算的轴,PyTorch 无此参数,Paddle 需设置为 1 。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| - | axis | 表示进行运算的轴,PyTorch 无此参数,Paddle 需设置为 1 。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.flipud.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.flipud.md
index 3c1060f790b..6e3fedc6e13 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.flipud.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.flipud.md
@@ -14,8 +14,8 @@ paddle.flip(x, axis, name=None)
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| - | axis | 表示对输入 Tensor 进行翻转的轴, PyTorch 无此参数, Paddle 需要将其设为 0。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| - | axis | 表示对输入 Tensor 进行翻转的轴, PyTorch 无此参数, Paddle 需要将其设为 0。 |
### 转写示例
```python
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.CircularPad3d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.CircularPad3d.md
deleted file mode 100644
index 7c9eb3b99f5..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.CircularPad3d.md
+++ /dev/null
@@ -1,20 +0,0 @@
-## [ paddle 参数更多 ]torch.nn.CircularPad3d
-### [torch.nn.CircularPad3d](https://pytorch.org/docs/stable/generated/torch.nn.CircularPad3d.html#circularpad3d)
-```python
-torch.nn.CircularPad3d(padding)
-```
-
-### [paddle.nn.Pad3D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Pad3D_cn.html#pad3d)
-```python
-paddle.nn.Pad3D(padding, mode='constant', value=0.0, data_format='NCDHW', name=None)
-```
-
-其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下:
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------------- | ------------ | ---------------------------------------------------------------------------- |
-| padding | padding | 填充大小。 |
-| - | mode | `padding` 的四种模式。PyTorch 无此参数,Paddle 应设置为 `circular`。 |
-| - | value | 以 `constant` 模式填充区域时填充的值。PyTorch 无此参数,Paddle 保持默认即可。|
-| - | data_format | 输入的数据格式。PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.ConstantPad1d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.ConstantPad1d.md
deleted file mode 100644
index 377eea9c853..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.ConstantPad1d.md
+++ /dev/null
@@ -1,25 +0,0 @@
-## [ paddle 参数更多 ]torch.nn.ConstantPad1d
-### [torch.nn.ConstantPad1d](https://pytorch.org/docs/stable/generated/torch.nn.ConstantPad1d.html?highlight=constantpad1d#torch.nn.ConstantPad1d)
-```python
-torch.nn.ConstantPad1d(padding,
- value)
-```
-
-### [paddle.nn.Pad1D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Pad1D_cn.html#pad1d)
-```python
-paddle.nn.Pad1D(padding,
- mode='constant',
- value=0.0,
- data_format='NCL',
- name=None)
-```
-
-其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下:
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------------- | ------------ | ------------------------------------------------------ |
-| padding | padding | 填充大小 |
-| value | value | 以 'constant' 模式填充区域时填充的值。默认值为 0.0 。 |
-| - | mode | padding 的四种模式,PyTorch 无此参数,Paddle 保持默认即可。 |
-| - | data_format | 输入和输出的数据格式,PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.ConstantPad2d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.ConstantPad2d.md
deleted file mode 100644
index 019a22dce15..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.ConstantPad2d.md
+++ /dev/null
@@ -1,25 +0,0 @@
-## [ paddle 参数更多 ]torch.nn.ConstantPad2d
-### [torch.nn.ConstantPad2d](https://pytorch.org/docs/stable/generated/torch.nn.ConstantPad2d.html?highlight=pad#torch.nn.ConstantPad2d)
-```python
-torch.nn.ConstantPad2d(padding,
- value)
-```
-
-### [paddle.nn.Pad2D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Pad2D_cn.html#pad2d)
-```python
-paddle.nn.Pad2D(padding,
- mode='constant',
- value=0.0,
- data_format='NCHW',
- name=None)
-```
-
-其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下:
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------------- | ------------ | ------------------------------------------------------ |
-| padding | padding | 填充大小|
-| value | value | 以 'constant' 模式填充区域时填充的值。默认值为 0.0 。 |
-| - | mode | padding 的四种模式,PyTorch 无此参数,Paddle 保持默认即可。 |
-| - | data_format | 输入和输出的数据格式,PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.ConstantPad3d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.ConstantPad3d.md
deleted file mode 100644
index 327d38a3f2c..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.ConstantPad3d.md
+++ /dev/null
@@ -1,25 +0,0 @@
-## [ paddle 参数更多 ]torch.nn.ConstantPad3d
-### [torch.nn.ConstantPad3d](https://pytorch.org/docs/stable/generated/torch.nn.ConstantPad3d.html?highlight=pad#torch.nn.ConstantPad3d)
-```python
-torch.nn.ConstantPad3d(padding,
- value)
-```
-
-### [paddle.nn.Pad3D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Pad3D_cn.html#pad3d)
-```python
-paddle.nn.Pad3D(padding,
- mode='constant',
- value=0.0,
- data_format='NCDHW',
- name=None)
-```
-
-其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下:
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------------- | ------------ | ------------------------------------------------------ |
-| padding | padding | 填充大小|
-| value | value | 以 'constant' 模式填充区域时填充的值。默认值为 0.0 。 |
-| - | mode | padding 的四种模式,PyTorch 无此参数,Paddle 保持默认即可。 |
-| - | data_format | 输入和输出的数据格式,PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.functional.upsample_bilinear.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.functional.upsample_bilinear.md
index 57d4e696144..03c985f7afb 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.functional.upsample_bilinear.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.functional.upsample_bilinear.md
@@ -14,10 +14,10 @@ Paddle 参数更多,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| size | size | 输出 Tensor 的大小。 |
-| scale_factor | scale_factor | 输入的高度或宽度的乘数因子。 |
-| - | mode | 插值方法。 PyTorch 无此参数,Paddle 默认为 `’nearest‘`,需要设置为 `‘bilinear'` 。 |
-| - | align_corners | 是否将输入和输出张量的 4 个角落像素的中心对齐,并保留角点像素的值。PyTorch 无此参数,Paddle 默认为 `False`,需要设置为 `True`。 |
-| - | align_mode | 双线性插值的可选项。PyTorch 无此参数。Paddle 保持默认即可。 |
-| - | data_format | 指定输入的数据格式。PyTorch 无此参数。Paddle 保持默认即可。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| size | size | 输出 Tensor 的大小。 |
+| scale_factor | scale_factor | 输入的高度或宽度的乘数因子。 |
+| - | mode | 插值方法。 PyTorch 无此参数,Paddle 默认为 `’nearest‘`,需要设置为 `‘bilinear'` 。 |
+| - | align_corners | 是否将输入和输出张量的 4 个角落像素的中心对齐,并保留角点像素的值。PyTorch 无此参数,Paddle 默认为 `False`,需要设置为 `True`。 |
+| - | align_mode | 双线性插值的可选项。PyTorch 无此参数。Paddle 保持默认即可。 |
+| - | data_format | 指定输入的数据格式。PyTorch 无此参数。Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.functional.upsample_nearest.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.functional.upsample_nearest.md
index f3ba9fae331..077e1f281c0 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.functional.upsample_nearest.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/paddle_more_args/torch.nn.functional.upsample_nearest.md
@@ -15,10 +15,10 @@ paddle.nn.functional.upsample(x, size=None, scale_factor=None, mode='nearest', a
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| size | size | 输出 Tensor 的大小。 |
-| scale_factor | scale_factor | 输入的高度或宽度的乘数因子。 |
-| - | mode | 插值方法。 PyTorch 无此参数,Paddle 默认为 `’nearest‘`。 |
-| - | align_corners | 是否将输入和输出张量的 4 个角落像素的中心对齐,并保留角点像素的值。PyTorch 无此参数。 |
-| - | align_mode | 双线性插值的可选项。PyTorch 无此参数。Paddle 保持默认即可。 |
-| - | data_format | 指定输入的数据格式。PyTorch 无此参数。Paddle 保持默认即可。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| size | size | 输出 Tensor 的大小。 |
+| scale_factor | scale_factor | 输入的高度或宽度的乘数因子。 |
+| - | mode | 插值方法。 PyTorch 无此参数,Paddle 默认为 `’nearest‘`。 |
+| - | align_corners | 是否将输入和输出张量的 4 个角落像素的中心对齐,并保留角点像素的值。PyTorch 无此参数。 |
+| - | align_mode | 双线性插值的可选项。PyTorch 无此参数。Paddle 保持默认即可。 |
+| - | data_format | 指定输入的数据格式。PyTorch 无此参数。Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.index_add.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.index_add.md
index b1f213ed21b..2744d344454 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.index_add.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.index_add.md
@@ -14,10 +14,10 @@ paddle.Tensor.index_add(index, axis, value, name=None)
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| dim | axis | 表示进行运算的轴,仅参数名不一致。 |
-| index | index | 包含索引下标的 1-D Tensor。 |
-| source | value | 被加的 Tensor,仅参数名不一致。 |
-| alpha | - | source 的 缩放倍数, Paddle 无此参数,需要转写。Paddle 应将 alpha 和 source 的乘积作为 value。 |
+| dim | axis | 表示进行运算的轴,仅参数名不一致。 |
+| index | index | 包含索引下标的 1-D Tensor。 |
+| source | value | 被加的 Tensor,仅参数名不一致。 |
+| alpha | - | source 的 缩放倍数, Paddle 无此参数,需要转写。Paddle 应将 alpha 和 source 的乘积作为 value。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.index_add_.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.index_add_.md
index 9d1c24971d0..443f8db3ce8 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.index_add_.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.index_add_.md
@@ -15,10 +15,10 @@ paddle.Tensor.index_add_(index, axis, value)
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| dim | axis | 表示进行运算的轴,仅参数名不一致。 |
-| index | index | 包含索引下标的 1-D Tensor。 |
-| source | value | 被加的 Tensor,仅参数名不一致。 |
-| alpha | - | source 的 缩放倍数, Paddle 无此参数,需要转写。Paddle 应将 alpha 和 source 的乘积作为 value。 |
+| dim | axis | 表示进行运算的轴,仅参数名不一致。 |
+| index | index | 包含索引下标的 1-D Tensor。 |
+| source | value | 被加的 Tensor,仅参数名不一致。 |
+| alpha | - | source 的 缩放倍数, Paddle 无此参数,需要转写。Paddle 应将 alpha 和 source 的乘积作为 value。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.nanmean.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.nanmean.md
index ff7eeeff7f5..74b447ef569 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.nanmean.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.nanmean.md
@@ -24,7 +24,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| dtype | - | 指定输出数据类型,可选项,PyTorch 默认值为 None,Paddle 无此参数,需要转写。 |
### 转写示例
-#### dytpe:指定数据类型
+#### dtype:指定数据类型
```python
# PyTorch 写法
x.nanmean(dim=-1, dtype=torch.float32)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.round.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.round.md
index 9aeace29e32..36fbcb2fee0 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.round.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.round.md
@@ -15,7 +15,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| -------- | ------- | ------- |
-| decimals | - | 舍入小数位数 |
+| decimals | - | 舍入小数位数。需要转写。 |
### 转写示例
#### decimals:要舍入到的小数位数
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.round_.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.round_.md
index f1ed147cca8..2159ee53fb0 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.round_.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.round_.md
@@ -15,7 +15,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| -------- | ------- | ------- |
-| decimals | - | 舍入小数位数 |
+| decimals | - | 舍入小数位数。需要转写。 |
### 转写示例
#### decimals:要舍入到的小数位数
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.stft.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.stft.md
index b5f71e758c6..add1a775899 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.stft.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.stft.md
@@ -23,7 +23,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| pad_mode | pad_mode | 当 center 为 True 时,确定 padding 的模式。 |
| normalized | normalized | 是否将傅里叶变换的结果乘以值为 1/sqrt(n) 的缩放系数。 |
| onesided | onesided | 当输入为实信号时,选择是否只返回傅里叶变换结果的一半的频点值。 |
-| return_complex | - | 表示当输入为复数时,是否以复数形式返回,还是将实部与虚部分开以实数形式返回。Paddle 目前只支持返回复数,分开返回实部与虚部的情况,需要使用 as_real 进行转写。 |
+| return_complex | - | 表示当输入为复数时,是否以复数形式返回,还是将实部与虚部分开以实数形式返回。Paddle 目前只支持返回复数,分开返回实部与虚部的情况,需要转写。 |
### 转写示例
#### return_complex:是否返回复数
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.unique.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.unique.md
index 954c25fdbca..73b5025ff47 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.unique.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.Tensor.unique.md
@@ -14,7 +14,7 @@ paddle.Tensor.unique(return_index=False, return_inverse=False, return_counts=Fal
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| sorted | - | 是否返回前进行排序,Paddle 无此参数。转换时直接删除即可,PyTorch 目前忽略了此参数。 |
+| sorted | - | 是否返回前进行排序,Paddle 无此参数。可直接删除,PyTorch 目前忽略了此参数。 |
| return_inverse| return_inverse | 是否返回输入 Tensor 的元素对应在独有元素中的索引。 |
| return_counts | return_counts | 是否返回每个独有元素在输入 Tensor 中的个数。 |
| dim | axis | 选取的轴,仅参数名不一致。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.abs.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.abs.md
deleted file mode 100644
index 0fd52a8e417..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.abs.md
+++ /dev/null
@@ -1,33 +0,0 @@
-## [ torch 参数更多 ]torch.abs
-### [torch.abs](https://pytorch.org/docs/stable/generated/torch.abs.html?highlight=abs#torch.abs)
-```python
-torch.abs(input,
- *,
- out=None)
-```
-
-### [paddle.abs](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/abs_cn.html#abs)
-```python
-paddle.abs(x,
- name=None)
-```
-
-PyTorch 相比 Paddle 支持更多其他参数,具体如下:
-
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 输入的 Tensor ,仅参数名不一致。 |
-| out | - | 表示输出的 Tensor,Paddle 无此参数,需要转写。 |
-
-
-### 转写示例
-#### out:指定输出
-```python
-# PyTorch 写法
-torch.abs([-3, -5], out=y)
-
-# Paddle 写法
-paddle.assign(paddle.abs([-3, -5]), y)
-```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.amp.autocast.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.amp.autocast.md
index 20ac8c2f589..e6a9482b11a 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.amp.autocast.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.amp.autocast.md
@@ -24,7 +24,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------ | ------------------------------------------------------------ |
| device_type | - | 指定设备类型,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
-| dtype | dtype | 指定自动混合精度的计算类型 |
+| dtype | dtype | 指定自动混合精度的计算类型。 |
| enabled | enable | 是否启用自动混合精度。 |
| cache_enabled | - | 启用或禁用 CUDA 图形缓存 Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
| - | custom_white_list | 白名单,通常不需要设置。PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.cholesky_inverse.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.cholesky_inverse.md
index 11b0c0c7d19..e7920426d39 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.cholesky_inverse.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.cholesky_inverse.md
@@ -20,6 +20,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| out | - | 表示输出的 Tensor,Paddle 无此参数,需要转写。 |
### 转写示例
+#### out:输出的 Tensor
```python
# PyTorch 写法
torch.cholesky_inverse(input, out=output)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.clone.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.clone.md
index 3284f0e1cf4..0adb0f1f494 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.clone.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.clone.md
@@ -19,4 +19,4 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 输入的 Tensor ,仅参数名不一致。 |
-| memory_format | - | 返回张量的所需内存格式,默认为 torch.preserve_format 。Paddle 无此参数,一般对训练结果影响不大,直接删除即可。 |
+| memory_format | - | 返回张量的所需内存格式,默认为 torch.preserve_format 。Paddle 无此参数,一般对训练结果影响不大,可直接删除。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.column_stack.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.column_stack.md
index be65a532903..1b02139f282 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.column_stack.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.column_stack.md
@@ -17,3 +17,16 @@ paddle.column_stack(x, name=None)
| ------------- | ------------ | ------------------------------------------------------ |
| tensors | x | 表示输入的 Tensor ,仅参数名不一致。 |
| out | - | 表示输出的 Tensor ,Paddle 无此参数,需要转写。 |
+
+### 转写示例
+#### out 参数转写
+```python
+# PyTorch 写法
+out = torch.tensor([[4, 5, 6], [1, 2, 3]])
+result = torch.column_stack((a,b), out=out)
+
+# Paddle 写法
+out = paddle.tensor([[4, 5, 6], [1, 2, 3]])
+result = paddle.assign(paddle.column_stack(x=(a, b)), output=out)
+
+```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.conj_physical.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.conj_physical.md
index 025d66015d5..5e40d267c7d 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.conj_physical.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.conj_physical.md
@@ -19,6 +19,7 @@ PyTorch 参数更多,具体如下:
| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
| out | - | 表示输出的 Tensor ,paddle 无此参数, 需要转写。 |
+### 转写示例
#### out:指定输出
```python
# PyTorch 写法
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.cuda.is_bf16_supported.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.cuda.is_bf16_supported.md
index 3f3dd733c4b..86659e0cb6e 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.cuda.is_bf16_supported.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.cuda.is_bf16_supported.md
@@ -1,4 +1,4 @@
-## [ torch 参数更多 ]torch.cuda.is_bf16_supported
+## [ torch 参数更多 ]torch.cuda.is_bf16_supported
### [torch.cuda.is_bf16_supported](https://pytorch.org/docs/stable/generated/torch.cuda.is_bf16_supported.html#torch.cuda.is_bf16_supported)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.diag.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.diag.md
index 5f80c0ec329..6d5e08f6dc6 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.diag.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.diag.md
@@ -22,10 +22,10 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| diagonal | offset | 对角线偏移量。正值表示上对角线,0 表示主对角线,负值表示下对角线。 |
-| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
-| - | padding_value | 表示填充指定对角线以外的区域, PyTorch 无此参数, Paddle 保持默认即可 。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| diagonal | offset | 对角线偏移量。正值表示上对角线,0 表示主对角线,负值表示下对角线。 |
+| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
+| - | padding_value | 表示填充指定对角线以外的区域, PyTorch 无此参数, Paddle 保持默认即可 。 |
### 转写示例
#### out:指定输出
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.fmod.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.fmod.md
index 62746665509..872b10aef43 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.fmod.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.fmod.md
@@ -19,9 +19,9 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的被除数 ,仅参数名不一致。 |
-| other | y | 表示输入的除数, PyTorch 可以为 Tensor 或 scalar,Paddle 只能为 Tensor 。 |
-| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
+| input | x | 表示输入的被除数 ,仅参数名不一致。 |
+| other | y | 表示输入的除数, PyTorch 可以为 Tensor 或 scalar,Paddle 只能为 Tensor 。 |
+| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.frac.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.frac.md
index 33aeee03b7b..98d41537678 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.frac.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.frac.md
@@ -17,8 +17,8 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.heaviside.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.heaviside.md
index bfb777195d5..90c881b5303 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.heaviside.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.heaviside.md
@@ -14,9 +14,9 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| values | y | 表示输入的 Tensor ,仅参数名不一致。 |
-| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| values | y | 表示输入的 Tensor ,仅参数名不一致。 |
+| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.hub.download_url_to_file.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.hub.download_url_to_file.md
index 8964a239bef..deaac673b21 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.hub.download_url_to_file.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.hub.download_url_to_file.md
@@ -20,7 +20,7 @@ paddle.utils.download.get_weights_path_from_url(url,
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
|url |url |下载的链接。|
-|dst |- |指定文件保存的绝对路径,例如:/tmp/temporary_file,Paddle 无此参数,暂无转写方式|
+|dst |- |指定文件保存的绝对路径,例如:/tmp/temporary_file,Paddle 无此参数,暂无转写方式。|
|hash_prefix |- |指定下载的 SHA256 文件的前缀,默认为 None,Paddle 无此参数,暂无转写方式。|
|progress |- |是否显示进度条,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。|
|- |md5sum |下载文件的 md5 值。PyTorch 无此参数,Paddle 保持默认即可。|
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.hub.help.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.hub.help.md
index 02a96b31c9f..c21ad9135a3 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.hub.help.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.hub.help.md
@@ -27,4 +27,4 @@ paddle.hub.help(repo_dir,
| force_reload | force_reload |指定是否强制拉取。 |
| skip_validation| - |检查由 github 参数指定的分支或提交是否属于存储库所有者,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。|
| trust_repo | - |在 v1.14 中被移除;Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。|
-|- |source |指定 repo 托管的位置,PyTorch 无此参数,Paddle 保持默认即可|
+|- |source |指定 repo 托管的位置,PyTorch 无此参数,Paddle 保持默认即可。|
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.hub.list.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.hub.list.md
index cde0282fb48..a6840b32cfc 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.hub.list.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.hub.list.md
@@ -25,4 +25,4 @@ paddle.hub.list(repo_dir,
| force_reload | force_reload |指定是否强制拉取,默认值: False。 |
| skip_validation| - |检查由 github 参数指定的分支或提交是否属于存储库所有者,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。|
| trust_repo | - |在 v1.14 中被移除;Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。|
-| - |source |指定 repo 托管的位置,PyTorch 无此参数,Paddle 保持默认即可|
+| - |source |指定 repo 托管的位置,PyTorch 无此参数,Paddle 保持默认即可。|
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.index_add.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.index_add.md
index b18f45f07dc..966334ca339 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.index_add.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.index_add.md
@@ -14,12 +14,12 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| dim | axis | 表示进行运算的轴,仅参数名不一致。 |
-| index | index | 包含索引下标的 1-D Tensor。 |
-| source | value | 被加的 Tensor,仅参数名不一致。 |
-| alpha | - | source 的 缩放倍数, Paddle 无此参数,需要转写。 Paddle 应将 alpha 和 source 的乘积作为 value。|
-| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| dim | axis | 表示进行运算的轴,仅参数名不一致。 |
+| index | index | 包含索引下标的 1-D Tensor。 |
+| source | value | 被加的 Tensor,仅参数名不一致。 |
+| alpha | - | source 的 缩放倍数, Paddle 无此参数,需要转写。 Paddle 应将 alpha 和 source 的乘积作为 value。|
+| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.inner.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.inner.md
index d0837f2d270..668cf08032d 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.inner.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.inner.md
@@ -15,9 +15,9 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 输入的 Tensor ,仅参数名不一致。 |
-| other | y | 输入的 Tensor ,仅参数名不一致。 |
-| out | - | 表示输出的 Tensor,Paddle 无此参数,需要转写。 |
+| input | x | 输入的 Tensor ,仅参数名不一致。 |
+| other | y | 输入的 Tensor ,仅参数名不一致。 |
+| out | - | 表示输出的 Tensor,Paddle 无此参数,需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.inverse.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.inverse.md
index a59adf1e0c3..562b7e1d72c 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.inverse.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.inverse.md
@@ -15,8 +15,8 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 输入的 Tensor ,仅参数名不一致。 |
-| out | - | 表示输出的 Tensor,Paddle 无此参数,需要转写。 |
+| input | x | 输入的 Tensor ,仅参数名不一致。 |
+| out | - | 表示输出的 Tensor,Paddle 无此参数,需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.isposinf.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.isposinf.md
index 0d0e6dcd6da..f9f4bc95654 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.isposinf.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.isposinf.md
@@ -18,7 +18,7 @@ Pytorch 相比 Paddle 支持更多其他参数,具体如下:
| input | x | 输入的 Tensor,仅参数名不一致。 |
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
-### 转写实例
+### 转写示例
#### out 参数:指定输出
```python
# Pytorch 写法
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.jit.load.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.jit.load.md
index b1520ef71db..e7606e72d94 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.jit.load.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.jit.load.md
@@ -15,7 +15,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------------------- |
-| f | path | PyTorch 为文件对象或文件名包含后缀,Paddle 为文件名不包含后缀,读取 .pdiparams,.pdmodel 等后缀文件。 |
+| f | path | PyTorch 为文件对象或文件名包含后缀,Paddle 为文件名不包含后缀,读取 .pdiparams,.pdmodel 等后缀文件。需要转写。 |
| map_location | - | 存储位置,Paddle 无此参数,暂无转写方式。 |
| \_extra_files | - | 额外加载的文件,Paddle 无此参数,暂无转写方式。 |
| - | configs | 其他用于兼容的载入配置选项,PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.ldexp.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.ldexp.md
index e60b7315a0b..16b5f7bca41 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.ldexp.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.ldexp.md
@@ -20,6 +20,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| out | - | 表示输出的 Tensor,Paddle 无此参数,需要转写。 |
### 转写示例
+#### out:输出的 Tensor
```python
# PyTorch 写法
torch.ldexp(a, b, out=output)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.lerp.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.lerp.md
index b88f69b645b..b6719da3c9f 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.lerp.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.lerp.md
@@ -21,10 +21,10 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| end | y | 表示输入的 Tensor ,仅参数名不一致。 |
-| weight | weight | 表示输入的 Tensor 。 |
-| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| end | y | 表示输入的 Tensor ,仅参数名不一致。 |
+| weight | weight | 表示输入的 Tensor 。 |
+| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.lgamma.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.lgamma.md
index 784201f2fcb..98ad7827640 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.lgamma.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.lgamma.md
@@ -17,8 +17,8 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.linalg.det.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.linalg.det.md
index 90d956ff713..9eea2ab4f36 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.linalg.det.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.linalg.det.md
@@ -14,8 +14,8 @@ torch 参数更多,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| A | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| out | - | 表示输出 Tensor, Paddle 无此参数,需要转写。 |
+| A | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| out | - | 表示输出 Tensor, Paddle 无此参数,需要转写。 |
### 转写示例
#### out:指定输出
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.linalg.eigh.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.linalg.eigh.md
index 90181d1fa09..bbf671ec3ac 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.linalg.eigh.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.linalg.eigh.md
@@ -16,7 +16,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | ------------------------------------------------ |
| input | x | 输入 Tensor,仅参数名不一致。 |
-| UPLO | UPLO | 表示计算上三角或者下三角矩阵 |
+| UPLO | UPLO | 表示计算上三角或者下三角矩阵。 |
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.linalg.eigvalsh.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.linalg.eigvalsh.md
index 6574290f334..461b5ad6675 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.linalg.eigvalsh.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.linalg.eigvalsh.md
@@ -16,7 +16,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | ---------------------------------------------------- |
| input | x | 输入 Tensor,仅参数名不一致。 |
-| UPLO | UPLO | 表示计算上三角或者下三角矩阵 |
+| UPLO | UPLO | 表示计算上三角或者下三角矩阵。 |
| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.log10.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.log10.md
index 3dab08a3b37..27643f0f1a6 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.log10.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.log10.md
@@ -17,8 +17,8 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.log1p.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.log1p.md
index 0c392c94fee..f8134b954a1 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.log1p.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.log1p.md
@@ -17,8 +17,8 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.logaddexp.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.logaddexp.md
index a853ffea51d..7bf4cec00b1 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.logaddexp.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.logaddexp.md
@@ -21,6 +21,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
### 转写示例
+#### out: 输出的 Tensor
```python
# PyTorch 写法
torch.logaddexp(a, b, out=output)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.lu.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.lu.md
index 3b6a918474e..c9e6b7b21fb 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.lu.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.lu.md
@@ -15,10 +15,10 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| A | x | 输入的 Tensor ,仅参数名不一致。 |
-| pivot | pivot | 输入的 bool ,参数完全一致。 |
-| get_infos | get_infos | 输入的 bool ,参数完全一致。 |
-| out | - | 表示输出的 Tensor,Paddle 无此参数,需要转写。 |
+| A | x | 输入的 Tensor ,仅参数名不一致。 |
+| pivot | pivot | 输入的 bool ,参数完全一致。 |
+| get_infos | get_infos | 输入的 bool ,参数完全一致。 |
+| out | - | 表示输出的 Tensor,Paddle 无此参数,需要转写。 |
### 转写示例
#### out:指定输出
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.lu_unpack.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.lu_unpack.md
index f0886c93463..ad4401ba1b2 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.lu_unpack.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.lu_unpack.md
@@ -15,11 +15,11 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| LU_data | x | 输入的 Tensor ,仅参数名不一致。 |
-| LU_pivots | y | 输入的 Tensor ,仅参数名不一致。 |
-| unpack_data | unpack_ludata | 输入的 bool ,仅参数名不一致。 |
-| unpack_pivots | unpack_pivots | 输入的 bool ,参数完全一致。 |
-| out | - | 表示输出的 Tensor,Paddle 无此参数,需要转写。 |
+| LU_data | x | 输入的 Tensor ,仅参数名不一致。 |
+| LU_pivots | y | 输入的 Tensor ,仅参数名不一致。 |
+| unpack_data | unpack_ludata | 输入的 bool ,仅参数名不一致。 |
+| unpack_pivots | unpack_pivots | 输入的 bool ,参数完全一致。 |
+| out | - | 表示输出的 Tensor,Paddle 无此参数,需要转写。 |
### 转写示例
#### out:指定输出
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.mm.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.mm.md
index 5a4843e3cf1..44b00b2a06b 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.mm.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.mm.md
@@ -20,7 +20,7 @@ PyTorch 相比 Paddle 支持更多其他参数,Paddle 多余参数保持默认
| ------------- | ------------ | ------------------------------------------------------ |
| input | input | 表示输入的第一个 Tensor。 |
| mat2 | mat2 | 表示输入的第二个 Tensor。 |
-| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
+| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nanmean.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nanmean.md
index eac898f1b29..2a92b28878d 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nanmean.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nanmean.md
@@ -28,7 +28,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| out | - | 表示输出的 Tensor,可选项,Paddle 无此参数,需要转写。 |
### 转写示例
-#### dytpe:指定数据类型
+#### dtype:指定数据类型
```python
# PyTorch 写法
torch.nanmean(x, dim=-1, dtype=torch.float32,out=y)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.BCELoss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.BCELoss.md
index 5cd295e7960..e7df932c668 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.BCELoss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.BCELoss.md
@@ -25,68 +25,64 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| reduction | reduction | 表示应用于输出结果的计算方式。 |
### 转写示例
+
#### size_average
size_average 为 True
```python
# PyTorch 写法
-torch.nn.BCELoss(weight=w, size_average=True)
+torch.nn.BCELoss(size_average=True)
# Paddle 写法
-paddle.nn.BCELoss(weight=w, reduction='mean')
+paddle.nn.BCELoss(reduction='mean')
```
size_average 为 False
```python
# PyTorch 写法
-torch.nn.BCELoss(weight=w, size_average=False)
+torch.nn.BCELoss(size_average=False)
# Paddle 写法
-paddle.nn.BCELoss(weight=w, reduction='sum')
+paddle.nn.BCELoss(reduction='sum')
```
-
#### reduce
reduce 为 True
```python
# PyTorch 写法
-torch.nn.BCELoss(weight=w, reduce=True)
+torch.nn.BCELoss(size_average=False)
# Paddle 写法
-paddle.nn.BCELoss(weight=w, reduction='mean')
+paddle.nn.BCELoss(reduction='sum')
```
-
reduce 为 False
```python
# PyTorch 写法
-torch.nn.BCELoss(weight=w, reduce=False)
+torch.nn.BCELoss(reduce=False)
# Paddle 写法
-paddle.nn.BCELoss(weight=w, reduction='none')
+paddle.nn.BCELoss(reduction='none')
```
-
#### reduction
reduction 为'none'
```python
# PyTorch 写法
-torch.nn.BCELoss(weight=w, reduction='none')
+torch.nn.BCELoss(reduction='none')
# Paddle 写法
-paddle.nn.BCELoss(weight=w, reduction='none')
+paddle.nn.BCELoss(reduction='none')
```
-
reduction 为'mean'
```python
# PyTorch 写法
-torch.nn.BCELoss(weight=w, reduction='mean')
+torch.nn.BCELoss(reduction='mean')
# Paddle 写法
-paddle.nn.BCELoss(weight=w, reduction='mean')
+paddle.nn.BCELoss(reduction='mean')
```
-
reduction 为'sum'
```python
# PyTorch 写法
-torch.nn.BCELoss(weight=w, reduction='sum')
+torch.nn.BCELoss(reduction='sum')
# Paddle 写法
-paddle.nn.BCELoss(weight=w, reduction='sum')
+paddle.nn.BCELoss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.BCEWithLogitsLoss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.BCEWithLogitsLoss.md
index a05a0bc8ffe..e90c8fec52d 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.BCEWithLogitsLoss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.BCEWithLogitsLoss.md
@@ -28,68 +28,64 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| pos_weight | pos_weight | 表示正类的权重。 |
### 转写示例
+
#### size_average
size_average 为 True
```python
# PyTorch 写法
-torch.nn.BCEWithLogitsLoss(weight=w, size_average=True)
+torch.nn.BCEWithLogitsLoss(size_average=True)
# Paddle 写法
-paddle.nn.BCEWithLogitsLoss(weight=w, reduction='mean')
+paddle.nn.BCEWithLogitsLoss(reduction='mean')
```
size_average 为 False
```python
# PyTorch 写法
-torch.nn.BCEWithLogitsLoss(weight=w, size_average=False)
+torch.nn.BCEWithLogitsLoss(size_average=False)
# Paddle 写法
-paddle.nn.BCEWithLogitsLoss(weight=w, reduction='sum')
+paddle.nn.BCEWithLogitsLoss(reduction='sum')
```
-
#### reduce
reduce 为 True
```python
# PyTorch 写法
-torch.nn.BCEWithLogitsLoss(weight=w, reduce=True)
+torch.nn.BCEWithLogitsLoss(size_average=False)
# Paddle 写法
-paddle.nn.BCEWithLogitsLoss(weight=w, reduction='mean')
+paddle.nn.BCEWithLogitsLoss(reduction='sum')
```
-
reduce 为 False
```python
# PyTorch 写法
-torch.nn.BCEWithLogitsLoss(weight=w, reduce=False)
+torch.nn.BCEWithLogitsLoss(reduce=False)
# Paddle 写法
-paddle.nn.BCEWithLogitsLoss(weight=w, reduction='none')
+paddle.nn.BCEWithLogitsLoss(reduction='none')
```
-
#### reduction
reduction 为'none'
```python
# PyTorch 写法
-torch.nn.BCEWithLogitsLoss(weight=w, reduction='none')
+torch.nn.BCEWithLogitsLoss(reduction='none')
# Paddle 写法
-paddle.nn.BCEWithLogitsLoss(weight=w, reduction='none')
+paddle.nn.BCEWithLogitsLoss(reduction='none')
```
-
reduction 为'mean'
```python
# PyTorch 写法
-torch.nn.BCEWithLogitsLoss(weight=w, reduction='mean')
+torch.nn.BCEWithLogitsLoss(reduction='mean')
# Paddle 写法
-paddle.nn.BCEWithLogitsLoss(weight=w, reduction='mean')
+paddle.nn.BCEWithLogitsLoss(reduction='mean')
```
-
reduction 为'sum'
```python
# PyTorch 写法
-torch.nn.BCEWithLogitsLoss(weight=w, reduction='sum')
+torch.nn.BCEWithLogitsLoss(reduction='sum')
# Paddle 写法
-paddle.nn.BCEWithLogitsLoss(weight=w, reduction='sum')
+paddle.nn.BCEWithLogitsLoss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.Bilinear.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.Bilinear.md
index ee77922747b..0efa0c08c42 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.Bilinear.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.Bilinear.md
@@ -19,8 +19,8 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| in2_features | in2_features | 每个 x2 元素的维度。 |
| out_features | out_features | 输出张量的维度。 |
| bias | bias_attr | 指定偏置参数属性的对象,Paddle 支持更多功能,同时支持 bool 用法。 |
-| device | - | Tensor 的设备,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
-| dtype | - | Tensor 的数据类型,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除 |
+| device | - | Tensor 的设备,Paddle 无此参数,一般对网络训练结果影响不大,需要转写。 |
+| dtype | - | Tensor 的数据类型,Paddle 无此参数,一般对网络训练结果影响不大,需要转写。 |
| - | weight_attr | 指定权重参数属性的对象,PyTorch 无此参数,Paddle 保持默认即可。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.CosineEmbeddingLoss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.CosineEmbeddingLoss.md
index 5f58e0303aa..4571ec022c9 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.CosineEmbeddingLoss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.CosineEmbeddingLoss.md
@@ -16,80 +16,69 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------ | ------------ | ---------------------------------------------- |
| margin | margin | 可以设置的范围为[-1, 1]。 |
-| size_average | - | 已废弃,和 reduce 组合决定损失计算方式。 |
-| reduce | - | 已废弃,和 size_average 组合决定损失计算方式。 |
+| size_average | - | 已废弃,和 reduce 组合决定损失计算方式。 需要转写。 |
+| reduce | - | 已废弃,和 size_average 组合决定损失计算方式。需要转写。 |
| reduction | reduction | 指定应用于输出结果的计算方式。 |
### 转写示例
+
#### size_average
size_average 为 True
-
```python
# PyTorch 写法
-torch.nn.CosineEmbeddingLoss(weight=w, size_average=True)
+torch.nn.CosineEmbeddingLoss(size_average=True)
# Paddle 写法
-paddle.nn.CosineEmbeddingLoss(weight=w, reduction='mean')
+paddle.nn.CosineEmbeddingLoss(reduction='mean')
```
size_average 为 False
-
```python
# PyTorch 写法
-torch.nn.CosineEmbeddingLoss(weight=w, size_average=False)
+torch.nn.CosineEmbeddingLoss(size_average=False)
# Paddle 写法
-paddle.nn.CosineEmbeddingLoss(weight=w, reduction='sum')
+paddle.nn.CosineEmbeddingLoss(reduction='sum')
```
-
#### reduce
reduce 为 True
-
```python
# PyTorch 写法
-torch.nn.CosineEmbeddingLoss(weight=w, reduce=True)
+torch.nn.CosineEmbeddingLoss(size_average=False)
# Paddle 写法
-paddle.nn.CosineEmbeddingLoss(weight=w, reduction='mean')
+paddle.nn.CosineEmbeddingLoss(reduction='sum')
```
-
reduce 为 False
-
```python
# PyTorch 写法
-torch.nn.CosineEmbeddingLoss(weight=w, reduce=False)
+torch.nn.CosineEmbeddingLoss(reduce=False)
# Paddle 写法
-paddle.nn.CosineEmbeddingLoss(weight=w, reduction='none')
+paddle.nn.CosineEmbeddingLoss(reduction='none')
```
-
#### reduction
reduction 为'none'
-
```python
# PyTorch 写法
-torch.nn.CosineEmbeddingLoss(weight=w, reduction='none')
+torch.nn.CosineEmbeddingLoss(reduction='none')
# Paddle 写法
-paddle.nn.CosineEmbeddingLoss(weight=w, reduction='none')
+paddle.nn.CosineEmbeddingLoss(reduction='none')
```
-
reduction 为'mean'
-
```python
# PyTorch 写法
-torch.nn.CosineEmbeddingLoss(weight=w, reduction='mean')
+torch.nn.CosineEmbeddingLoss(reduction='mean')
# Paddle 写法
-paddle.nn.CosineEmbeddingLoss(weight=w, reduction='mean')
+paddle.nn.CosineEmbeddingLoss(reduction='mean')
```
-
reduction 为'sum'
-
```python
# PyTorch 写法
-torch.nn.CosineEmbeddingLoss(weight=w, reduction='sum')
+torch.nn.CosineEmbeddingLoss(reduction='sum')
# Paddle 写法
-paddle.nn.CosineEmbeddingLoss(weight=w, reduction='sum')
+paddle.nn.CosineEmbeddingLoss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.CrossEntropyLoss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.CrossEntropyLoss.md
index f6b69e18ead..966eed5ecf8 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.CrossEntropyLoss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.CrossEntropyLoss.md
@@ -36,68 +36,64 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| - | axis | 进行 softmax 计算的维度索引,PyTorch 无此参数,Paddle 保持默认即可。 |
### 转写示例
+
#### size_average
size_average 为 True
```python
# PyTorch 写法
-torch.nn.CrossEntropyLoss(weight=w, size_average=True)
+torch.nn.CrossEntropyLoss(size_average=True)
# Paddle 写法
-paddle.nn.CrossEntropyLoss(weight=w, reduction='mean')
+paddle.nn.CrossEntropyLoss(reduction='mean')
```
size_average 为 False
```python
# PyTorch 写法
-torch.nn.CrossEntropyLoss(weight=w, size_average=False)
+torch.nn.CrossEntropyLoss(size_average=False)
# Paddle 写法
-paddle.nn.CrossEntropyLoss(weight=w, reduction='sum')
+paddle.nn.CrossEntropyLoss(reduction='sum')
```
-
#### reduce
reduce 为 True
```python
# PyTorch 写法
-torch.nn.CrossEntropyLoss(weight=w, reduce=True)
+torch.nn.CrossEntropyLoss(size_average=False)
# Paddle 写法
-paddle.nn.CrossEntropyLoss(weight=w, reduction='mean')
+paddle.nn.CrossEntropyLoss(reduction='sum')
```
-
reduce 为 False
```python
# PyTorch 写法
-torch.nn.CrossEntropyLoss(weight=w, reduce=False)
+torch.nn.CrossEntropyLoss(reduce=False)
# Paddle 写法
-paddle.nn.CrossEntropyLoss(weight=w, reduction='none')
+paddle.nn.CrossEntropyLoss(reduction='none')
```
-
#### reduction
reduction 为'none'
```python
# PyTorch 写法
-torch.nn.CrossEntropyLoss(weight=w, reduction='none')
+torch.nn.CrossEntropyLoss(reduction='none')
# Paddle 写法
-paddle.nn.CrossEntropyLoss(weight=w, reduction='none')
+paddle.nn.CrossEntropyLoss(reduction='none')
```
-
reduction 为'mean'
```python
# PyTorch 写法
-torch.nn.CrossEntropyLoss(weight=w, reduction='mean')
+torch.nn.CrossEntropyLoss(reduction='mean')
# Paddle 写法
-paddle.nn.CrossEntropyLoss(weight=w, reduction='mean')
+paddle.nn.CrossEntropyLoss(reduction='mean')
```
-
reduction 为'sum'
```python
# PyTorch 写法
-torch.nn.CrossEntropyLoss(weight=w, reduction='sum')
+torch.nn.CrossEntropyLoss(reduction='sum')
# Paddle 写法
-paddle.nn.CrossEntropyLoss(weight=w, reduction='sum')
+paddle.nn.CrossEntropyLoss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.DataParallel.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.DataParallel.md
index 3480e63bdd1..ab0996befd9 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.DataParallel.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.DataParallel.md
@@ -23,9 +23,9 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| module | layers | 需要通过数据并行方式执行的模型。 |
-| device_ids | - | 表示训练在哪几块 GPU 上,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
+| device_ids | - | 表示训练在哪几块 GPU 上,Paddle 无此参数,需要转写。 |
| output_device | - | 表示结果输出在哪一块 GPU 上,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
-| dim | - | 表示哪一维度上的数据进行划分,Paddle 无此参数。 |
+| dim | - | 表示哪一维度上的数据进行划分,Paddle 无此参数。暂无转写方式。 |
| - | strategy | PaddlePaddle 即将废弃参数。 |
| - | comm_buffer_size | 它是通信调用(如 NCCLAllReduce)时,参数梯度聚合为一组的内存大小(MB),PyTorch 无此参数,Paddle 保持默认即可。 |
| - | last_comm_buffer_size | 它限制通信调用中最后一个缓冲区的内存大小(MB),PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.FractionalMaxPool2d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.FractionalMaxPool2d.md
index 24a55d757c7..26db2d5a090 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.FractionalMaxPool2d.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.FractionalMaxPool2d.md
@@ -16,7 +16,7 @@ PyTorch 参数更多,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| kernel_size | kernel_size | 表示核大小。参数完全一致。 |
-| output_size | output_size | 表示目标输出尺寸,PyTorch 为可选参数,Paddle 为必选参数,参数默认值不一致。PyTorch 的 output_size 与 output_ratio 输入二选一,如不输入 output_size,则必须输入 output_ratio,此时需要转写。转写方式与下文 output_ratio 一致。 |
+| output_size | output_size | 表示目标输出尺寸,PyTorch 为可选参数,Paddle 为必选参数,参数默认值不一致。PyTorch 的 output_size 与 output_ratio 输入二选一,如不输入 output_size,则必须输入 output_ratio,此时转写方式与下文 output_ratio 一致。 |
| output_ratio | - | 表示目标输出比例。Paddle 无此参数,需要转写。 |
| return_indices | return_mask | 表示是否返回最大值索引。仅参数名不一致。 |
| _random_samples | random_u | 表示随机数。PyTorch 以列表形式的 Tensor 方式传入,Paddle 以 float 的方式传入,如果 PyTorch 的多个随机数相同,需要转写,如果 PyTorch 的多个随机数不同,暂无转写方式。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.FractionalMaxPool3d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.FractionalMaxPool3d.md
index e0089c3ad36..cc3a47e3285 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.FractionalMaxPool3d.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.FractionalMaxPool3d.md
@@ -16,7 +16,7 @@ PyTorch 参数更多,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| kernel_size | kernel_size | 表示核大小。参数完全一致。 |
-| output_size | output_size | 表示目标输出尺寸,PyTorch 为可选参数,Paddle 为必选参数,参数默认值不一致。PyTorch 的 output_size 与 output_ratio 输入二选一,如不输入 output_size,则必须输入 output_ratio,此时需要转写。转写方式与下文 output_ratio 一致。 |
+| output_size | output_size | 表示目标输出尺寸,PyTorch 为可选参数,Paddle 为必选参数,参数默认值不一致。PyTorch 的 output_size 与 output_ratio 输入二选一,如不输入 output_size,则必须输入 output_ratio,此时转写方式与下文 output_ratio 一致。 |
| output_ratio | - | 表示目标输出比例。Paddle 无此参数,需要转写。 |
| return_indices | return_mask | 表示是否返回最大值索引。仅参数名不一致。 |
| _random_samples | random_u | 表示随机数。PyTorch 以列表形式的 Tensor 方式传入,Paddle 以 float 的方式传入,如果 PyTorch 的多个随机数相同,需要转写,如果 PyTorch 的多个随机数不同,暂无转写方式。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.GroupNorm.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.GroupNorm.md
index 95886730727..db2b6ad435d 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.GroupNorm.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.GroupNorm.md
@@ -28,8 +28,8 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| ------------- | ------------ | ------------------------------------------------------ |
| eps | epsilon | 为了数值稳定加在分母上的值。 |
| affine | - | 是否进行仿射变换,Paddle 无此参数,需要转写。 |
-| device | - | 设备类型,Paddle 无此参数。 |
-| dtype | - | 参数类型,Paddle 无此参数。 |
+| device | - | 设备类型,Paddle 无此参数。暂无转写方式。 |
+| dtype | - | 参数类型,Paddle 无此参数。暂无转写方式。 |
| - | weight_attr | 指定权重参数属性的对象。如果为 False, 则表示每个通道的伸缩固定为 1,不可改变。默认值为 None,表示使用默认的权重参数属性。 |
| - | bias_attr | 指定偏置参数属性的对象。如果为 False, 则表示每一个通道的偏移固定为 0,不可改变。默认值为 None,表示使用默认的偏置参数属性。 |
| - | data_format | 指定输入数据格式,PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.HingeEmbeddingLoss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.HingeEmbeddingLoss.md
index b098c562767..e9dd613cd27 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.HingeEmbeddingLoss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.HingeEmbeddingLoss.md
@@ -26,75 +26,64 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| reduction | reduction | 表示应用于输出结果的计算方式。 |
### 转写示例
+
#### size_average
size_average 为 True
-
```python
# PyTorch 写法
-torch.nn.HingeEmbeddingLoss(weight=w, size_average=True)
+torch.nn.HingeEmbeddingLoss(size_average=True)
# Paddle 写法
-paddle.nn.HingeEmbeddingLoss(weight=w, reduction='mean')
+paddle.nn.HingeEmbeddingLoss(reduction='mean')
```
size_average 为 False
-
```python
# PyTorch 写法
-torch.nn.HingeEmbeddingLoss(weight=w, size_average=False)
+torch.nn.HingeEmbeddingLoss(size_average=False)
# Paddle 写法
-paddle.nn.HingeEmbeddingLoss(weight=w, reduction='sum')
+paddle.nn.HingeEmbeddingLoss(reduction='sum')
```
-
#### reduce
reduce 为 True
-
```python
# PyTorch 写法
-torch.nn.HingeEmbeddingLoss(weight=w, reduce=True)
+torch.nn.HingeEmbeddingLoss(size_average=False)
# Paddle 写法
-paddle.nn.HingeEmbeddingLoss(weight=w, reduction='mean')
+paddle.nn.HingeEmbeddingLoss(reduction='sum')
```
-
reduce 为 False
-
```python
# PyTorch 写法
-torch.nn.HingeEmbeddingLoss(weight=w, reduce=False)
+torch.nn.HingeEmbeddingLoss(reduce=False)
# Paddle 写法
-paddle.nn.HingeEmbeddingLoss(weight=w, reduction='none')
+paddle.nn.HingeEmbeddingLoss(reduction='none')
```
-
#### reduction
reduction 为'none'
-
```python
# PyTorch 写法
-torch.nn.HingeEmbeddingLoss(weight=w, reduction='none')
+torch.nn.HingeEmbeddingLoss(reduction='none')
# Paddle 写法
-paddle.nn.HingeEmbeddingLoss(weight=w, reduction='none')
+paddle.nn.HingeEmbeddingLoss(reduction='none')
```
-
reduction 为'mean'
-
```python
# PyTorch 写法
-torch.nn.HingeEmbeddingLoss(weight=w, reduction='mean')
+torch.nn.HingeEmbeddingLoss(reduction='mean')
# Paddle 写法
-paddle.nn.HingeEmbeddingLoss(weight=w, reduction='mean')
+paddle.nn.HingeEmbeddingLoss(reduction='mean')
```
-
reduction 为'sum'
-
```python
# PyTorch 写法
-torch.nn.HingeEmbeddingLoss(weight=w, reduction='sum')
+torch.nn.HingeEmbeddingLoss(reduction='sum')
# Paddle 写法
-paddle.nn.HingeEmbeddingLoss(weight=w, reduction='sum')
+paddle.nn.HingeEmbeddingLoss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.KLDivLoss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.KLDivLoss.md
index a80b9250c6c..a7060ffcaf6 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.KLDivLoss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.KLDivLoss.md
@@ -24,75 +24,64 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| log_target | log_target | 指定目标是否属于 log 空间。 |
### 转写示例
+
#### size_average
size_average 为 True
-
```python
# PyTorch 写法
-torch.nn.KLDivLoss(weight=w, size_average=True)
+torch.nn.KLDivLoss(size_average=True)
# Paddle 写法
-paddle.nn.KLDivLoss(weight=w, reduction='mean')
+paddle.nn.KLDivLoss(reduction='mean')
```
size_average 为 False
-
```python
# PyTorch 写法
-torch.nn.KLDivLoss(weight=w, size_average=False)
+torch.nn.KLDivLoss(size_average=False)
# Paddle 写法
-paddle.nn.KLDivLoss(weight=w, reduction='sum')
+paddle.nn.KLDivLoss(reduction='sum')
```
-
#### reduce
reduce 为 True
-
```python
# PyTorch 写法
-torch.nn.KLDivLoss(weight=w, reduce=True)
+torch.nn.KLDivLoss(size_average=False)
# Paddle 写法
-paddle.nn.KLDivLoss(weight=w, reduction='mean')
+paddle.nn.KLDivLoss(reduction='sum')
```
-
reduce 为 False
-
```python
# PyTorch 写法
-torch.nn.KLDivLoss(weight=w, reduce=False)
+torch.nn.KLDivLoss(reduce=False)
# Paddle 写法
-paddle.nn.KLDivLoss(weight=w, reduction='none')
+paddle.nn.KLDivLoss(reduction='none')
```
-
#### reduction
reduction 为'none'
-
```python
# PyTorch 写法
-torch.nn.KLDivLoss(weight=w, reduction='none')
+torch.nn.KLDivLoss(reduction='none')
# Paddle 写法
-paddle.nn.KLDivLoss(weight=w, reduction='none')
+paddle.nn.KLDivLoss(reduction='none')
```
-
reduction 为'mean'
-
```python
# PyTorch 写法
-torch.nn.KLDivLoss(weight=w, reduction='mean')
+torch.nn.KLDivLoss(reduction='mean')
# Paddle 写法
-paddle.nn.KLDivLoss(weight=w, reduction='mean')
+paddle.nn.KLDivLoss(reduction='mean')
```
-
reduction 为'sum'
-
```python
# PyTorch 写法
-torch.nn.KLDivLoss(weight=w, reduction='sum')
+torch.nn.KLDivLoss(reduction='sum')
# Paddle 写法
-paddle.nn.KLDivLoss(weight=w, reduction='sum')
+paddle.nn.KLDivLoss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.L1Loss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.L1Loss.md
index c7155ebfc1c..759a8584090 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.L1Loss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.L1Loss.md
@@ -17,14 +17,14 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| size_average | - | 已弃用。 |
-| reduce | - | 已弃用。 |
+| size_average | - | 已弃用。需要转写。 |
+| reduce | - | 已弃用。需要转写。 |
| reduction | reduction | 表示对输出结果的计算方式。 |
### 转写示例
+
#### size_average
size_average 为 True
-
```python
# PyTorch 写法
torch.nn.L1Loss(size_average=True)
@@ -34,7 +34,6 @@ paddle.nn.L1Loss(reduction='mean')
```
size_average 为 False
-
```python
# PyTorch 写法
torch.nn.L1Loss(size_average=False)
@@ -42,20 +41,16 @@ torch.nn.L1Loss(size_average=False)
# Paddle 写法
paddle.nn.L1Loss(reduction='sum')
```
-
#### reduce
reduce 为 True
-
```python
# PyTorch 写法
-torch.nn.L1Loss(reduce=True)
+torch.nn.L1Loss(size_average=False)
# Paddle 写法
-paddle.nn.L1Loss(reduction='mean')
+paddle.nn.L1Loss(reduction='sum')
```
-
reduce 为 False
-
```python
# PyTorch 写法
torch.nn.L1Loss(reduce=False)
@@ -63,10 +58,8 @@ torch.nn.L1Loss(reduce=False)
# Paddle 写法
paddle.nn.L1Loss(reduction='none')
```
-
#### reduction
reduction 为'none'
-
```python
# PyTorch 写法
torch.nn.L1Loss(reduction='none')
@@ -74,9 +67,7 @@ torch.nn.L1Loss(reduction='none')
# Paddle 写法
paddle.nn.L1Loss(reduction='none')
```
-
reduction 为'mean'
-
```python
# PyTorch 写法
torch.nn.L1Loss(reduction='mean')
@@ -84,9 +75,7 @@ torch.nn.L1Loss(reduction='mean')
# Paddle 写法
paddle.nn.L1Loss(reduction='mean')
```
-
reduction 为'sum'
-
```python
# PyTorch 写法
torch.nn.L1Loss(reduction='sum')
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MSELoss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MSELoss.md
index adfef1dfc58..9460311a27a 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MSELoss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MSELoss.md
@@ -16,14 +16,14 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| size_average | - | 已弃用。 |
-| reduce | - | 已弃用。 |
+| size_average | - | 已弃用。需要转写。 |
+| reduce | - | 已弃用。需要转写。 |
| reduction | reduction | 表示对输出结果的计算方式。 |
### 转写示例
+
#### size_average
size_average 为 True
-
```python
# PyTorch 写法
torch.nn.MSELoss(size_average=True)
@@ -33,7 +33,6 @@ paddle.nn.MSELoss(reduction='mean')
```
size_average 为 False
-
```python
# PyTorch 写法
torch.nn.MSELoss(size_average=False)
@@ -41,20 +40,16 @@ torch.nn.MSELoss(size_average=False)
# Paddle 写法
paddle.nn.MSELoss(reduction='sum')
```
-
#### reduce
reduce 为 True
-
```python
# PyTorch 写法
-torch.nn.MSELoss(reduce=True)
+torch.nn.MSELoss(size_average=False)
# Paddle 写法
-paddle.nn.MSELoss(reduction='mean')
+paddle.nn.MSELoss(reduction='sum')
```
-
reduce 为 False
-
```python
# PyTorch 写法
torch.nn.MSELoss(reduce=False)
@@ -62,10 +57,8 @@ torch.nn.MSELoss(reduce=False)
# Paddle 写法
paddle.nn.MSELoss(reduction='none')
```
-
#### reduction
reduction 为'none'
-
```python
# PyTorch 写法
torch.nn.MSELoss(reduction='none')
@@ -73,9 +66,7 @@ torch.nn.MSELoss(reduction='none')
# Paddle 写法
paddle.nn.MSELoss(reduction='none')
```
-
reduction 为'mean'
-
```python
# PyTorch 写法
torch.nn.MSELoss(reduction='mean')
@@ -83,9 +74,7 @@ torch.nn.MSELoss(reduction='mean')
# Paddle 写法
paddle.nn.MSELoss(reduction='mean')
```
-
reduction 为'sum'
-
```python
# PyTorch 写法
torch.nn.MSELoss(reduction='sum')
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MarginRankingLoss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MarginRankingLoss.md
index e6e92148b17..587c2362090 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MarginRankingLoss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MarginRankingLoss.md
@@ -26,75 +26,64 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| reduction | reduction | 表示应用于输出结果的计算方式。 |
### 转写示例
+
#### size_average
size_average 为 True
-
```python
# PyTorch 写法
-torch.nn.MarginRankingLoss(weight=w, size_average=True)
+torch.nn.MarginRankingLoss(size_average=True)
# Paddle 写法
-paddle.nn.MarginRankingLoss(weight=w, reduction='mean')
+paddle.nn.MarginRankingLoss(reduction='mean')
```
size_average 为 False
-
```python
# PyTorch 写法
-torch.nn.MarginRankingLoss(weight=w, size_average=False)
+torch.nn.MarginRankingLoss(size_average=False)
# Paddle 写法
-paddle.nn.MarginRankingLoss(weight=w, reduction='sum')
+paddle.nn.MarginRankingLoss(reduction='sum')
```
-
#### reduce
reduce 为 True
-
```python
# PyTorch 写法
-torch.nn.MarginRankingLoss(weight=w, reduce=True)
+torch.nn.MarginRankingLoss(size_average=False)
# Paddle 写法
-paddle.nn.MarginRankingLoss(weight=w, reduction='mean')
+paddle.nn.MarginRankingLoss(reduction='sum')
```
-
reduce 为 False
-
```python
# PyTorch 写法
-torch.nn.MarginRankingLoss(weight=w, reduce=False)
+torch.nn.MarginRankingLoss(reduce=False)
# Paddle 写法
-paddle.nn.MarginRankingLoss(weight=w, reduction='none')
+paddle.nn.MarginRankingLoss(reduction='none')
```
-
#### reduction
reduction 为'none'
-
```python
# PyTorch 写法
-torch.nn.MarginRankingLoss(weight=w, reduction='none')
+torch.nn.MarginRankingLoss(reduction='none')
# Paddle 写法
-paddle.nn.MarginRankingLoss(weight=w, reduction='none')
+paddle.nn.MarginRankingLoss(reduction='none')
```
-
reduction 为'mean'
-
```python
# PyTorch 写法
-torch.nn.MarginRankingLoss(weight=w, reduction='mean')
+torch.nn.MarginRankingLoss(reduction='mean')
# Paddle 写法
-paddle.nn.MarginRankingLoss(weight=w, reduction='mean')
+paddle.nn.MarginRankingLoss(reduction='mean')
```
-
reduction 为'sum'
-
```python
# PyTorch 写法
-torch.nn.MarginRankingLoss(weight=w, reduction='sum')
+torch.nn.MarginRankingLoss(reduction='sum')
# Paddle 写法
-paddle.nn.MarginRankingLoss(weight=w, reduction='sum')
+paddle.nn.MarginRankingLoss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MultiLabelMarginLoss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MultiLabelMarginLoss.md
index e21e9406749..24b30ca6a0a 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MultiLabelMarginLoss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MultiLabelMarginLoss.md
@@ -15,80 +15,69 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------ | ------------ | ---------------------------------------------- |
-| size_average | - | 已废弃,和 reduce 组合决定损失计算方式。 |
-| reduce | - | 已废弃,和 size_average 组合决定损失计算方式。 |
+| size_average | - | 已废弃,和 reduce 组合决定损失计算方式,需要转写。 |
+| reduce | - | 已废弃,和 size_average 组合决定损失计算方式,需要转写。 |
| reduction | reduction | 指定应用于输出结果的计算方式。 |
### 转写示例
+
#### size_average
size_average 为 True
-
```python
# PyTorch 写法
-torch.nn.MultiLabelMarginLoss(weight=w, size_average=True)
+torch.nn.MultiLabelMarginLoss(size_average=True)
# Paddle 写法
-paddle.nn.MultiLabelMarginLoss(weight=w, reduction='mean')
+paddle.nn.MultiLabelMarginLoss(reduction='mean')
```
size_average 为 False
-
```python
# PyTorch 写法
-torch.nn.MultiLabelMarginLoss(weight=w, size_average=False)
+torch.nn.MultiLabelMarginLoss(size_average=False)
# Paddle 写法
-paddle.nn.MultiLabelMarginLoss(weight=w, reduction='sum')
+paddle.nn.MultiLabelMarginLoss(reduction='sum')
```
-
#### reduce
reduce 为 True
-
```python
# PyTorch 写法
-torch.nn.MultiLabelMarginLoss(weight=w, reduce=True)
+torch.nn.MultiLabelMarginLoss(size_average=False)
# Paddle 写法
-paddle.nn.MultiLabelMarginLoss(weight=w, reduction='mean')
+paddle.nn.MultiLabelMarginLoss(reduction='sum')
```
-
reduce 为 False
-
```python
# PyTorch 写法
-torch.nn.MultiLabelMarginLoss(weight=w, reduce=False)
+torch.nn.MultiLabelMarginLoss(reduce=False)
# Paddle 写法
-paddle.nn.MultiLabelMarginLoss(weight=w, reduction='none')
+paddle.nn.MultiLabelMarginLoss(reduction='none')
```
-
#### reduction
reduction 为'none'
-
```python
# PyTorch 写法
-torch.nn.MultiLabelMarginLoss(weight=w, reduction='none')
+torch.nn.MultiLabelMarginLoss(reduction='none')
# Paddle 写法
-paddle.nn.MultiLabelMarginLoss(weight=w, reduction='none')
+paddle.nn.MultiLabelMarginLoss(reduction='none')
```
-
reduction 为'mean'
-
```python
# PyTorch 写法
-torch.nn.MultiLabelMarginLoss(weight=w, reduction='mean')
+torch.nn.MultiLabelMarginLoss(reduction='mean')
# Paddle 写法
-paddle.nn.MultiLabelMarginLoss(weight=w, reduction='mean')
+paddle.nn.MultiLabelMarginLoss(reduction='mean')
```
-
reduction 为'sum'
-
```python
# PyTorch 写法
-torch.nn.MultiLabelMarginLoss(weight=w, reduction='sum')
+torch.nn.MultiLabelMarginLoss(reduction='sum')
# Paddle 写法
-paddle.nn.MultiLabelMarginLoss(weight=w, reduction='sum')
+paddle.nn.MultiLabelMarginLoss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MultiLabelSoftMarginLoss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MultiLabelSoftMarginLoss.md
index 604265f4e40..e00caea7c75 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MultiLabelSoftMarginLoss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MultiLabelSoftMarginLoss.md
@@ -16,80 +16,69 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------ | ------------ | ---------------------------------------------- |
| weight | weight | 手动设定权重。 |
-| size_average | - | 已废弃,和 reduce 组合决定损失计算方式。 |
-| reduce | - | 已废弃,和 size_average 组合决定损失计算方式。 |
+| size_average | - | 已废弃,和 reduce 组合决定损失计算方式。需要转写。 |
+| reduce | - | 已废弃,和 size_average 组合决定损失计算方式。需要转写。 |
| reduction | reduction | 指定应用于输出结果的计算方式。 |
### 转写示例
+
#### size_average
size_average 为 True
-
```python
# PyTorch 写法
-torch.nn.MultiLabelSoftMarginLoss(weight=w, size_average=True)
+torch.nn.MultiLabelSoftMarginLoss(size_average=True)
# Paddle 写法
-paddle.nn.MultiLabelSoftMarginLoss(weight=w, reduction='mean')
+paddle.nn.MultiLabelSoftMarginLoss(reduction='mean')
```
size_average 为 False
-
```python
# PyTorch 写法
-torch.nn.MultiLabelSoftMarginLoss(weight=w, size_average=False)
+torch.nn.MultiLabelSoftMarginLoss(size_average=False)
# Paddle 写法
-paddle.nn.MultiLabelSoftMarginLoss(weight=w, reduction='sum')
+paddle.nn.MultiLabelSoftMarginLoss(reduction='sum')
```
-
#### reduce
reduce 为 True
-
```python
# PyTorch 写法
-torch.nn.MultiLabelSoftMarginLoss(weight=w, reduce=True)
+torch.nn.MultiLabelSoftMarginLoss(size_average=False)
# Paddle 写法
-paddle.nn.MultiLabelSoftMarginLoss(weight=w, reduction='mean')
+paddle.nn.MultiLabelSoftMarginLoss(reduction='sum')
```
-
reduce 为 False
-
```python
# PyTorch 写法
-torch.nn.MultiLabelSoftMarginLoss(weight=w, reduce=False)
+torch.nn.MultiLabelSoftMarginLoss(reduce=False)
# Paddle 写法
-paddle.nn.MultiLabelSoftMarginLoss(weight=w, reduction='none')
+paddle.nn.MultiLabelSoftMarginLoss(reduction='none')
```
-
#### reduction
reduction 为'none'
-
```python
# PyTorch 写法
-torch.nn.MultiLabelSoftMarginLoss(weight=w, reduction='none')
+torch.nn.MultiLabelSoftMarginLoss(reduction='none')
# Paddle 写法
-paddle.nn.MultiLabelSoftMarginLoss(weight=w, reduction='none')
+paddle.nn.MultiLabelSoftMarginLoss(reduction='none')
```
-
reduction 为'mean'
-
```python
# PyTorch 写法
-torch.nn.MultiLabelSoftMarginLoss(weight=w, reduction='mean')
+torch.nn.MultiLabelSoftMarginLoss(reduction='mean')
# Paddle 写法
-paddle.nn.MultiLabelSoftMarginLoss(weight=w, reduction='mean')
+paddle.nn.MultiLabelSoftMarginLoss(reduction='mean')
```
-
reduction 为'sum'
-
```python
# PyTorch 写法
-torch.nn.MultiLabelSoftMarginLoss(weight=w, reduction='sum')
+torch.nn.MultiLabelSoftMarginLoss(reduction='sum')
# Paddle 写法
-paddle.nn.MultiLabelSoftMarginLoss(weight=w, reduction='sum')
+paddle.nn.MultiLabelSoftMarginLoss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MultiMarginLoss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MultiMarginLoss.md
index e45cda33913..92a1070d466 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MultiMarginLoss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.MultiMarginLoss.md
@@ -17,81 +17,70 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| ------------------ | ------------------ | ---------------------------------------------------------------------------------- |
| p | p | 手动指定幂次方指数大小,默认为 1。 |
| margin | margin | 手动指定间距,默认为 1。 |
-| weight | weight | 权重值,默认为 None。 如果给定权重则形状为 `[C,]` |
+| weight | weight | 权重值,默认为 None。 如果给定权重则形状为 `[C,]`。 |
| size_average | - | 已废弃(可用 `reduction` 代替)。表示是否采用 batch 中各样本 loss 平均值作为最终的 loss。如果置 False,则采用加和作为 loss。默认为 True,paddle 需要转写。 |
| reduce | - | 已废弃(可用 `reduction` 代替)。表示是否采用输出单个值作为 loss。如果置 False,则每个元素输出一个 loss 并忽略 `size_average`。默认为 True,paddle 需要转写。 |
| reduction | reduction | 指定应用于输出结果的计算方式,可选值有 `none`、`mean` 和 `sum`。默认为 `mean`,计算 mini-batch loss 均值。设置为 `sum` 时,计算 mini-batch loss 的总和。设置为 `none` 时,则返回 loss Tensor。默认值下为 `mean`。 |
### 转写示例
+
#### size_average
size_average 为 True
-
```python
# PyTorch 写法
-torch.nn.MultiMarginLoss(weight=w, size_average=True)
+torch.nn.MultiMarginLoss(size_average=True)
# Paddle 写法
-paddle.nn.MultiMarginLoss(weight=w, reduction='mean')
+paddle.nn.MultiMarginLoss(reduction='mean')
```
size_average 为 False
-
```python
# PyTorch 写法
-torch.nn.MultiMarginLoss(weight=w, size_average=False)
+torch.nn.MultiMarginLoss(size_average=False)
# Paddle 写法
-paddle.nn.MultiMarginLoss(weight=w, reduction='sum')
+paddle.nn.MultiMarginLoss(reduction='sum')
```
-
#### reduce
reduce 为 True
-
```python
# PyTorch 写法
-torch.nn.MultiMarginLoss(weight=w, reduce=True)
+torch.nn.MultiMarginLoss(size_average=False)
# Paddle 写法
-paddle.nn.MultiMarginLoss(weight=w, reduction='mean')
+paddle.nn.MultiMarginLoss(reduction='sum')
```
-
reduce 为 False
-
```python
# PyTorch 写法
-torch.nn.MultiMarginLoss(weight=w, reduce=False)
+torch.nn.MultiMarginLoss(reduce=False)
# Paddle 写法
-paddle.nn.MultiMarginLoss(weight=w, reduction='none')
+paddle.nn.MultiMarginLoss(reduction='none')
```
-
#### reduction
reduction 为'none'
-
```python
# PyTorch 写法
-torch.nn.MultiMarginLoss(weight=w, reduction='none')
+torch.nn.MultiMarginLoss(reduction='none')
# Paddle 写法
-paddle.nn.MultiMarginLoss(weight=w, reduction='none')
+paddle.nn.MultiMarginLoss(reduction='none')
```
-
reduction 为'mean'
-
```python
# PyTorch 写法
-torch.nn.MultiMarginLoss(weight=w, reduction='mean')
+torch.nn.MultiMarginLoss(reduction='mean')
# Paddle 写法
-paddle.nn.MultiMarginLoss(weight=w, reduction='mean')
+paddle.nn.MultiMarginLoss(reduction='mean')
```
-
reduction 为'sum'
-
```python
# PyTorch 写法
-torch.nn.MultiMarginLoss(weight=w, reduction='sum')
+torch.nn.MultiMarginLoss(reduction='sum')
# Paddle 写法
-paddle.nn.MultiMarginLoss(weight=w, reduction='sum')
+paddle.nn.MultiMarginLoss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.NLLLoss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.NLLLoss.md
index 270510e7b4e..973db4adc33 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.NLLLoss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.NLLLoss.md
@@ -29,75 +29,64 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| reduction | reduction | 表示应用于输出结果的计算方式。 |
### 转写示例
+
#### size_average
size_average 为 True
-
```python
# PyTorch 写法
-torch.nn.NLLLoss(weight=w, size_average=True)
+torch.nn.NLLLoss(size_average=True)
# Paddle 写法
-paddle.nn.NLLLoss(weight=w, reduction='mean')
+paddle.nn.NLLLoss(reduction='mean')
```
size_average 为 False
-
```python
# PyTorch 写法
-torch.nn.NLLLoss(weight=w, size_average=False)
+torch.nn.NLLLoss(size_average=False)
# Paddle 写法
-paddle.nn.NLLLoss(weight=w, reduction='sum')
+paddle.nn.NLLLoss(reduction='sum')
```
-
#### reduce
reduce 为 True
-
```python
# PyTorch 写法
-torch.nn.NLLLoss(weight=w, reduce=True)
+torch.nn.NLLLoss(size_average=False)
# Paddle 写法
-paddle.nn.NLLLoss(weight=w, reduction='mean')
+paddle.nn.NLLLoss(reduction='sum')
```
-
reduce 为 False
-
```python
# PyTorch 写法
-torch.nn.NLLLoss(weight=w, reduce=False)
+torch.nn.NLLLoss(reduce=False)
# Paddle 写法
-paddle.nn.NLLLoss(weight=w, reduction='none')
+paddle.nn.NLLLoss(reduction='none')
```
-
#### reduction
reduction 为'none'
-
```python
# PyTorch 写法
-torch.nn.NLLLoss(weight=w, reduction='none')
+torch.nn.NLLLoss(reduction='none')
# Paddle 写法
-paddle.nn.NLLLoss(weight=w, reduction='none')
+paddle.nn.NLLLoss(reduction='none')
```
-
reduction 为'mean'
-
```python
# PyTorch 写法
-torch.nn.NLLLoss(weight=w, reduction='mean')
+torch.nn.NLLLoss(reduction='mean')
# Paddle 写法
-paddle.nn.NLLLoss(weight=w, reduction='mean')
+paddle.nn.NLLLoss(reduction='mean')
```
-
reduction 为'sum'
-
```python
# PyTorch 写法
-torch.nn.NLLLoss(weight=w, reduction='sum')
+torch.nn.NLLLoss(reduction='sum')
# Paddle 写法
-paddle.nn.NLLLoss(weight=w, reduction='sum')
+paddle.nn.NLLLoss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.PReLU.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.PReLU.md
index ca54b36e91d..343d50001ba 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.PReLU.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.PReLU.md
@@ -24,6 +24,6 @@ paddle.nn.PReLU(num_parameters=1,
| num_parameters | num_parameters | 表示可训练 `weight` 的数量。 |
| init | init | 表示 `weight` 的初始值。 |
| device | - | 指定设备,PaddlePaddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
-| dtype | - | 指定数据类型,PaddlePaddle 无此功能。 |
+| dtype | - | 指定数据类型,PaddlePaddle 无此功能。暂无转写方式。 |
| - | weight_attr | 指定权重参数属性的对象,PyTorch 无此参数,Paddle 保持默认即可。 |
| - | data_format | 指定输入的数据格式,PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.PoissonNLLLoss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.PoissonNLLLoss.md
index 87fc2fcbd35..84bb602f918 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.PoissonNLLLoss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.PoissonNLLLoss.md
@@ -23,75 +23,64 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| reduction | reduction | 指定应用于输出结果的计算方式,可选值有 `none`、`mean` 和 `sum`。默认为 `mean`,计算 mini-batch loss 均值。设置为 `sum` 时,计算 mini-batch loss 的总和。设置为 `none` 时,则返回 loss Tensor。默认值下为 `mean`。两者完全一致。 |
### 转写示例
+
#### size_average
size_average 为 True
-
```python
# PyTorch 写法
-torch.nn.PoissonNLLLoss(weight=w, size_average=True)
+torch.nn.PoissonNLLLoss(size_average=True)
# Paddle 写法
-paddle.nn.PoissonNLLLoss(weight=w, reduction='mean')
+paddle.nn.PoissonNLLLoss(reduction='mean')
```
size_average 为 False
-
```python
# PyTorch 写法
-torch.nn.PoissonNLLLoss(weight=w, size_average=False)
+torch.nn.PoissonNLLLoss(size_average=False)
# Paddle 写法
-paddle.nn.PoissonNLLLoss(weight=w, reduction='sum')
+paddle.nn.PoissonNLLLoss(reduction='sum')
```
-
#### reduce
reduce 为 True
-
```python
# PyTorch 写法
-torch.nn.PoissonNLLLoss(weight=w, reduce=True)
+torch.nn.PoissonNLLLoss(size_average=False)
# Paddle 写法
-paddle.nn.PoissonNLLLoss(weight=w, reduction='mean')
+paddle.nn.PoissonNLLLoss(reduction='sum')
```
-
reduce 为 False
-
```python
# PyTorch 写法
-torch.nn.PoissonNLLLoss(weight=w, reduce=False)
+torch.nn.PoissonNLLLoss(reduce=False)
# Paddle 写法
-paddle.nn.PoissonNLLLoss(weight=w, reduction='none')
+paddle.nn.PoissonNLLLoss(reduction='none')
```
-
#### reduction
reduction 为'none'
-
```python
# PyTorch 写法
-torch.nn.PoissonNLLLoss(weight=w, reduction='none')
+torch.nn.PoissonNLLLoss(reduction='none')
# Paddle 写法
-paddle.nn.PoissonNLLLoss(weight=w, reduction='none')
+paddle.nn.PoissonNLLLoss(reduction='none')
```
-
reduction 为'mean'
-
```python
# PyTorch 写法
-torch.nn.PoissonNLLLoss(weight=w, reduction='mean')
+torch.nn.PoissonNLLLoss(reduction='mean')
# Paddle 写法
-paddle.nn.PoissonNLLLoss(weight=w, reduction='mean')
+paddle.nn.PoissonNLLLoss(reduction='mean')
```
-
reduction 为'sum'
-
```python
# PyTorch 写法
-torch.nn.PoissonNLLLoss(weight=w, reduction='sum')
+torch.nn.PoissonNLLLoss(reduction='sum')
# Paddle 写法
-paddle.nn.PoissonNLLLoss(weight=w, reduction='sum')
+paddle.nn.PoissonNLLLoss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.SmoothL1Loss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.SmoothL1Loss.md
index 3ea1a12e759..869a0c6e3ce 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.SmoothL1Loss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.SmoothL1Loss.md
@@ -27,6 +27,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| - | is_huber | 控制 huber_loss 与 smooth_l1_loss 的开关,Paddle 需设置为 False 。 |
### 转写示例
+
#### size_average
size_average 为 True
```python
@@ -45,17 +46,15 @@ torch.nn.SmoothL1Loss(size_average=False)
# Paddle 写法
paddle.nn.SmoothL1Loss(reduction='sum')
```
-
#### reduce
reduce 为 True
```python
# PyTorch 写法
-torch.nn.SmoothL1Loss(reduce=True)
+torch.nn.SmoothL1Loss(size_average=False)
# Paddle 写法
-paddle.nn.SmoothL1Loss(reduction='mean')
+paddle.nn.SmoothL1Loss(reduction='sum')
```
-
reduce 为 False
```python
# PyTorch 写法
@@ -64,7 +63,6 @@ torch.nn.SmoothL1Loss(reduce=False)
# Paddle 写法
paddle.nn.SmoothL1Loss(reduction='none')
```
-
#### reduction
reduction 为'none'
```python
@@ -74,7 +72,6 @@ torch.nn.SmoothL1Loss(reduction='none')
# Paddle 写法
paddle.nn.SmoothL1Loss(reduction='none')
```
-
reduction 为'mean'
```python
# PyTorch 写法
@@ -83,7 +80,6 @@ torch.nn.SmoothL1Loss(reduction='mean')
# Paddle 写法
paddle.nn.SmoothL1Loss(reduction='mean')
```
-
reduction 为'sum'
```python
# PyTorch 写法
@@ -92,15 +88,3 @@ torch.nn.SmoothL1Loss(reduction='sum')
# Paddle 写法
paddle.nn.SmoothL1Loss(reduction='sum')
```
-
-#### beta
-```python
-# PyTorch 的 beta 参数转化为 delta 参数
-beta=0.8
-
-# PyTorch 写法
-torch.nn.SmoothL1Loss(beta=beta)
-
-# Paddle 写法
-paddle.nn.SmoothL1Loss(delta=beta, is_huber=False)
-```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.SoftMarginLoss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.SoftMarginLoss.md
index 02c1eedd7a9..733c61d283f 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.SoftMarginLoss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.SoftMarginLoss.md
@@ -23,75 +23,64 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| reduction | reduction | 表示应用于输出结果的计算方式。 |
### 转写示例
+
#### size_average
size_average 为 True
-
```python
# PyTorch 写法
-torch.nn.TripletMarginLoss(weight=w, size_average=True)
+torch.nn.SoftMarginLoss(size_average=True)
# Paddle 写法
-paddle.nn.TripletMarginLoss(weight=w, reduction='mean')
+paddle.nn.SoftMarginLoss(reduction='mean')
```
size_average 为 False
-
```python
# PyTorch 写法
-torch.nn.TripletMarginLoss(weight=w, size_average=False)
+torch.nn.SoftMarginLoss(size_average=False)
# Paddle 写法
-paddle.nn.TripletMarginLoss(weight=w, reduction='sum')
+paddle.nn.SoftMarginLoss(reduction='sum')
```
-
#### reduce
reduce 为 True
-
```python
# PyTorch 写法
-torch.nn.TripletMarginLoss(weight=w, reduce=True)
+torch.nn.SoftMarginLoss(size_average=False)
# Paddle 写法
-paddle.nn.TripletMarginLoss(weight=w, reduction='mean')
+paddle.nn.SoftMarginLoss(reduction='sum')
```
-
reduce 为 False
-
```python
# PyTorch 写法
-torch.nn.TripletMarginLoss(weight=w, reduce=False)
+torch.nn.SoftMarginLoss(reduce=False)
# Paddle 写法
-paddle.nn.TripletMarginLoss(weight=w, reduction='none')
+paddle.nn.SoftMarginLoss(reduction='none')
```
-
#### reduction
reduction 为'none'
-
```python
# PyTorch 写法
-torch.nn.TripletMarginLoss(weight=w, reduction='none')
+torch.nn.SoftMarginLoss(reduction='none')
# Paddle 写法
-paddle.nn.TripletMarginLoss(weight=w, reduction='none')
+paddle.nn.SoftMarginLoss(reduction='none')
```
-
reduction 为'mean'
-
```python
# PyTorch 写法
-torch.nn.TripletMarginLoss(weight=w, reduction='mean')
+torch.nn.SoftMarginLoss(reduction='mean')
# Paddle 写法
-paddle.nn.TripletMarginLoss(weight=w, reduction='mean')
+paddle.nn.SoftMarginLoss(reduction='mean')
```
-
reduction 为'sum'
-
```python
# PyTorch 写法
-torch.nn.TripletMarginLoss(weight=w, reduction='sum')
+torch.nn.SoftMarginLoss(reduction='sum')
# Paddle 写法
-paddle.nn.TripletMarginLoss(weight=w, reduction='sum')
+paddle.nn.SoftMarginLoss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.TransformerDecoderLayer.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.TransformerDecoderLayer.md
index a83555ab13b..31d5d94ed35 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.TransformerDecoderLayer.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.TransformerDecoderLayer.md
@@ -39,8 +39,8 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| dropout | dropout | dropout 值。 |
| activation | activation | 前馈神经网络的激活函数。 |
| layer_norm_eps | layer_norm_eps | layer normalization 层的 eps 值。 |
-| batch_first | - | 输入和输出 tensor 的 shape,Paddle 无此参数,暂无转写方式 |
-| norm_first | normalize_before | 设置对每个子层的输入输出的处理。如果为 True,则对每个子层的输入进行层标准化(Layer Normalization),对每个子层的输出进行 dropout 和残差连接(residual connection)。否则(即为 False),则对每个子层的输入不进行处理,只对每个子层的输出进行 dropout、残差连接(residual connection)和层标准化(Layer Normalization)。默认值:False。 仅参数名不一致|
+| batch_first | - | 输入和输出 tensor 的 shape,Paddle 无此参数,暂无转写方式。 |
+| norm_first | normalize_before | 设置对每个子层的输入输出的处理。如果为 True,则对每个子层的输入进行层标准化(Layer Normalization),对每个子层的输出进行 dropout 和残差连接(residual connection)。否则(即为 False),则对每个子层的输入不进行处理,只对每个子层的输出进行 dropout、残差连接(residual connection)和层标准化(Layer Normalization)。默认值:False。 仅参数名不一致。|
| bias | bias_attr | 指定偏置参数属性的对象,仅参数名不一致。 |
| device | - | 设备类型,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
| dtype | - | 参数类型,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.TripletMarginLoss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.TripletMarginLoss.md
index eb7e7d35688..cd4de378611 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.TripletMarginLoss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.TripletMarginLoss.md
@@ -19,80 +19,69 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| p | p | 手动指定范数。 |
| eps | epsilon | 防止除数为 0,仅参数名不一致。 |
| swap | swap | 默认为 False。 |
-| size_average | - | 已废弃,和 reduce 组合决定损失计算方式。 |
-| reduce | - | 已废弃,和 size_average 组合决定损失计算方式。 |
+| size_average | - | 已废弃,和 reduce 组合决定损失计算方式。需要转写。 |
+| reduce | - | 已废弃,和 size_average 组合决定损失计算方式。需要转写。 |
| reduction | reduction | 指定应用于输出结果的计算方式。 |
### 转写示例
+
#### size_average
size_average 为 True
-
```python
# PyTorch 写法
-torch.nn.TripletMarginLoss(weight=w, size_average=True)
+torch.nn.TripletMarginLoss(size_average=True)
# Paddle 写法
-paddle.nn.TripletMarginLoss(weight=w, reduction='mean')
+paddle.nn.TripletMarginLoss(reduction='mean')
```
size_average 为 False
-
```python
# PyTorch 写法
-torch.nn.TripletMarginLoss(weight=w, size_average=False)
+torch.nn.TripletMarginLoss(size_average=False)
# Paddle 写法
-paddle.nn.TripletMarginLoss(weight=w, reduction='sum')
+paddle.nn.TripletMarginLoss(reduction='sum')
```
-
#### reduce
reduce 为 True
-
```python
# PyTorch 写法
-torch.nn.TripletMarginLoss(weight=w, reduce=True)
+torch.nn.TripletMarginLoss(size_average=False)
# Paddle 写法
-paddle.nn.TripletMarginLoss(weight=w, reduction='mean')
+paddle.nn.TripletMarginLoss(reduction='sum')
```
-
reduce 为 False
-
```python
# PyTorch 写法
-torch.nn.TripletMarginLoss(weight=w, reduce=False)
+torch.nn.TripletMarginLoss(reduce=False)
# Paddle 写法
-paddle.nn.TripletMarginLoss(weight=w, reduction='none')
+paddle.nn.TripletMarginLoss(reduction='none')
```
-
#### reduction
reduction 为'none'
-
```python
# PyTorch 写法
-torch.nn.TripletMarginLoss(weight=w, reduction='none')
+torch.nn.TripletMarginLoss(reduction='none')
# Paddle 写法
-paddle.nn.TripletMarginLoss(weight=w, reduction='none')
+paddle.nn.TripletMarginLoss(reduction='none')
```
-
reduction 为'mean'
-
```python
# PyTorch 写法
-torch.nn.TripletMarginLoss(weight=w, reduction='mean')
+torch.nn.TripletMarginLoss(reduction='mean')
# Paddle 写法
-paddle.nn.TripletMarginLoss(weight=w, reduction='mean')
+paddle.nn.TripletMarginLoss(reduction='mean')
```
-
reduction 为'sum'
-
```python
# PyTorch 写法
-torch.nn.TripletMarginLoss(weight=w, reduction='sum')
+torch.nn.TripletMarginLoss(reduction='sum')
# Paddle 写法
-paddle.nn.TripletMarginLoss(weight=w, reduction='sum')
+paddle.nn.TripletMarginLoss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.binary_cross_entropy.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.binary_cross_entropy.md
index ed00847ae7b..21ec8b41013 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.binary_cross_entropy.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.binary_cross_entropy.md
@@ -23,18 +23,64 @@ paddle.nn.functional.binary_cross_entropy(input, label, weight=None, reduction='
| reduction | reduction | 指定应用于输出结果的计算方式。 |
### 转写示例
-#### size_average、reduce
-```python
-# PyTorch 的 size_average、reduce 参数转为 Paddle 的 reduction 参数
-if size_average is None:
- size_average = True
-if reduce is None:
- reduce = True
-
-if size_average and reduce:
- reduction = 'mean'
-elif reduce:
- reduction = 'sum'
-else:
- reduction = 'none'
+
+#### size_average
+size_average 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.binary_cross_entropy(size_average=True)
+
+# Paddle 写法
+paddle.nn.functional.binary\_cross\_entropy(reduction='mean')
+```
+
+size_average 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.binary_cross_entropy(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.binary\_cross\_entropy(reduction='sum')
+```
+#### reduce
+reduce 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.binary_cross_entropy(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.binary\_cross\_entropy(reduction='sum')
+```
+reduce 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.binary_cross_entropy(reduce=False)
+
+# Paddle 写法
+paddle.nn.functional.binary\_cross\_entropy(reduction='none')
+```
+#### reduction
+reduction 为'none'
+```python
+# PyTorch 写法
+torch.nn.functional.binary_cross_entropy(reduction='none')
+
+# Paddle 写法
+paddle.nn.functional.binary\_cross\_entropy(reduction='none')
+```
+reduction 为'mean'
+```python
+# PyTorch 写法
+torch.nn.functional.binary_cross_entropy(reduction='mean')
+
+# Paddle 写法
+paddle.nn.functional.binary\_cross\_entropy(reduction='mean')
+```
+reduction 为'sum'
+```python
+# PyTorch 写法
+torch.nn.functional.binary_cross_entropy(reduction='sum')
+
+# Paddle 写法
+paddle.nn.functional.binary\_cross\_entropy(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.binary_cross_entropy_with_logits.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.binary_cross_entropy_with_logits.md
index 770f61f7d86..90b11988d3c 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.binary_cross_entropy_with_logits.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.binary_cross_entropy_with_logits.md
@@ -24,60 +24,64 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| pos_weight | pos_weight | 正类的权重。 |
### 转写示例
-#### size_average:是否对损失进行平均或求和
+
+#### size_average
+size_average 为 True
```python
-# PyTorch 写法 (size_average 为‘True’时)
-torch.nn.functional.binary_cross_entropy_with_logits(a, target, size_average=True)
+# PyTorch 写法
+torch.nn.functional.binary_cross_entropy_with_logits(size_average=True)
# Paddle 写法
-paddle.nn.functional.binary_cross_entropy_with_logits(logit=a, label=target,
- reduction='mean')
+paddle.nn.functional.binary_cross_entropy_with_logits(reduction='mean')
+```
-# PyTorch 写法 (size_average 为‘False’时)
-torch.nn.functional.binary_cross_entropy_with_logits(a, target, size_average=False)
+size_average 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.binary_cross_entropy_with_logits(size_average=False)
# Paddle 写法
-paddle.nn.functional.binary_cross_entropy_with_logits(logit=a, label=target,
- reduction='sum')
+paddle.nn.functional.binary_cross_entropy_with_logits(reduction='sum')
```
-
-#### reduce:是否对损失进行平均或求和
+#### reduce
+reduce 为 True
```python
-# PyTorch 写法 (reduce 为‘True’时)
-torch.nn.functional.binary_cross_entropy_with_logits(a, target, reduce=True)
+# PyTorch 写法
+torch.nn.functional.binary_cross_entropy_with_logits(size_average=False)
# Paddle 写法
-paddle.nn.functional.binary_cross_entropy_with_logits(logit=a, label=target,
- reduction='mean')
-
-# PyTorch 写法 (reduce 为‘False’时)
-torch.nn.functional.binary_cross_entropy_with_logits(a, target, reduce=False)
+paddle.nn.functional.binary_cross_entropy_with_logits(reduction='sum')
+```
+reduce 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.binary_cross_entropy_with_logits(reduce=False)
# Paddle 写法
-paddle.nn.functional.binary_cross_entropy_with_logits(logit=a, label=target,
- reduction='sum')
+paddle.nn.functional.binary_cross_entropy_with_logits(reduction='none')
```
-
-#### reduction:输出结果的计算方式
+#### reduction
+reduction 为'none'
```python
-# PyTorch 写法 (reduction 为‘none’时)
-torch.nn.functional.binary_cross_entropy_with_logits(a, target, reduction='none')
+# PyTorch 写法
+torch.nn.functional.binary_cross_entropy_with_logits(reduction='none')
# Paddle 写法
-paddle.nn.functional.binary_cross_entropy_with_logits(logit=a, label=target,
- reduction='none')
-
-# PyTorch 写法 (reduction 为‘mean’时)
-torch.nn.functional.binary_cross_entropy_with_logits(a, target, reduction='mean')
+paddle.nn.functional.binary_cross_entropy_with_logits(reduction='none')
+```
+reduction 为'mean'
+```python
+# PyTorch 写法
+torch.nn.functional.binary_cross_entropy_with_logits(reduction='mean')
# Paddle 写法
-paddle.nn.functional.binary_cross_entropy_with_logits(logit=a, label=target,
- reduction='mean')
-
-# PyTorch 写法 (reduction 为‘sum’时)
-torch.nn.functional.binary_cross_entropy_with_logits(a, target, reduction='sum')
+paddle.nn.functional.binary_cross_entropy_with_logits(reduction='mean')
+```
+reduction 为'sum'
+```python
+# PyTorch 写法
+torch.nn.functional.binary_cross_entropy_with_logits(reduction='sum')
# Paddle 写法
-paddle.nn.functional.binary_cross_entropy_with_logits(logit=a, label=target,
- reduction='sum')
+paddle.nn.functional.binary_cross_entropy_with_logits(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.cosine_embedding_loss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.cosine_embedding_loss.md
index f9f4c91535b..82ac093b965 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.cosine_embedding_loss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.cosine_embedding_loss.md
@@ -19,22 +19,69 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| input2 | input2 | 输入的 Tensor。 |
| target | label | 标签,仅参数名不一致。 |
| margin | margin | 可以设置的范围为[-1, 1]。 |
-| size_average | - | 已废弃,和 reduce 组合决定损失计算方式。 |
-| reduce | - | 已废弃,和 size_average 组合决定损失计算方式。 |
+| size_average | - | 已废弃,和 reduce 组合决定损失计算方式。 需要转写。 |
+| reduce | - | 已废弃,和 size_average 组合决定损失计算方式。需要转写。 |
| reduction | reduction | 指定应用于输出结果的计算方式。 |
### 转写示例
+
+#### size_average
+size_average 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.cosine_embedding_loss(size_average=True)
+
+# Paddle 写法
+paddle.nn.functional.cosine_embedding_loss(reduction='mean')
+```
+
+size_average 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.cosine_embedding_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.cosine_embedding_loss(reduction='sum')
+```
+#### reduce
+reduce 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.cosine_embedding_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.cosine_embedding_loss(reduction='sum')
+```
+reduce 为 False
```python
-# PyTorch 的 size_average、reduce 参数转为 Paddle 的 reduction 参数
-if size_average is None:
- size_average = True
-if reduce is None:
- reduce = True
-
-if size_average and reduce:
- reduction = 'mean'
-elif reduce:
- reduction = 'sum'
-else:
- reduction = 'none'
+# PyTorch 写法
+torch.nn.functional.cosine_embedding_loss(reduce=False)
+
+# Paddle 写法
+paddle.nn.functional.cosine_embedding_loss(reduction='none')
+```
+#### reduction
+reduction 为'none'
+```python
+# PyTorch 写法
+torch.nn.functional.cosine_embedding_loss(reduction='none')
+
+# Paddle 写法
+paddle.nn.functional.cosine_embedding_loss(reduction='none')
+```
+reduction 为'mean'
+```python
+# PyTorch 写法
+torch.nn.functional.cosine_embedding_loss(reduction='mean')
+
+# Paddle 写法
+paddle.nn.functional.cosine_embedding_loss(reduction='mean')
+```
+reduction 为'sum'
+```python
+# PyTorch 写法
+torch.nn.functional.cosine_embedding_loss(reduction='sum')
+
+# Paddle 写法
+paddle.nn.functional.cosine_embedding_loss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.cross_entropy.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.cross_entropy.md
index 782790c1ed0..53e8cbc2a2d 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.cross_entropy.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.cross_entropy.md
@@ -33,9 +33,9 @@ paddle.nn.functional.cross_entropy(input,
| input | input | 表示预测的 Tensor 。 |
| target | label | 表示真实的 Tensor,仅参数名不同。 |
| weight | weight | 表示权重。 |
-| size_average | - | 已弃用 。 |
+| size_average | - | 已弃用 。 需要转写。 |
| ignore_index | ignore_index | 表示忽略的标签值 。 |
-| reduce | - | 已弃用 。 |
+| reduce | - | 已弃用 。 需要转写。 |
| reduction | reduction | 表示应用于输出结果的计算方式 。 |
| label_smoothing | label_smoothing | 指定计算损失时的平滑量,参数完全一致。|
| - | soft_label | 指明 label 是否为软标签, PyTorch 无此参数, Paddle 保持默认即可。|
@@ -43,75 +43,64 @@ paddle.nn.functional.cross_entropy(input,
| - | use_softmax | 指定是否对 input 进行 softmax 归一化, PyTorch 无此参数, Paddle 保持默认即可。|
### 转写示例
+
#### size_average
size_average 为 True
-
```python
# PyTorch 写法
-torch.nn.functional.cross_entropy(x,y,size_average=True)
+torch.nn.functional.cross_entropy(size_average=True)
# Paddle 写法
-paddle.nn.functional.cross_entropy(x,y,reduction='mean')
+paddle.nn.functional.cross_entropy(reduction='mean')
```
size_average 为 False
-
```python
# PyTorch 写法
-torch.nn.functional.cross_entropy(x,y,size_average=False)
+torch.nn.functional.cross_entropy(size_average=False)
# Paddle 写法
-paddle.nn.functional.cross_entropy(x,y,reduction='sum')
+paddle.nn.functional.cross_entropy(reduction='sum')
```
-
#### reduce
reduce 为 True
-
```python
# PyTorch 写法
-torch.nn.functional.cross_entropy(x,y,reduce=True)
+torch.nn.functional.cross_entropy(size_average=False)
# Paddle 写法
-paddle.nn.BCEWithLogitsLoss(reduction='mean')
+paddle.nn.functional.cross_entropy(reduction='sum')
```
-
reduce 为 False
-
```python
# PyTorch 写法
-torch.nn.functional.cross_entropy(x,y,reduce=False)
+torch.nn.functional.cross_entropy(reduce=False)
# Paddle 写法
-paddle.nn.BCEWithLogitsLoss(reduction='none')
+paddle.nn.functional.cross_entropy(reduction='none')
```
-
#### reduction
reduction 为'none'
-
```python
# PyTorch 写法
-torch.nn.functional.cross_entropy(x,y,reduction='none')
+torch.nn.functional.cross_entropy(reduction='none')
# Paddle 写法
-paddle.nn.functional.cross_entropy(x,y,reduction='none')
+paddle.nn.functional.cross_entropy(reduction='none')
```
-
reduction 为'mean'
-
```python
# PyTorch 写法
-torch.nn.functional.cross_entropy(x,y,reduction='mean')
+torch.nn.functional.cross_entropy(reduction='mean')
# Paddle 写法
-paddle.nn.functional.cross_entropy(x,y,reduction='mean')
+paddle.nn.functional.cross_entropy(reduction='mean')
```
-
reduction 为'sum'
-
```python
# PyTorch 写法
-torch.nn.functional.cross_entropy(x,y,reduction='sum')
+torch.nn.functional.cross_entropy(reduction='sum')
# Paddle 写法
-paddle.nn.functional.cross_entropy(x,y,reduction='sum')
+paddle.nn.functional.cross_entropy(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.fractional_max_pool2d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.fractional_max_pool2d.md
index 27b55f7e17b..8b6299f5a0e 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.fractional_max_pool2d.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.fractional_max_pool2d.md
@@ -17,7 +17,7 @@ PyTorch 参数更多,具体如下:
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 表示输入的 Tensor 。仅参数名不一致。 |
| kernel_size | kernel_size | 表示核大小。参数完全一致。 |
-| output_size | output_size | 表示目标输出尺寸,PyTorch 为可选参数,Paddle 为必选参数,Paddle 与 PyTorch 默认值不同。PyTorch 的 output_size 与 output_ratio 输入二选一,如不输入 output_size,则必须输入 output_ratio,此时需要转写。转写方式与下文 output_ratio 一致。 |
+| output_size | output_size | 表示目标输出尺寸,PyTorch 为可选参数,Paddle 为必选参数,Paddle 与 PyTorch 默认值不同。PyTorch 的 output_size 与 output_ratio 输入二选一,如不输入 output_size,则必须输入 output_ratio,此时转写方式与下文 output_ratio 一致。 |
| output_ratio | - | 表示目标输出比例。Paddle 无此参数,需要转写。 |
| return_indices | return_mask | 表示是否返回最大值索引。仅参数名不一致。 |
| _random_samples | random_u | 表示随机数。PyTorch 以列表形式的 Tensor 方式传入,Paddle 以 float 的方式传入,如果 PyTorch 的多个随机数相同,需要转写,如果 PyTorch 的多个随机数不同,暂无转写方式。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.fractional_max_pool3d.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.fractional_max_pool3d.md
index ac284b88b89..67985574a77 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.fractional_max_pool3d.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.fractional_max_pool3d.md
@@ -17,7 +17,7 @@ PyTorch 参数更多,具体如下:
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 表示输入的 Tensor 。仅参数名不一致。 |
| kernel_size | kernel_size | 表示核大小。参数完全一致。 |
-| output_size | output_size | 表示目标输出尺寸,PyTorch 为可选参数,Paddle 为必选参数,参数默认值不一致。PyTorch 的 output_size 与 output_ratio 输入二选一,如不输入 output_size,则必须输入 output_ratio,此时需要转写。转写方式与下文 output_ratio 一致。 |
+| output_size | output_size | 表示目标输出尺寸,PyTorch 为可选参数,Paddle 为必选参数,参数默认值不一致。PyTorch 的 output_size 与 output_ratio 输入二选一,如不输入 output_size,则必须输入 output_ratio,此时转写方式与下文 output_ratio 一致。 |
| output_ratio | - | 表示目标输出比例。Paddle 无此参数,需要转写。 |
| return_indices | return_mask | 表示是否返回最大值索引。仅参数名不一致。 |
| _random_samples | random_u | 表示随机数。PyTorch 以列表形式的 Tensor 方式传入,Paddle 以 float 的方式传入,如果 PyTorch 的多个随机数相同,需要转写,如果 PyTorch 的多个随机数不同,暂无转写方式。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.hinge_embedding_loss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.hinge_embedding_loss.md
index 08211260d0e..8974d36f032 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.hinge_embedding_loss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.hinge_embedding_loss.md
@@ -18,22 +18,69 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| input | input | 输入的 Tensor。 |
| target | label | 标签,仅参数名不一致。 |
| margin | margin | 当 label 为 -1 时,该值决定了小于 margin 的 input 才需要纳入 hinge embedding loss 的计算。 |
-| size_average | - | 已废弃,和 reduce 组合决定损失计算方式。 |
-| reduce | - | 已废弃,和 size_average 组合决定损失计算方式。 |
+| size_average | - | 已废弃,和 reduce 组合决定损失计算方式。需要转写。 |
+| reduce | - | 已废弃,和 size_average 组合决定损失计算方式。 需要转写。 |
| reduction | reduction | 指定应用于输出结果的计算方式。 |
### 转写示例
+
+#### size_average
+size_average 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.hinge_embedding_loss(size_average=True)
+
+# Paddle 写法
+paddle.nn.functional.hinge_embedding_loss(reduction='mean')
+```
+
+size_average 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.hinge_embedding_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.hinge_embedding_loss(reduction='sum')
+```
+#### reduce
+reduce 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.hinge_embedding_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.hinge_embedding_loss(reduction='sum')
+```
+reduce 为 False
```python
-# PyTorch 的 size_average、reduce 参数转为 Paddle 的 reduction 参数
-if size_average is None:
- size_average = True
-if reduce is None:
- reduce = True
-
-if size_average and reduce:
- reduction = 'mean'
-elif reduce:
- reduction = 'sum'
-else:
- reduction = 'none'
+# PyTorch 写法
+torch.nn.functional.hinge_embedding_loss(reduce=False)
+
+# Paddle 写法
+paddle.nn.functional.hinge_embedding_loss(reduction='none')
+```
+#### reduction
+reduction 为'none'
+```python
+# PyTorch 写法
+torch.nn.functional.hinge_embedding_loss(reduction='none')
+
+# Paddle 写法
+paddle.nn.functional.hinge_embedding_loss(reduction='none')
+```
+reduction 为'mean'
+```python
+# PyTorch 写法
+torch.nn.functional.hinge_embedding_loss(reduction='mean')
+
+# Paddle 写法
+paddle.nn.functional.hinge_embedding_loss(reduction='mean')
+```
+reduction 为'sum'
+```python
+# PyTorch 写法
+torch.nn.functional.hinge_embedding_loss(reduction='sum')
+
+# Paddle 写法
+paddle.nn.functional.hinge_embedding_loss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.kl_div.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.kl_div.md
index d050c018245..4ea00b86778 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.kl_div.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.kl_div.md
@@ -29,60 +29,64 @@ paddle.nn.functional.kl_div(input,
| log_target | log_target | 指定目标是否属于 log 空间。 |
### 转写示例
-#### size_average:是否对损失进行平均或求和
+
+#### size_average
+size_average 为 True
```python
-# PyTorch 写法 (size_average 为‘True’时)
-torch.nn.functional.kl_div(a, target, size_average=True)
+# PyTorch 写法
+torch.nn.functional.kl_div(size_average=True)
# Paddle 写法
-paddle.nn.functional.kl_div(logit=a, label=target,
- reduction='mean')
+paddle.nn.functional.kl_div(reduction='mean')
+```
-# PyTorch 写法 (size_average 为‘False’时)
-torch.nn.functional.kl_div(a, target, size_average=False)
+size_average 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.kl_div(size_average=False)
# Paddle 写法
-paddle.nn.functional.kl_div(logit=a, label=target,
- reduction='sum')
+paddle.nn.functional.kl_div(reduction='sum')
```
-
-#### reduce:是否对损失进行平均或求和
+#### reduce
+reduce 为 True
```python
-# PyTorch 写法 (reduce 为‘True’时)
-torch.nn.functional.kl_div(a, target, reduce=True)
+# PyTorch 写法
+torch.nn.functional.kl_div(size_average=False)
# Paddle 写法
-paddle.nn.functional.kl_div(logit=a, label=target,
- reduction='mean')
-
-# PyTorch 写法 (reduce 为‘False’时)
-torch.nn.functional.kl_div(a, target, reduce=False)
+paddle.nn.functional.kl_div(reduction='sum')
+```
+reduce 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.kl_div(reduce=False)
# Paddle 写法
-paddle.nn.functional.kl_div(logit=a, label=target,
- reduction='sum')
+paddle.nn.functional.kl_div(reduction='none')
```
-
-#### reduction:输出结果的计算方式
+#### reduction
+reduction 为'none'
```python
-# PyTorch 写法 (reduction 为‘none’时)
-torch.nn.functional.kl_div(a, target, reduction='none')
+# PyTorch 写法
+torch.nn.functional.kl_div(reduction='none')
# Paddle 写法
-paddle.nn.functional.kl_div(logit=a, label=target,
- reduction='none')
-
-# PyTorch 写法 (reduction 为‘mean’时)
-torch.nn.functional.kl_div(a, target, reduction='mean')
+paddle.nn.functional.kl_div(reduction='none')
+```
+reduction 为'mean'
+```python
+# PyTorch 写法
+torch.nn.functional.kl_div(reduction='mean')
# Paddle 写法
-paddle.nn.functional.kl_div(logit=a, label=target,
- reduction='mean')
-
-# PyTorch 写法 (reduction 为‘sum’时)
-torch.nn.functional.kl_div(a, target, reduction='sum')
+paddle.nn.functional.kl_div(reduction='mean')
+```
+reduction 为'sum'
+```python
+# PyTorch 写法
+torch.nn.functional.kl_div(reduction='sum')
# Paddle 写法
-paddle.nn.functional.kl_div(logit=a, label=target,
- reduction='sum')
+paddle.nn.functional.kl_div(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.l1_loss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.l1_loss.md
index ee084713eda..4768bf163dd 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.l1_loss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.l1_loss.md
@@ -19,63 +19,67 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| target | label | 标签,和 input 具有相同的维度,仅参数名不一致。 |
| size_average | - | 已废弃,和 reduce 组合决定损失计算方式。Paddle 无此参数,需要转写。 |
| reduce | - | 已废弃,和 size_average 组合决定损失计算方式。Paddle 无此参数,需要转写。 |
-| reduction | reduction | 输出结果的计算方式 |
+| reduction | reduction | 输出结果的计算方式。 |
### 转写示例
-#### size_average:是否对损失进行平均或求和
+
+#### size_average
+size_average 为 True
```python
-# PyTorch 写法 (size_average 为‘True’时)
-torch.nn.functional.l1_loss(a, target, size_average=True)
+# PyTorch 写法
+torch.nn.functional.l1_loss(size_average=True)
# Paddle 写法
-paddle.nn.functional.l1_loss(logit=a, label=target,
- reduction='mean')
+paddle.nn.functional.l1_loss(reduction='mean')
+```
-# PyTorch 写法 (size_average 为‘False’时)
-torch.nn.functional.l1_loss(a, target, size_average=False)
+size_average 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.l1_loss(size_average=False)
# Paddle 写法
-paddle.nn.functional.l1_loss(logit=a, label=target,
- reduction='sum')
+paddle.nn.functional.l1_loss(reduction='sum')
```
-
-#### reduce:是否对损失进行平均或求和
+#### reduce
+reduce 为 True
```python
-# PyTorch 写法 (reduce 为‘True’时)
-torch.nn.functional.l1_loss(a, target, reduce=True)
+# PyTorch 写法
+torch.nn.functional.l1_loss(size_average=False)
# Paddle 写法
-paddle.nn.functional.l1_loss(logit=a, label=target,
- reduction='mean')
-
-# PyTorch 写法 (reduce 为‘False’时)
-torch.nn.functional.l1_loss(a, target, reduce=False)
+paddle.nn.functional.l1_loss(reduction='sum')
+```
+reduce 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.l1_loss(reduce=False)
# Paddle 写法
-paddle.nn.functional.l1_loss(logit=a, label=target,
- reduction='sum')
+paddle.nn.functional.l1_loss(reduction='none')
```
-
-#### reduction:输出结果的计算方式
+#### reduction
+reduction 为'none'
```python
-# PyTorch 写法 (reduction 为‘none’时)
-torch.nn.functional.l1_loss(a, target, reduction='none')
+# PyTorch 写法
+torch.nn.functional.l1_loss(reduction='none')
# Paddle 写法
-paddle.nn.functional.l1_loss(logit=a, label=target,
- reduction='none')
-
-# PyTorch 写法 (reduction 为‘mean’时)
-torch.nn.functional.l1_loss(a, target, reduction='mean')
+paddle.nn.functional.l1_loss(reduction='none')
+```
+reduction 为'mean'
+```python
+# PyTorch 写法
+torch.nn.functional.l1_loss(reduction='mean')
# Paddle 写法
-paddle.nn.functional.l1_loss(logit=a, label=target,
- reduction='mean')
-
-# PyTorch 写法 (reduction 为‘sum’时)
-torch.nn.functional.l1_loss(a, target, reduction='sum')
+paddle.nn.functional.l1_loss(reduction='mean')
+```
+reduction 为'sum'
+```python
+# PyTorch 写法
+torch.nn.functional.l1_loss(reduction='sum')
# Paddle 写法
-paddle.nn.functional.l1_loss(logit=a, label=target,
- reduction='sum')
+paddle.nn.functional.l1_loss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.margin_ranking_loss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.margin_ranking_loss.md
index d4b63193121..1612f23826d 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.margin_ranking_loss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.margin_ranking_loss.md
@@ -29,23 +29,69 @@ paddle.nn.functional.margin_ranking_loss(input,
| input2 | other | 表示第二个输入的 Tensor ,仅参数名不一致。 |
| target | label | 表示训练数据的标签 Tensor ,仅参数名不一致。 |
| margin | margin | 表示用于加和的 margin 值 。 |
-| size_average | - | 已弃用 。 |
-| reduce | - | 已弃用 。 |
+| size_average | - | 已弃用 。需要转写。 |
+| reduce | - | 已弃用 。需要转写。 |
| reduction | reduction | 表示应用于输出结果的计算方式 。 |
### 转写示例
+
#### size_average
+size_average 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.margin_ranking_loss(size_average=True)
+
+# Paddle 写法
+paddle.nn.functional.margin_ranking_loss(reduction='mean')
+```
+
+size_average 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.margin_ranking_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.margin_ranking_loss(reduction='sum')
+```
+#### reduce
+reduce 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.margin_ranking_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.margin_ranking_loss(reduction='sum')
+```
+reduce 为 False
```python
-# PyTorch 的 size_average、 reduce 参数转为 Paddle 的 reduction 参数
-if size_average is None:
- size_average = True
-if reduce is None:
- reduce = True
-
-if size_average and reduce:
- reduction = 'mean'
-elif reduce:
- reduction = 'sum'
-else:
- reduction = 'none'
+# PyTorch 写法
+torch.nn.functional.margin_ranking_loss(reduce=False)
+
+# Paddle 写法
+paddle.nn.functional.margin_ranking_loss(reduction='none')
+```
+#### reduction
+reduction 为'none'
+```python
+# PyTorch 写法
+torch.nn.functional.margin_ranking_loss(reduction='none')
+
+# Paddle 写法
+paddle.nn.functional.margin_ranking_loss(reduction='none')
+```
+reduction 为'mean'
+```python
+# PyTorch 写法
+torch.nn.functional.margin_ranking_loss(reduction='mean')
+
+# Paddle 写法
+paddle.nn.functional.margin_ranking_loss(reduction='mean')
+```
+reduction 为'sum'
+```python
+# PyTorch 写法
+torch.nn.functional.margin_ranking_loss(reduction='sum')
+
+# Paddle 写法
+paddle.nn.functional.margin_ranking_loss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.mse_loss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.mse_loss.md
index 84d81429b73..65bbed5e441 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.mse_loss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.mse_loss.md
@@ -23,23 +23,69 @@ paddle.nn.functional.mse_loss(input,
| ------------- | ------------ | ------------------------------------------------------ |
| input | input | 表示预测的 Tensor 。 |
| target | label | 表示真实的 Tensor 。 |
-| size_average | - | 已弃用 。 |
-| reduce | - | 已弃用 。 |
+| size_average | - | 已弃用 。 需要转写。 |
+| reduce | - | 已弃用 。需要转写。 |
| reduction | reduction | 表示应用于输出结果的计算方式 。 |
### 转写示例
+
#### size_average
+size_average 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.mse_loss(size_average=True)
+
+# Paddle 写法
+paddle.nn.functional.mse_loss(reduction='mean')
+```
+
+size_average 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.mse_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.mse_loss(reduction='sum')
+```
+#### reduce
+reduce 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.mse_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.mse_loss(reduction='sum')
+```
+reduce 为 False
```python
-# PyTorch 的 size_average、 reduce 参数转为 Paddle 的 reduction 参数
-if size_average is None:
- size_average = True
-if reduce is None:
- reduce = True
-
-if size_average and reduce:
- reduction = 'mean'
-elif reduce:
- reduction = 'sum'
-else:
- reduction = 'none'
+# PyTorch 写法
+torch.nn.functional.mse_loss(reduce=False)
+
+# Paddle 写法
+paddle.nn.functional.mse_loss(reduction='none')
+```
+#### reduction
+reduction 为'none'
+```python
+# PyTorch 写法
+torch.nn.functional.mse_loss(reduction='none')
+
+# Paddle 写法
+paddle.nn.functional.mse_loss(reduction='none')
+```
+reduction 为'mean'
+```python
+# PyTorch 写法
+torch.nn.functional.mse_loss(reduction='mean')
+
+# Paddle 写法
+paddle.nn.functional.mse_loss(reduction='mean')
+```
+reduction 为'sum'
+```python
+# PyTorch 写法
+torch.nn.functional.mse_loss(reduction='sum')
+
+# Paddle 写法
+paddle.nn.functional.mse_loss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.multi_margin_loss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.multi_margin_loss.md
index de83b900fc8..928b54cf4e6 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.multi_margin_loss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.multi_margin_loss.md
@@ -25,18 +25,64 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| reduction | reduction | 指定应用于输出结果的计算方式。 |
### 转写示例
-#### size_average、reduce
-```python
-# PyTorch 的 size_average、reduce 参数转为 Paddle 的 reduction 参数
-if size_average is None:
- size_average = True
-if reduce is None:
- reduce = True
-
-if size_average and reduce:
- reduction = 'mean'
-elif reduce:
- reduction = 'sum'
-else:
- reduction = 'none'
+
+#### size_average
+size_average 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.multi_margin_loss(size_average=True)
+
+# Paddle 写法
+paddle.nn.functional.multi\_margin\_loss(reduction='mean')
+```
+
+size_average 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.multi_margin_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.multi\_margin\_loss(reduction='sum')
+```
+#### reduce
+reduce 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.multi_margin_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.multi\_margin\_loss(reduction='sum')
+```
+reduce 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.multi_margin_loss(reduce=False)
+
+# Paddle 写法
+paddle.nn.functional.multi\_margin\_loss(reduction='none')
+```
+#### reduction
+reduction 为'none'
+```python
+# PyTorch 写法
+torch.nn.functional.multi_margin_loss(reduction='none')
+
+# Paddle 写法
+paddle.nn.functional.multi\_margin\_loss(reduction='none')
+```
+reduction 为'mean'
+```python
+# PyTorch 写法
+torch.nn.functional.multi_margin_loss(reduction='mean')
+
+# Paddle 写法
+paddle.nn.functional.multi\_margin\_loss(reduction='mean')
+```
+reduction 为'sum'
+```python
+# PyTorch 写法
+torch.nn.functional.multi_margin_loss(reduction='sum')
+
+# Paddle 写法
+paddle.nn.functional.multi\_margin\_loss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.multilabel_margin_loss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.multilabel_margin_loss.md
index 32a3150ef35..d9aa876b86e 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.multilabel_margin_loss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.multilabel_margin_loss.md
@@ -22,18 +22,64 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| reduction | reduction | 指定应用于输出结果的计算方式。 |
### 转写示例
-#### size_average、reduce
-```python
-# PyTorch 的 size_average、reduce 参数转为 Paddle 的 reduction 参数
-if size_average is None:
- size_average = True
-if reduce is None:
- reduce = True
-
-if size_average and reduce:
- reduction = 'mean'
-elif reduce:
- reduction = 'sum'
-else:
- reduction = 'none'
+
+#### size_average
+size_average 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.multilabel_margin_loss(size_average=True)
+
+# Paddle 写法
+paddle.nn.functional.multi\_label\_margin\_loss(reduction='mean')
+```
+
+size_average 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.multilabel_margin_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.multi\_label\_margin\_loss(reduction='sum')
+```
+#### reduce
+reduce 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.multilabel_margin_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.multi\_label\_margin\_loss(reduction='sum')
+```
+reduce 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.multilabel_margin_loss(reduce=False)
+
+# Paddle 写法
+paddle.nn.functional.multi\_label\_margin\_loss(reduction='none')
+```
+#### reduction
+reduction 为'none'
+```python
+# PyTorch 写法
+torch.nn.functional.multilabel_margin_loss(reduction='none')
+
+# Paddle 写法
+paddle.nn.functional.multi\_label\_margin\_loss(reduction='none')
+```
+reduction 为'mean'
+```python
+# PyTorch 写法
+torch.nn.functional.multilabel_margin_loss(reduction='mean')
+
+# Paddle 写法
+paddle.nn.functional.multi\_label\_margin\_loss(reduction='mean')
+```
+reduction 为'sum'
+```python
+# PyTorch 写法
+torch.nn.functional.multilabel_margin_loss(reduction='sum')
+
+# Paddle 写法
+paddle.nn.functional.multi\_label\_margin\_loss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.multilabel_soft_margin_loss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.multilabel_soft_margin_loss.md
index 0c714a061cf..f4c02299483 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.multilabel_soft_margin_loss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.multilabel_soft_margin_loss.md
@@ -23,18 +23,64 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| reduction | reduction | 指定应用于输出结果的计算方式。 |
### 转写示例
-#### size_average、reduce
-```python
-# PyTorch 的 size_average、reduce 参数转为 Paddle 的 reduction 参数
-if size_average is None:
- size_average = True
-if reduce is None:
- reduce = True
-
-if size_average and reduce:
- reduction = 'mean'
-elif reduce:
- reduction = 'sum'
-else:
- reduction = 'none'
+
+#### size_average
+size_average 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.multilabel_soft_margin_loss(size_average=True)
+
+# Paddle 写法
+paddle.nn.functional.multi\_label\_soft\_margin\_loss(reduction='mean')
+```
+
+size_average 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.multilabel_soft_margin_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.multi\_label\_soft\_margin\_loss(reduction='sum')
+```
+#### reduce
+reduce 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.multilabel_soft_margin_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.multi\_label\_soft\_margin\_loss(reduction='sum')
+```
+reduce 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.multilabel_soft_margin_loss(reduce=False)
+
+# Paddle 写法
+paddle.nn.functional.multi\_label\_soft\_margin\_loss(reduction='none')
+```
+#### reduction
+reduction 为'none'
+```python
+# PyTorch 写法
+torch.nn.functional.multilabel_soft_margin_loss(reduction='none')
+
+# Paddle 写法
+paddle.nn.functional.multi\_label\_soft\_margin\_loss(reduction='none')
+```
+reduction 为'mean'
+```python
+# PyTorch 写法
+torch.nn.functional.multilabel_soft_margin_loss(reduction='mean')
+
+# Paddle 写法
+paddle.nn.functional.multi\_label\_soft\_margin\_loss(reduction='mean')
+```
+reduction 为'sum'
+```python
+# PyTorch 写法
+torch.nn.functional.multilabel_soft_margin_loss(reduction='sum')
+
+# Paddle 写法
+paddle.nn.functional.multi\_label\_soft\_margin\_loss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.nll_loss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.nll_loss.md
index ac89958e3f4..1af74a65088 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.nll_loss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.nll_loss.md
@@ -25,26 +25,73 @@ paddle.nn.functional.nll_loss(input,
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | input | 输入 Tensor |
-| target | label | 输入 Tensor 对应的标签值,仅参数名不一致。 |
-| size_average | - | 已弃用 |
-| weight | weight | 手动指定每个类别的权重 |
-| ignore_index | ignore_index | 指定一个忽略的标签值,此标签值不参与计算 |
-| reduce | - | 已弃用 |
-| reduction | reduction | 表示应用于输出结果的规约方式,可选值有:'none', 'mean', 'sum' |
+| input | input | 输入 Tensor。 |
+| target | label | 输入 Tensor 对应的标签值,仅参数名不一致。 |
+| size_average | - | 已弃用,需要转写。 |
+| weight | weight | 手动指定每个类别的权重。 |
+| ignore_index | ignore_index | 指定一个忽略的标签值,此标签值不参与计算。 |
+| reduce | - | 已弃用,需要转写。 |
+| reduction | reduction | 表示应用于输出结果的规约方式,可选值有:'none', 'mean', 'sum'。 |
### 转写示例
+
+#### size_average
+size_average 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.nll_loss(size_average=True)
+
+# Paddle 写法
+paddle.nn.functional.nll_loss(reduction='mean')
+```
+
+size_average 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.nll_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.nll_loss(reduction='sum')
+```
+#### reduce
+reduce 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.nll_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.nll_loss(reduction='sum')
+```
+reduce 为 False
```python
-# PyTorch 的 size_average、 reduce 参数转为 Paddle 的 reduction 参数
-if size_average is None:
- size_average = True
-if reduce is None:
- reduce = True
-
-if size_average and reduce:
- reduction = 'mean'
-elif reduce:
- reduction = 'sum'
-else:
- reduction = 'none'
+# PyTorch 写法
+torch.nn.functional.nll_loss(reduce=False)
+
+# Paddle 写法
+paddle.nn.functional.nll_loss(reduction='none')
+```
+#### reduction
+reduction 为'none'
+```python
+# PyTorch 写法
+torch.nn.functional.nll_loss(reduction='none')
+
+# Paddle 写法
+paddle.nn.functional.nll_loss(reduction='none')
+```
+reduction 为'mean'
+```python
+# PyTorch 写法
+torch.nn.functional.nll_loss(reduction='mean')
+
+# Paddle 写法
+paddle.nn.functional.nll_loss(reduction='mean')
+```
+reduction 为'sum'
+```python
+# PyTorch 写法
+torch.nn.functional.nll_loss(reduction='sum')
+
+# Paddle 写法
+paddle.nn.functional.nll_loss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.normalize.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.normalize.md
index 89245ee3739..f9db42901e7 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.normalize.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.normalize.md
@@ -26,7 +26,7 @@ paddle.nn.functional.normalize(x,
| p | p | 表示范数公式中的指数值 。 |
| dim | axis | 表示要进行归一化的轴 。 |
| eps | epsilon | 表示添加到分母上的值 。 |
-| out | - | 表示输出 Tensor 。 |
+| out | - | 表示输出 Tensor,需要转写。 |
### 转写示例
#### out: 指定输出
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.poisson_nll_loss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.poisson_nll_loss.md
index a20a1c1eddb..ed72f7a3cc7 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.poisson_nll_loss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.poisson_nll_loss.md
@@ -25,18 +25,64 @@ paddle.nn.functional.poisson_nll_loss(input, label, log_input=True, full=False,
| reduction | reduction | 指定应用于输出结果的计算方式。 |
### 转写示例
-#### size_average、reduce
-```python
-# PyTorch 的 size_average、reduce 参数转为 Paddle 的 reduction 参数
-if size_average is None:
- size_average = True
-if reduce is None:
- reduce = True
-
-if size_average and reduce:
- reduction = 'mean'
-elif reduce:
- reduction = 'sum'
-else:
- reduction = 'none'
+
+#### size_average
+size_average 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.poisson_nll_loss(size_average=True)
+
+# Paddle 写法
+paddle.nn.functional.poisson\_nll\_loss(reduction='mean')
+```
+
+size_average 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.poisson_nll_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.poisson\_nll\_loss(reduction='sum')
+```
+#### reduce
+reduce 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.poisson_nll_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.poisson\_nll\_loss(reduction='sum')
+```
+reduce 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.poisson_nll_loss(reduce=False)
+
+# Paddle 写法
+paddle.nn.functional.poisson\_nll\_loss(reduction='none')
+```
+#### reduction
+reduction 为'none'
+```python
+# PyTorch 写法
+torch.nn.functional.poisson_nll_loss(reduction='none')
+
+# Paddle 写法
+paddle.nn.functional.poisson\_nll\_loss(reduction='none')
+```
+reduction 为'mean'
+```python
+# PyTorch 写法
+torch.nn.functional.poisson_nll_loss(reduction='mean')
+
+# Paddle 写法
+paddle.nn.functional.poisson\_nll\_loss(reduction='mean')
+```
+reduction 为'sum'
+```python
+# PyTorch 写法
+torch.nn.functional.poisson_nll_loss(reduction='sum')
+
+# Paddle 写法
+paddle.nn.functional.poisson\_nll\_loss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.soft_margin_loss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.soft_margin_loss.md
index cc12f5e0b08..1aa8c2b0e78 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.soft_margin_loss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.soft_margin_loss.md
@@ -23,23 +23,69 @@ paddle.nn.functional.soft_margin_loss(input,
| ------------- | ------------ | ------------------------------------------------------ |
| input | input | 输入 Tensor 。 |
| target | label | 输入 Tensor 对应的标签值,仅参数名不一致。 |
-| size_average | - | 已弃用 |
-| reduce | - | 已弃用 |
+| size_average | - | 已弃用。需要转写。 |
+| reduce | - | 已弃用。需要转写。 |
| reduction | reduction | 表示应用于输出结果的规约方式,可选值有:'none', 'mean', 'sum'。 |
### 转写示例
+
#### size_average
+size_average 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.soft_margin_loss(size_average=True)
+
+# Paddle 写法
+paddle.nn.functional.soft_margin_loss(reduction='mean')
+```
+
+size_average 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.soft_margin_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.soft_margin_loss(reduction='sum')
+```
+#### reduce
+reduce 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.soft_margin_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.soft_margin_loss(reduction='sum')
+```
+reduce 为 False
```python
-# PyTorch 的 size_average、 reduce 参数转为 Paddle 的 reduction 参数
-if size_average is None:
- size_average = True
-if reduce is None:
- reduce = True
-
-if size_average and reduce:
- reduction = 'mean'
-elif reduce:
- reduction = 'sum'
-else:
- reduction = 'none'
+# PyTorch 写法
+torch.nn.functional.soft_margin_loss(reduce=False)
+
+# Paddle 写法
+paddle.nn.functional.soft_margin_loss(reduction='none')
+```
+#### reduction
+reduction 为'none'
+```python
+# PyTorch 写法
+torch.nn.functional.soft_margin_loss(reduction='none')
+
+# Paddle 写法
+paddle.nn.functional.soft_margin_loss(reduction='none')
+```
+reduction 为'mean'
+```python
+# PyTorch 写法
+torch.nn.functional.soft_margin_loss(reduction='mean')
+
+# Paddle 写法
+paddle.nn.functional.soft_margin_loss(reduction='mean')
+```
+reduction 为'sum'
+```python
+# PyTorch 写法
+torch.nn.functional.soft_margin_loss(reduction='sum')
+
+# Paddle 写法
+paddle.nn.functional.soft_margin_loss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.triplet_margin_loss.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.triplet_margin_loss.md
index d854501f133..cfeee44320b 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.triplet_margin_loss.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.functional.triplet_margin_loss.md
@@ -32,29 +32,75 @@ paddle.nn.functional.triplet_margin_loss(input,
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| anchor | input | 输入 Tensor,仅参数名不一致。 |
-| positive | positive | 输入正样本 |
-| negative | negative | 输入负样本 |
-| margin | margin | 手动指定间距 |
-| p | p | 指定范数 |
-| eps | epsilon | 防止除数为零的常数 |
-| swap | swap | 是否进行交换 |
-| size_average | - | 已弃用 |
-| reduce | - | 已弃用 |
-| reduction | reduction | 表示应用于输出结果的规约方式,可选值有:'none', 'mean', 'sum' |
+| positive | positive | 输入正样本。 |
+| negative | negative | 输入负样本。 |
+| margin | margin | 手动指定间距。 |
+| p | p | 指定范数。 |
+| eps | epsilon | 防止除数为零的常数。 |
+| swap | swap | 是否进行交换。 |
+| size_average | - | 已弃用。 需要转写。 |
+| reduce | - | 已弃用。需要转写。 |
+| reduction | reduction | 表示应用于输出结果的规约方式,可选值有:'none', 'mean', 'sum'。 |
### 转写示例
+
#### size_average
+size_average 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.triplet_margin_loss(size_average=True)
+
+# Paddle 写法
+paddle.nn.functional.triplet_margin_loss(reduction='mean')
+```
+
+size_average 为 False
+```python
+# PyTorch 写法
+torch.nn.functional.triplet_margin_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.triplet_margin_loss(reduction='sum')
+```
+#### reduce
+reduce 为 True
+```python
+# PyTorch 写法
+torch.nn.functional.triplet_margin_loss(size_average=False)
+
+# Paddle 写法
+paddle.nn.functional.triplet_margin_loss(reduction='sum')
+```
+reduce 为 False
```python
-# PyTorch 的 size_average、 reduce 参数转为 Paddle 的 reduction 参数
-if size_average is None:
- size_average = True
-if reduce is None:
- reduce = True
-
-if size_average and reduce:
- reduction = 'mean'
-elif reduce:
- reduction = 'sum'
-else:
- reduction = 'none'
+# PyTorch 写法
+torch.nn.functional.triplet_margin_loss(reduce=False)
+
+# Paddle 写法
+paddle.nn.functional.triplet_margin_loss(reduction='none')
+```
+#### reduction
+reduction 为'none'
+```python
+# PyTorch 写法
+torch.nn.functional.triplet_margin_loss(reduction='none')
+
+# Paddle 写法
+paddle.nn.functional.triplet_margin_loss(reduction='none')
+```
+reduction 为'mean'
+```python
+# PyTorch 写法
+torch.nn.functional.triplet_margin_loss(reduction='mean')
+
+# Paddle 写法
+paddle.nn.functional.triplet_margin_loss(reduction='mean')
+```
+reduction 为'sum'
+```python
+# PyTorch 写法
+torch.nn.functional.triplet_margin_loss(reduction='sum')
+
+# Paddle 写法
+paddle.nn.functional.triplet_margin_loss(reduction='sum')
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.utils.clip_grad_norm_.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.utils.clip_grad_norm_.md
index 66de06f7ef3..04d6a0b47ac 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.utils.clip_grad_norm_.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.utils.clip_grad_norm_.md
@@ -26,4 +26,4 @@ paddle 参数和 torch 参数完全一致,具体如下:
| max_norm | max_norm | 梯度的最大范数。 |
| norm_type | norm_type | 所用 p-范数类型。可以是无穷范数的`inf`。 |
| error_if_nonfinite | error_if_nonfinite | 如果为 True,且如果来自:attr:parameters`的梯度的总范数为`nan、inf`或-inf`,则抛出错误。 |
-| foreach | - | 是否使用优化器的 foreach 实现。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除 |
+| foreach | - | 是否使用优化器的 foreach 实现。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.utils.clip_grad_value_.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.utils.clip_grad_value_.md
index 76e25d8b29e..86d8852b474 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.utils.clip_grad_value_.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.nn.utils.clip_grad_value_.md
@@ -20,4 +20,4 @@ paddle 参数和 torch 参数完全一致,具体如下:
| ----------- | ------------ | -------------------------------------- |
| parameters | parameters | 需要参与梯度裁剪的一个 Tensor 或者多个 Tensor。 |
| clip_value | clip_value | 裁剪的指定值(非负数)。 |
-| foreach | - | 是否使用优化器的 foreach 实现。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除 |
+| foreach | - | 是否使用优化器的 foreach 实现。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.onnx.export.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.onnx.export.md
index a0d518422cd..8342effa295 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.onnx.export.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.onnx.export.md
@@ -34,25 +34,50 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| - | configs | 其他用于兼容的存储配置选项,PyTorch 无此参数,Paddle 保持默认即可。 |
### 转写示例
-#### 参数类型不同
+#### f、model 参数转写
```python
# PyTorch 写法
-torch.onnx.export(
+class SimpleModel(nn.Module):
+ def __init__(self):
+ super(SimpleModel, self).__init__()
+ self.fc1 = nn.Linear(3, 3)
+ self.fc2 = nn.Linear(3, 1)
+
+ def forward(self, x):
+ x = torch.relu(self.fc1(x))
+ x = self.fc2(x)
+ return x
+
+model = SimpleModel()
+x = torch.randn(1, 3)
+a = torch.onnx.export(
model,
- (
- x,
- {y: z},
- {}
- ),
- "test.onnx.pb"
+ f="simple_model.onnx",
)
-
# Paddle 写法
-model = Logic()
-x = paddle.to_tensor([1])
-y = paddle.to_tensor([2])
-# Static and run model.
-paddle.jit.to_static(model)
-out = model(x, y, z=True)
-paddle.onnx.export(model, 'pruned', input_spec=[x], output_spec=[out])
+def onnx_export(model,f):
+ model = Logic()
+ paddle.jit.to_static(model)
+ last_dot_index = filename.rfind('.')
+ if last_dot_index == -1:
+ path = f
+ else:
+ path = f[:last_dot_index]
+ return paddle.onnx.export(model, path)
+
+class SimpleModel(paddle.nn.Layer):
+ def __init__(self):
+ super(SimpleModel, self).__init__()
+ self.fc1 = paddle.nn.Linear(in_features=3, out_features=3)
+ self.fc2 = paddle.nn.Linear(in_features=3, out_features=1)
+
+ def forward(self, x):
+ x = paddle.nn.functional.relu(x=self.fc1(x))
+ x = self.fc2(x)
+ return x
+
+
+model = SimpleModel()
+x = paddle.randn(1, 3)
+a = onnx_export(model, "simple_model.onnx")
```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.ASGD.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.ASGD.md
index cca6e50b212..a05cd66ed06 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.ASGD.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.ASGD.md
@@ -30,19 +30,19 @@ Pytorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------- |
-| params | parameters | 表示指定优化器需要优化的参数,仅参数名不一致 |
-| lr | learning_rate | 学习率,用于参数更新的计算。参数默认值不一致, Pytorch 默认为 `0.0001`, Paddle 默认为 `0.001`,Paddle 需保持与 Pytorch 一致 |
-| lambd | - | 衰变项,与 weight_decay 功能重叠,可直接删除 |
-| alpha | - | eta 更新的 power,可直接删除 |
-| t0 | - | 开始求平均值的点,可直接删除 |
-| weight_decay | weight_decay | 权重衰减。参数默认值不一致, Pytorch 默认为 `0`, Paddle 默认为 `None`,Paddle 需保持与 Pytorch 一致 |
-| foreach | - | 是否使用优化器的 foreach 实现。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除 |
-| maximize | - | 根据目标最大化参数,而不是最小化。Paddle 无此参数,暂无转写方式 |
-| differentiable| - | 是否应通过训练中的优化器步骤进行自动微分。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除 |
-| - | batch_num | 完成一个 epoch 所需迭代的次数。 PyTorch 无此参数。假设样本总数为 all_size,Paddle 需将 batch_num 设置为 all_size / batch_size |
-| - | grad_clip | 梯度裁剪的策略。 PyTorch 无此参数,Paddle 保持默认即可 |
-| - | multi_precision | 在基于 GPU 设备的混合精度训练场景中,该参数主要用于保证梯度更新的数值稳定性。 PyTorch 无此参数,Paddle 保持默认即可 |
-| - | name | 一般情况下无需设置。 PyTorch 无此参数,Paddle 保持默认即可 |
+| params | parameters | 表示指定优化器需要优化的参数,仅参数名不一致。 |
+| lr | learning_rate | 学习率,用于参数更新的计算。参数默认值不一致, Pytorch 默认为 `0.0001`, Paddle 默认为 `0.001`,Paddle 需保持与 Pytorch 一致。 |
+| lambd | - | 衰变项,与 weight_decay 功能重叠,可直接删除。 |
+| alpha | - | eta 更新的 power,可直接删除。 |
+| t0 | - | 开始求平均值的点,可直接删除。 |
+| weight_decay | weight_decay | 权重衰减。参数默认值不一致, Pytorch 默认为 `0`, Paddle 默认为 `None`,Paddle 需保持与 Pytorch 一致。 |
+| foreach | - | 是否使用优化器的 foreach 实现。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
+| maximize | - | 根据目标最大化参数,而不是最小化。Paddle 无此参数,暂无转写方式。 |
+| differentiable| - | 是否应通过训练中的优化器步骤进行自动微分。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
+| - | batch_num | 完成一个 epoch 所需迭代的次数。 PyTorch 无此参数。假设样本总数为 all_size,Paddle 需将 batch_num 设置为 all_size / batch_size。 |
+| - | grad_clip | 梯度裁剪的策略。 PyTorch 无此参数,Paddle 保持默认即可。 |
+| - | multi_precision | 在基于 GPU 设备的混合精度训练场景中,该参数主要用于保证梯度更新的数值稳定性。 PyTorch 无此参数,Paddle 保持默认即可。 |
+| - | name | 一般情况下无需设置。 PyTorch 无此参数,Paddle 保持默认即可。 |
### 相关问题
torch 当前版本的 ASGD 实现并不完善。转换过来的 paddle ASGD 会与 torch 的不一致(不影响收敛),但是可以正常使用。如果强需求保证转换前后一致,可以自行尝试其他优化器。
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.Adam.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.Adam.md
index 0946a4c182f..a829f8d39cb 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.Adam.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.Adam.md
@@ -41,7 +41,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| betas | beta1, beta2 | 一阶矩估计的指数衰减率。PyTorch 为元祖形式,Paddle 为分开的两个参数。默认值分别一致。 |
| eps | epsilon | 保持数值稳定性的短浮点类型值。仅参数名不一致。 |
| weight_decay | weight_decay | 表示权重衰减系数,参数默认值不一致, PyTorch 默认为`0`, Paddle 默认为`None`,Paddle 需保持与 PyTorch 一致。 |
-| amsgrad | - | 是否使用该算法的 AMSGrad 变体。参数一致。 |
+| amsgrad | amsgrad | 是否使用该算法的 AMSGrad 变体。参数一致。 |
| foreach | - | 是否使用优化器的 foreach 实现。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
| maximize | - | 根据目标最大化参数,而不是最小化。Paddle 无此参数,暂无转写方式。 |
| capturable | - | 在 CUDA 图中捕获此实例是否安全。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.AdamW.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.AdamW.md
index ef520c8a913..3a5fc41c8ad 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.AdamW.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.AdamW.md
@@ -42,7 +42,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| betas | beta1, beta2 | 一阶矩估计的指数衰减率。PyTorch 为元祖形式,Paddle 为分开的两个参数。默认值分别一致。 |
| eps | epsilon | 保持数值稳定性的短浮点类型值。仅参数名不一致。 |
| weight_decay | weight_decay | 表示权重衰减系数。参数名和默认值均一致。 |
-| amsgrad | - | 是否使用该算法的 AMSGrad 变体。参数一致。 |
+| amsgrad | amsgrad | 是否使用该算法的 AMSGrad 变体。参数一致。 |
| maximize | - | 根据目标最大化参数,而不是最小化。Paddle 无此参数,暂无转写方式。 |
| foreach | - | 是否使用优化器的 foreach 实现。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
| capturable | - | 在 CUDA 图中捕获此实例是否安全。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.RMSprop.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.RMSprop.md
index 9db8bccdc92..86f3618fdf0 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.RMSprop.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.RMSprop.md
@@ -39,7 +39,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| weight_decay | weight_decay | 表示权重衰减系数。参数默认值不一致, PyTorch 默认为`0`, Paddle 默认为`None`,Paddle 需保持与 PyTorch 一致。 |
| momentum | momentum | 动量因子。参数完全一致。 |
| centered | centered | 如果为 True,则通过梯度的估计方差,对梯度进行归一化。参数完全一致。 |
-| foreach | - | 是否使用优化器的 foreach 实现。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除 |
+| foreach | - | 是否使用优化器的 foreach 实现。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
| maximize | - | 根据目标最大化参数,而不是最小化。Paddle 无此参数,暂无转写方式。 |
| differentiable | - | 是否应通过训练中的优化器步骤进行自动微分。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
| - | grad_clip | 梯度裁剪的策略。 PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.SGD.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.SGD.md
index db2613d47fa..1b68a875fdc 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.SGD.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.optim.SGD.md
@@ -34,6 +34,6 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| weight_decay | weight_decay | 表示权重衰减系数。参数默认值不一致, PyTorch 默认为`0`, Paddle 默认为`None`,Paddle 需保持与 PyTorch 一致。 |
| nesterov | - | 打开 nesterov 动量。Paddle 无此参数,暂无转写方式。 |
| maximize | - | 根据目标最大化参数,而不是最小化。Paddle 无此参数,暂无转写方式。 |
-| foreach | - | 是否使用优化器的 foreach 实现。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除 |
+| foreach | - | 是否使用优化器的 foreach 实现。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
| differentiable | - | 是否应通过训练中的优化器步骤进行自动微分。Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
| - | grad_clip | 梯度裁剪的策略。 PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.ormqr.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.ormqr.md
index 6759df389a6..955594e3655 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.ormqr.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.ormqr.md
@@ -15,11 +15,11 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| --------- | ------------ | ---------------------------------------------- |
-| input | x | 输入的参数,用于表示矩阵 Q ,仅参数名不一致 |
-| input2 | tau | Householder 反射系数,仅参数名不一致 |
-| input3 | y | 用于矩阵乘积,仅参数名不一致 |
-| left | left | 决定了矩阵乘积运算的顺序 |
-| transpose | transpose | 决定矩阵 Q 是否共轭转置变换 |
+| input | x | 输入的参数,用于表示矩阵 Q ,仅参数名不一致。 |
+| input2 | tau | Householder 反射系数,仅参数名不一致。 |
+| input3 | y | 用于矩阵乘积,仅参数名不一致。 |
+| left | left | 决定了矩阵乘积运算的顺序。 |
+| transpose | transpose | 决定矩阵 Q 是否共轭转置变换。 |
| out | - | 表示输出的 Tensor ,Paddle 无此参数,需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.profiler.profile.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.profiler.profile.md
index 1af5bf0ecdb..042e69c3bd6 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.profiler.profile.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.profiler.profile.md
@@ -28,7 +28,6 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| - | timer_only | 如果设置为 True,将只统计模型的数据读取和每一个迭代所消耗的时间,而不进行性能分析,PyTorch 无此参数,Paddle 保持默认即可。 |
### 转写示例
-#### 参数类型不同
```python
# PyTorch 写法:
with torch.profiler.profile(
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.qr.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.qr.md
index f0201729943..45630a2a117 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.qr.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.qr.md
@@ -20,7 +20,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| out | - | 表示输出的 Tensor 元组。 Paddle 无此参数,需要转写。 |
### 转写示例
-### some:控制 QR 分解的行为
+#### some:控制 QR 分解的行为
```python
# 当进行完整的 QR 分解时
# PyTorch 写法
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.randn_like.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.randn_like.md
deleted file mode 100644
index 18d57f87765..00000000000
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.randn_like.md
+++ /dev/null
@@ -1,34 +0,0 @@
-## [ torch 参数更多 ]torch.randn_like
-### [torch.randn_like](https://pytorch.org/docs/stable/generated/torch.randn_like.html#torch.randn_like)
-```python
-torch.randn_like(input, *, dtype=None, layout=None, device=None, requires_grad=False, memory_format=torch.preserve_format)
-```
-
-### [paddle.randn_like](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/randn_like_cn.html#randn_like)
-```python
-paddle.randn_like(x, dtype=None, name=None)
-```
-
-PyTorch 相比 Paddle 支持更多其他参数,具体如下:
-
-### 参数映射
-
-| PyTorch | PaddlePaddle | 备注 |
-| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor,仅参数名不一致。 |
-| dtype | dtype | 表示数据类型。 |
-| layout | - | 表示布局方式,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
-| device | - | 表示 Tensor 存放位置,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
-| requires_grad | - | 表示是否不阻断梯度传导,Paddle 无此参数,需要转写。 |
-| memory_format | - | 表示内存格式, Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
-
-### 转写示例
-#### requires_grad:表示是否不阻断梯度传导
-```python
-# PyTorch 写法
-y = torch.randn_like(x,requires_grad=True)
-
-# Paddle 写法
-y = paddle.randn_like(x)
-y.stop_gradient = False
-```
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.scalar_tensor.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.scalar_tensor.md
index a6883f5326d..68fdc69e3b8 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.scalar_tensor.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.scalar_tensor.md
@@ -1,5 +1,5 @@
## [ torch 参数更多 ]torch.scalar_tensor
-### [torch.scalar_tensor]
+### [torch.scalar_tensor](https://docs.pytorch.org/executorch/stable/extension-tensor.html#:~:text=can%20create%20a-,scalar%20tensor,-with%20scalar_tensor)
```python
torch.scalar_tensor(s,
dtype=torch.float32,
@@ -27,7 +27,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| layout | - | 数据布局格式,Paddle 无此参数。一般对训练结果影响不大,可直接删除。 |
| device | place | 表示 Tensor 存放设备位置,两者参数类型不相同,需要转写。 |
| requires_grad | stop_gradient | 表示是否计算梯度, 两者参数意义不相同,Paddle 输入与 PyTorch 逻辑相反。需要转写。 |
-| pin_memeory | - | 表示是否使用锁页内存, Paddle 无此参数,需要转写。 Paddle 需要对结果使用 padlde.Tensor.pin_memory()。 |
+| pin_memory | - | 表示是否使用锁页内存, Paddle 无此参数,需要转写。 Paddle 需要对结果使用 padlde.Tensor.pin_memory()。 |
### 转写示例
#### device: Tensor 的设备
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.sinh.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.sinh.md
index af1221533d8..aac57055b9b 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.sinh.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.sinh.md
@@ -17,8 +17,8 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.sparse.softmax.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.sparse.softmax.md
index 40e36b62a85..de890674e48 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.sparse.softmax.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.sparse.softmax.md
@@ -19,7 +19,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| dim | axis | 指定对输入 SparseTensor 计算 softmax 的轴,Paddle 的默认值:-1。仅参数名不一致。|
| dtype | - | 指定数据类型,可选项,PyTorch 默认值为 None,Paddle 无此参数,需要转写。|
### 转写示例
-#### dytpe:指定数据类型
+#### dtype:指定数据类型
```Python
# PyTorch 写法
y = torch.sparse.softmax(x, dim=-1, dtype=torch.float32)
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.special.log1p.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.special.log1p.md
index 70cf51535fb..5daea121938 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.special.log1p.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.special.log1p.md
@@ -17,8 +17,8 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.special.sinc.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.special.sinc.md
index fdef8e44fc6..921f491d09e 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.special.sinc.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.special.sinc.md
@@ -13,8 +13,8 @@ paddle.sinc(x, name=None)
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ----------------------------------------------------------------------------- |
-| input | x | 表示输出的 Tensor, 仅参数名不一致 |
-| out | - | 表示输出的 Tensor,Paddle 无此参数。 |
+| input | x | 表示输出的 Tensor, 仅参数名不一致。 |
+| out | - | 表示输出的 Tensor,Paddle 无此参数,需要转写。 |
### 转写示例
#### out:指定输出
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.square.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.square.md
index 0ec5d71e2e7..ea94074fbf8 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.square.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.square.md
@@ -17,8 +17,8 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
-| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
-| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
+| input | x | 表示输入的 Tensor ,仅参数名不一致。 |
+| out | - | 表示输出的 Tensor , Paddle 无此参数,需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.stft.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.stft.md
index fb387b742c9..a3c78c8dff7 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.stft.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.stft.md
@@ -42,7 +42,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| pad_mode | pad_mode | 当 center 为 True 时,确定 padding 的模式。 |
| normalized | normalized | 是否将傅里叶变换的结果乘以值为 1/sqrt(n) 的缩放系数。 |
| onesided | onesided | 是否只返回傅里叶变换结果的一半频点值。默认为 None,此时根据输入数据类型自动确定。当输入信号或窗函数为复数时,设置为 False;当输入为实信号时,设置为 True。 |
-| return_complex| - | 表示当输入为复数时,是否以复数形式返回,还是将实部与虚部分开以实数形式返回。Paddle 目前只支持返回复数,分开返回实部与虚部的情况,需要使用 as_real 进行转写。 |
+| return_complex| - | 表示当输入为复数时,是否以复数形式返回,还是将实部与虚部分开以实数形式返回。Paddle 目前只支持返回复数,分开返回实部与虚部的情况,需要转写。 |
### 转写示例
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.unique.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.unique.md
index fd475611596..589cea49aba 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.unique.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.unique.md
@@ -25,7 +25,7 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| PyTorch | PaddlePaddle | 备注 |
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 表示输入 Tensor。 |
-| sorted | - | 表示是否按升序返回排列,Paddle 无此参数。转换时直接删除即可,PyTorch 目前忽略了此参数。 |
+| sorted | - | 表示是否按升序返回排列,Paddle 无此参数。可直接删除,PyTorch 目前忽略了此参数。 |
| - | return_index | 表示是否返回独有元素在输入 Tensor 中的索引,PyTorch 无此参数。Paddle 保持默认即可。 |
| return_inverse| return_inverse| 表示是否返回输入 Tensor 的元素对应在独有元素中的索引。 |
| return_counts | return_counts| 表示是否返回每个独有元素在输入 Tensor 中的个数。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.utils.data.DataLoader.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.utils.data.DataLoader.md
index 6c6a5e5431d..49647fade57 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.utils.data.DataLoader.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.utils.data.DataLoader.md
@@ -59,8 +59,8 @@ paddle.io.DataLoader(dataset,
| prefetch_factor | - | 表示每个 worker 预先加载的数据数量,Paddle 无此参数,暂无转写方式。 |
| persistent_workers | - | 表示数据集使用一次后,数据加载器将会不会关闭工作进程,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
| pin_memory_device | - | 数据加载器是否在返回 Tensor 之前将 Tensor 复制到设备固定存储器中,Paddle 无此参数,一般对网络训练结果影响不大,可直接删除。 |
-| - | feed_list | 表示 feed 变量列表,PyTorch 无此参数,Paddle 保持默认即可 |
-| - | places | 数据需要放置到的 Place 列表,PyTorch 无此参数,Paddle 保持默认即可 |
-| - | return_list | 每个设备上的数据是否以 list 形式返回,PyTorch 无此参数,Paddle 保持默认即可 |
-| - | use_buffer_reader | 表示是否使用缓存读取器,PyTorch 无此参数,Paddle 保持默认即可 |
-| - | use_shared_memory | 表示是否使用共享内存来提升子进程将数据放入进程间队列的速度,PyTorch 无此参数,Paddle 保持默认即可 |
+| - | feed_list | 表示 feed 变量列表,PyTorch 无此参数,Paddle 保持默认即可。 |
+| - | places | 数据需要放置到的 Place 列表,PyTorch 无此参数,Paddle 保持默认即可。 |
+| - | return_list | 每个设备上的数据是否以 list 形式返回,PyTorch 无此参数,Paddle 保持默认即可。 |
+| - | use_buffer_reader | 表示是否使用缓存读取器,PyTorch 无此参数,Paddle 保持默认即可。 |
+| - | use_shared_memory | 表示是否使用共享内存来提升子进程将数据放入进程间队列的速度,PyTorch 无此参数,Paddle 保持默认即可。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.vdot.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.vdot.md
index 8bf9534f800..aff792382d5 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.vdot.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/torch.vdot.md
@@ -16,7 +16,7 @@ torch 参数更多,具体如下:
| ------------- | ------------ | ------------------------------------------------------ |
| input | x | 输入的向量。 |
| other | y | 被乘的向量。 |
-| out | - | 指定输出。Paddle 无此参数,需要转写 |
+| out | - | 指定输出。Paddle 无此参数,需要转写。 |
### 转写示例
#### out:指定输出
diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/transformers.AddedToken.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/transformers.AddedToken.md
index ca73b07c493..2034a828dd6 100644
--- a/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/transformers.AddedToken.md
+++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/torch_more_args/transformers.AddedToken.md
@@ -19,5 +19,5 @@ PyTorch 相比 Paddle 支持更多其他参数,具体如下:
| single_word | single_word | token 是否视为独立的词。 |
| lstrip | lstrip | 是否移除左侧空白符。 |
| rstrip | rstrip | 是否移除左侧空白符。 |
-| special | - | 是否有特殊的处理方式,Paddle 暂不支持该参数. |
+| special | - | 是否有特殊的处理方式,Paddle 暂不支持该参数。 |
| normalized | normalized | 是否进行规范化处理。 |
diff --git a/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_format_cn.md b/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_format_cn.md
index 5c56759ddb3..7c3688e7966 100644
--- a/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_format_cn.md
+++ b/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_format_cn.md
@@ -48,7 +48,7 @@ Paddle API 签名
1. **API 完全一致**:无需映射文档。
-2. **仅 API 调用方式不一致**:对每个不一致的调用方式都需要**转写示例**,同时需要在备注列里注明 `[不一致的用法说明],需要转写`。
+2. **仅 API 调用方式不一致**:对每个不一致的调用方式都需要**转写示例**。
3. **仅参数名不一致**:无需转写示例,但需要在备注列里注明哪些参数 `仅参数名不一致`。
diff --git a/docs/guides/model_convert/convert_from_pytorch/tools/.gitignore b/docs/guides/model_convert/convert_from_pytorch/tools/.gitignore
index cb85c8cbd72..4de583052ac 100644
--- a/docs/guides/model_convert/convert_from_pytorch/tools/.gitignore
+++ b/docs/guides/model_convert/convert_from_pytorch/tools/.gitignore
@@ -27,3 +27,4 @@ link_warnings.txt
url_warnings.txt
api_difference_error.txt
diff_doc_warnings.txt
+validate_api_difference_error.txt
diff --git a/docs/guides/model_convert/convert_from_pytorch/tools/validate_api_difference.py b/docs/guides/model_convert/convert_from_pytorch/tools/validate_api_difference.py
new file mode 100644
index 00000000000..31b7fd72d97
--- /dev/null
+++ b/docs/guides/model_convert/convert_from_pytorch/tools/validate_api_difference.py
@@ -0,0 +1,132 @@
+import json
+import os
+from pathlib import Path
+
+from utils import extract_no_need_convert_list
+
+
+def validate_api_mappings():
+ sum = 0
+ # 获取当前脚本所在目录
+ current_dir = Path(os.path.dirname(os.path.abspath(__file__)))
+
+ # 加载API差异数据
+ with open(
+ current_dir / "api_difference_info.json", "r", encoding="utf-8"
+ ) as f:
+ api_diff = json.load(f)
+
+ # 加载API映射数据
+ with open(current_dir / "api_mapping.json", "r", encoding="utf-8") as f:
+ api_map = json.load(f)
+
+ no_need_list = extract_no_need_convert_list(
+ str(current_dir) + "/global_var.py"
+ )
+
+ # 准备错误报告文件
+ error_file = current_dir / "validate_api_difference_error.txt"
+
+ # 任务1: 检查api_mapping中存在Matcher的条目是否在差异文档中有对应
+ with open(error_file, "w", encoding="utf-8") as err_file:
+ for api_key, api_value in api_map.items():
+ if (
+ api_value.get("Matcher") is not None
+ and api_key not in no_need_list
+ ):
+ if not any(entry["src_api"] == api_key for entry in api_diff):
+ err_file.write(
+ f"WARNING: api_mapping entry '{api_key}' not found in api_difference_info.json\n"
+ )
+ sum += 1
+
+ # 任务2: 检查差异文档中的dst_api是否与api_mapping中paddle_api一致
+ for entry in api_diff:
+ if "dst_api" not in entry:
+ continue
+
+ found = False
+ for api_key, api_value in api_map.items():
+ if api_value.get("paddle_api") == entry["dst_api"]:
+ found = True
+ break
+
+ if not found:
+ err_file.write(
+ f"WARNING: api_difference_info entry '{entry['src_api']}' has dst_api '{entry['dst_api']}' not found in api_mapping.json\n"
+ )
+ sum += 1
+
+ # 任务3: 检查api_mapping中的kwargs_change是否在api_difference_info中
+ for api_key, api_value in api_map.items():
+ if "kwargs_change" not in api_value or api_key in no_need_list:
+ continue
+
+ for src_arg, dst_arg in api_value["kwargs_change"].items():
+ found = False
+ for entry in api_diff:
+ if "args_mapping" not in entry:
+ continue
+ for mapping in entry["args_mapping"]:
+ if (
+ mapping["src_arg"] == src_arg
+ and mapping["dst_arg"] == dst_arg
+ ):
+ found = True
+ break
+ if found:
+ break
+
+ if not found:
+ err_file.write(
+ f"ERROR: Parameter mapping '{src_arg} -> {dst_arg}' in api_mapping for '{api_key}' not found in api_difference_info.json\n"
+ )
+ sum += 1
+
+ # 任务4: 检查api_mapping中的args_list是否都在api_difference_info的src_signature中
+ for api_key, api_value in api_map.items():
+ if "args_list" not in api_value or api_key in no_need_list:
+ continue
+
+ # 获取api_difference_info中对应的entry
+ entry = next((e for e in api_diff if e["src_api"] == api_key), None)
+ if entry is None:
+ err_file.write(
+ f"ERROR: api_mapping for '{api_key}' not found in api_difference_info.json, so cannot check args_list\n"
+ )
+ sum += 1
+ continue
+
+ if "src_signature" not in entry or not entry["src_signature"]:
+ err_file.write(
+ f"ERROR: api_difference_info for '{api_key}' has no src_signature\n"
+ )
+ sum += 1
+ continue
+
+ # 提取第一个src_signature的参数名列表
+ src_signature = entry["src_signature"][0]
+ if "args" not in src_signature:
+ err_file.write(
+ f"ERROR: api_difference_info for '{api_key}' has no args in src_signature\n"
+ )
+ sum += 1
+ continue
+ src_args = [arg["arg_name"] for arg in src_signature["args"]]
+
+ # 检查api_mapping中的args_list是否都在src_args中
+ for arg in api_value["args_list"]:
+ if arg not in src_args:
+ err_file.write(
+ f"ERROR: Parameter '{arg}' in api_mapping for '{api_key}' not found in api_difference_info's src_signature\n"
+ )
+ sum += 1
+
+ print(
+ f"{sum} api error found in api_mapping.json and api_difference_info.json"
+ )
+ return sum
+
+
+if __name__ == "__main__":
+ validate_api_mappings()
diff --git a/docs/guides/model_convert/convert_from_pytorch/tools/validate_api_difference_format.py b/docs/guides/model_convert/convert_from_pytorch/tools/validate_api_difference_format.py
index 4b6221a30de..c6aca23149a 100644
--- a/docs/guides/model_convert/convert_from_pytorch/tools/validate_api_difference_format.py
+++ b/docs/guides/model_convert/convert_from_pytorch/tools/validate_api_difference_format.py
@@ -1,15 +1,16 @@
+from __future__ import annotations
+
import os
import re
+import sys
+import traceback
-def main():
- # 获取脚本所在目录
- script_dir = os.path.dirname(os.path.abspath(__file__))
- # API对比文档目录路径
- api_difference_dir = os.path.join(script_dir, "../api_difference")
+class APIDifferenceValidator:
+ """API差异文档校验器"""
- # 定义类别映射:英文目录名 -> 中文类别名称
- category_map = {
+ # 类别映射
+ CATEGORY_MAP = {
"invok_only_diff": "仅 API 调用方式不一致",
"args_name_diff": "仅参数名不一致",
"paddle_more_args": "paddle 参数更多",
@@ -21,265 +22,791 @@ def main():
"composite_implement": "组合替代实现",
}
- # 定义每个类别的总结语句
- summary_map = {
- "invok_only_diff": "两者功能一致,但调用方式不一致,具体如下:",
- "args_name_diff": "两者功能一致且参数用法一致,仅参数名不一致,具体如下:",
- "paddle_more_args": "其中 Paddle 相比 PyTorch 支持更多其他参数,具体如下:",
- "args_default_value_diff": "两者功能一致且参数用法一致,参数默认值不一致,具体如下:",
- "torch_more_args": "PyTorch 相比 Paddle 支持更多其他参数,具体如下:",
- "input_args_usage_diff": "其中 PyTorch 的输入参数与 Paddle 用法不一致,具体如下:",
- "input_args_type_diff": "两者功能一致但参数类型不一致,具体如下:",
- "output_args_type_diff": "两者功能一致但返回参数类型不同,具体如下:",
- "composite_implement": "Paddle 无此 API,需要组合实现。",
- }
-
- # 初始化统计变量
- total_files = 0
- valid_files = 0
- errors = []
-
- # 遍历所有类别目录
- for category_dir in category_map:
- category_path = os.path.join(api_difference_dir, category_dir)
- if not os.path.isdir(category_path):
- continue
-
- # 遍历目录下的所有.md文件
- for file_name in os.listdir(category_path):
- if not file_name.endswith(".md"):
+ # 需要转写校验的类别
+ REWRITE_VALIDATION_CATEGORIES = [
+ "input_args_usage_diff",
+ "input_args_type_diff",
+ "output_args_type_diff",
+ "composite_implement",
+ ]
+
+ # 有效的备注结尾
+ VALID_REMARKS = ["需要转写", "暂无转写方式", "可直接删除"]
+
+ def __init__(self, api_difference_dir: str):
+ self.api_difference_dir = api_difference_dir
+ self.total_files = 0
+ self.valid_files = 0
+ self.errors = []
+
+ def log_error_with_details(
+ self,
+ error_file: str,
+ error_message: str,
+ exception: Exception | None,
+ current_line: str = "",
+ ) -> None:
+ """记录错误信息及其详细信息到文件"""
+ try:
+ with open(error_file, "a", encoding="utf-8") as f:
+ f.write(f"{error_message}\n")
+ if exception:
+ f.write(f"异常类型: {type(exception).__name__}\n")
+ f.write(f"异常信息: {exception!s}\n")
+ f.write(f"异常追踪: {traceback.format_exc()}\n")
+ if current_line:
+ f.write(f"当前行内容: {current_line}\n")
+ f.write("-" * 80 + "\n")
+ except Exception as e:
+ print(f"写入错误文件失败: {e}")
+
+ def validate_parameter_table_remarks(
+ self,
+ table_lines: list[str],
+ category_dir: str,
+ file_path: str,
+ section_index: int,
+ ) -> tuple[bool, list[str]]:
+ """校验参数映射表格的备注列"""
+ errors = []
+ requires_rewrite_params = set()
+
+ # 跳过表头行(前两行)
+ for i, line in enumerate(table_lines[2:], start=2):
+ if not line.strip() or not line.startswith("|"):
continue
- total_files += 1
- file_path = os.path.join(category_path, file_name)
- torch_api_name = file_name[:-3] # 去掉.md后缀
-
- # 读取文件内容并移除空行
- try:
- with open(file_path, "r", encoding="utf-8") as f:
- lines = [line.strip() for line in f if line.strip() != ""]
- lines = [line.replace(r"\_", "_") for line in lines]
- except Exception as e:
- errors.append(f"读取文件失败: {file_path} - {e!s}")
+ # 解析表格行
+ parts = [part.strip() for part in line.split("|") if part.strip()]
+ if len(parts) < 3:
continue
- current_index = 0
- error_found = False
+ pytorch_param, paddle_param, remark = parts[0], parts[1], parts[2]
- # 1. 检查类别标题 (## [ 中文类别 ]torch_api_name)
- expected_title = (
- f"## [ {category_map[category_dir]} ]{torch_api_name}"
- )
- if (
- current_index >= len(lines)
- or lines[current_index] != expected_title
- ):
- error_found = True
+ # 检查备注是否以句号结尾
+ if remark and not remark.endswith("。"):
errors.append(
- f"文件格式错误: {file_path} - 第一行应为 '{expected_title}'"
+ f"备注未以句号结尾: {file_path} - 参数 '{pytorch_param}' 的备注: '{remark}'"
)
- current_index += 1
- # 2. 检查torch超链接 (### [torch_api_name](url))
- if current_index >= len(lines) or not re.match(
- r"^### \[" + re.escape(torch_api_name) + r"\]\(.*\)$",
- lines[current_index],
+ # 检查torch参数更多类别的特殊要求
+ if category_dir == "torch_more_args" and (
+ (pytorch_param != "-" and paddle_param == "-")
+ or "需要转写" in remark
):
- error_found = True
- errors.append(
- f"文件格式错误: {file_path} - 第二行应为torch超链接"
- )
- current_index += 1
+ if not any(
+ valid_remark in remark
+ for valid_remark in self.VALID_REMARKS
+ ):
+ errors.append(
+ f"缺少转写说明: {file_path} - 参数 '{pytorch_param}' 的备注应包含{self.VALID_REMARKS}之一"
+ )
+
+ if "需要转写" in remark:
+ requires_rewrite_params.add(pytorch_param)
- # 3. 检查torch代码块开始 (```python)
+ # 检查需要转写校验的类别
+ if (
+ category_dir in self.REWRITE_VALIDATION_CATEGORIES
+ and "需要转写" in remark
+ ):
+ if pytorch_param != "-":
+ requires_rewrite_params.add(pytorch_param)
+ # else:
+ # requires_rewrite_params.add(paddle_param)
+
+ return requires_rewrite_params, errors
+
+ def validate_rewrite_example(
+ self,
+ section_lines: list[str],
+ current_index: int,
+ requires_rewrite_params: set,
+ category_dir: str,
+ file_path: str,
+ section_index: int,
+ ) -> tuple[bool, list[str]]:
+ """校验转写示例部分"""
+ errors = []
+
+ if category_dir == "invok_only_diff":
+ return self._validate_required_rewrite_example(
+ section_lines, current_index, file_path, section_index
+ )
+ elif category_dir in [
+ *self.REWRITE_VALIDATION_CATEGORIES,
+ "torch_more_args",
+ "paddle_more_args",
+ "args_default_value_diff",
+ "composite_implement",
+ ]:
+ return self._validate_conditional_rewrite_example(
+ section_lines,
+ current_index,
+ requires_rewrite_params,
+ category_dir,
+ file_path,
+ section_index,
+ )
+ else: # args_name_diff 类别不应包含转写示例
if (
- current_index >= len(lines)
- or lines[current_index] != "```python"
+ current_index < len(section_lines)
+ and section_lines[current_index] == "### 转写示例"
):
- error_found = True
errors.append(
- f"文件格式错误: {file_path} - 第三行应为'```python'"
+ f"文件格式错误: {file_path} - 此类别不应包含'### 转写示例'"
)
+ return False, errors
+ return True, errors
+
+ def _validate_required_rewrite_example(
+ self,
+ section_lines: list[str],
+ current_index: int,
+ file_path: str,
+ section_index: int,
+ ) -> tuple[bool, list[str]]:
+ """校验必须包含的转写示例"""
+ errors = []
+
+ if (
+ current_index >= len(section_lines)
+ or section_lines[current_index] != "### 转写示例"
+ ):
+ current_line = (
+ section_lines[current_index]
+ if current_index < len(section_lines)
+ else "EOF"
+ )
+ errors.append(
+ f"文件格式错误: {file_path} - 缺少'### 转写示例',当前行: '{current_line}'"
+ )
+ return False, errors
+
+ current_index += 1
+
+ if (
+ current_index >= len(section_lines)
+ or section_lines[current_index] != "```python"
+ ):
+ current_line = (
+ section_lines[current_index]
+ if current_index < len(section_lines)
+ else "EOF"
+ )
+ errors.append(
+ f"文件格式错误: {file_path} - 转写示例代码块开始错误,当前行: '{current_line}'"
+ )
+ return False, errors
+
+ # 查找代码块结束
+ example_code_end_found = False
+ while current_index < len(section_lines):
+ if section_lines[current_index] == "```":
+ example_code_end_found = True
+ break
+ if "####" in section_lines[current_index]:
+ errors.append(
+ f"文件格式错误: {file_path} - 转写示例内容不应包含四级标题"
+ )
+ break
current_index += 1
- while lines[current_index] != "```":
- current_index += 1
- if current_index >= len(lines):
- error_found = True
- errors.append(
- f"文件格式错误: {file_path} - 未找到torch代码块结束'```'"
- )
- break
- current_index += 1
-
- # 6. 检查paddle部分 (非组合实现类别)
- if category_dir != "composite_implement":
- # 6.1 paddle超链接
- if current_index >= len(lines) or not re.match(
- r"^### \[.*\]\(.*\)$", lines[current_index]
- ):
- error_found = True
- errors.append(
- f"文件格式错误: {file_path} - 第六行应为paddle超链接"
- )
- current_index += 1
+ if not example_code_end_found:
+ errors.append(
+ f"文件格式错误: {file_path} - 未找到转写示例代码块结束'```'"
+ )
- # 6.2 paddle代码块开始
- if (
- current_index >= len(lines)
- or lines[current_index] != "```python"
- ):
- error_found = True
+ return len(errors) == 0, errors
+
+ def _validate_conditional_rewrite_example(
+ self,
+ section_lines: list[str],
+ current_index: int,
+ requires_rewrite_params: set,
+ category_dir: str,
+ file_path: str,
+ section_index: int,
+ ) -> tuple[bool, list[str]]:
+ """校验条件性转写示例"""
+ errors = []
+
+ if (
+ current_index < len(section_lines)
+ and section_lines[current_index] == "### 转写示例"
+ ):
+ # 检查四级标题
+ found_4th_level = False
+ param_headers = set()
+ temp_index = current_index + 1
+
+ while temp_index < len(section_lines) and not section_lines[
+ temp_index
+ ].startswith("### "):
+ if section_lines[temp_index].startswith("#### "):
+ found_4th_level = True
+ header_content = section_lines[temp_index][
+ 5:
+ ].strip() # 去除"#### "
+ param_headers.add(header_content)
+ temp_index += 1
+
+ # 检查是否需要四级标题
+ missing_params = []
+ if requires_rewrite_params:
+ if not found_4th_level:
errors.append(
- f"文件格式错误: {file_path} - 第七行应为'```python'"
+ f"文件格式错误: {file_path} - 转写示例应包含参数四级标题"
)
- current_index += 1
-
- while lines[current_index] != "```":
- current_index += 1
- if current_index >= len(lines):
- error_found = True
+ else:
+ # 检查是否包含了所有需要转写的参数
+ for param in requires_rewrite_params:
+ missing = True
+ for header in param_headers:
+ if param in header:
+ missing = False
+ break
+ if missing:
+ missing_params.append(param)
+ if len(missing_params) > 0:
errors.append(
- f"文件格式错误: {file_path} - 未找到'```'"
+ f"文件格式错误: {file_path} - 缺少参数四级标题: {missing_params}"
)
- break
- current_index += 1
+ elif found_4th_level and category_dir not in [
+ "paddle_more_args",
+ "args_default_value_diff",
+ ]:
+ errors.append(
+ f"文件格式错误: {file_path} - 不应包含四级标题但存在"
+ )
- # 7. 检查总结行
- expected_summary = summary_map[category_dir]
- while current_index < len(lines) and not lines[
- current_index
- ].startswith("#"):
- current_index += 1
+ elif requires_rewrite_params:
+ errors.append(f"文件格式错误: {file_path} - 需要转写示例但未找到")
+
+ return len(errors) == 0, errors
+
+ def validate_section(
+ self,
+ section_lines: list[str],
+ category_dir: str,
+ torch_api_name: str,
+ file_path: str,
+ section_index: int,
+ ) -> tuple[bool, list[str]]:
+ """校验单个部分(普通部分或重载部分)"""
+ errors = []
+ current_index = 0
+
+ try:
+ # 1. 检查torch超链接
+ if not self._validate_torch_header(
+ section_lines,
+ current_index,
+ torch_api_name,
+ file_path,
+ section_index,
+ errors,
+ ):
+ return False, errors
+ current_index += 1
+
+ # 2. 检查torch代码块
+ if not self._validate_code_block(
+ section_lines,
+ current_index,
+ "python",
+ file_path,
+ section_index,
+ errors,
+ "torch",
+ ):
+ return False, errors
+ current_index = (
+ self._find_code_block_end(section_lines, current_index) + 1
+ )
+
+ # 3. 检查paddle部分
+ composite_implement, have_paddle_section, current_index, success = (
+ self._validate_paddle_section(
+ section_lines,
+ current_index,
+ category_dir,
+ file_path,
+ section_index,
+ errors,
+ )
+ )
+ if not success:
+ return False, errors
- # 8. 检查参数映射表格 (非2和10类)
- if category_dir not in ["invok_only_diff", "composite_implement"]:
- # 8.1 参数映射标题
- if (
- current_index >= len(lines)
- or lines[current_index] != "### 参数映射"
+ # 4. 检查总结行
+ current_index = self._skip_to_next_header(
+ section_lines, current_index
+ )
+
+ # 5. 检查参数映射表格
+ requires_rewrite_params = set()
+ if (
+ category_dir not in ["invok_only_diff", "composite_implement"]
+ ) or (composite_implement and have_paddle_section):
+ if not self._validate_parameter_table_header(
+ section_lines,
+ current_index,
+ file_path,
+ section_index,
+ errors,
):
- error_found = True
- errors.append(
- f"文件格式错误: {file_path} - 缺少'### 参数映射'标题"
- )
+ return False, errors
current_index += 1
+ # 提取表格内容并校验
+ table_lines = []
while (
- current_index < len(lines) and "|" in lines[current_index]
+ current_index < len(section_lines)
+ and "|" in section_lines[current_index]
):
+ table_lines.append(section_lines[current_index])
current_index += 1
- # 9. 检查转写示例
- if category_dir in ["invok_only_diff", "composite_implement"]:
- # 9.1 转写示例标题
- if (
- current_index >= len(lines)
- or lines[current_index] != "### 转写示例"
- ):
- error_found = True
- errors.append(
- f"文件格式错误: {file_path} - 缺少'### 转写示例'"
+ rewrite_params, table_errors = (
+ self.validate_parameter_table_remarks(
+ table_lines, category_dir, file_path, section_index
)
- current_index += 1
+ )
+ requires_rewrite_params = rewrite_params
+ errors.extend(table_errors)
+
+ # 6. 检查转写示例
+ rewrite_success, rewrite_errors = self.validate_rewrite_example(
+ section_lines,
+ current_index,
+ requires_rewrite_params,
+ category_dir,
+ file_path,
+ section_index,
+ )
+ errors.extend(rewrite_errors)
- # 9.2 转写示例代码块
- if (
- current_index >= len(lines)
- or lines[current_index] != "```python"
- ):
- error_found = True
- errors.append(
- f"文件格式错误: {file_path} - 转写示例代码块开始错误"
- )
- current_index += 1
+ return len(errors) == 0, errors
- while (
- current_index < len(lines) and lines[current_index] != "```"
- ):
- current_index += 1
- if current_index >= len(lines):
- error_found = True
- errors.append(
- f"文件格式错误: {file_path} - 未找到'```'"
- )
- break
- if "####" in lines[current_index]:
- error_found = True
- errors.append(
- f"文件格式错误: {file_path} - 转写示例内容不应包含四级标题"
- )
+ except Exception as e:
+ error_info = traceback.format_exc()
+ current_line = (
+ section_lines[current_index]
+ if current_index < len(section_lines)
+ else "EOF"
+ )
+ errors.append(
+ f"校验过程中发生异常: {file_path} - 异常类型: {type(e).__name__}, 异常信息: {e!s}"
+ )
+ return False, errors
+
+ def _validate_torch_header(
+ self,
+ section_lines: list[str],
+ current_index: int,
+ torch_api_name: str,
+ file_path: str,
+ section_index: int,
+ errors: list[str],
+ ) -> bool:
+ """校验torch头部分"""
+ if current_index >= len(section_lines) or not re.match(
+ r"^### \[" + re.escape(torch_api_name) + r"\]\(.*\)$",
+ section_lines[current_index],
+ ):
+ current_line = (
+ section_lines[current_index]
+ if current_index < len(section_lines)
+ else "EOF"
+ )
+ errors.append(
+ f"文件格式错误: {file_path} - 应为torch超链接: '{current_line}'"
+ )
+ return False
+ return True
+
+ def _validate_code_block(
+ self,
+ section_lines: list[str],
+ current_index: int,
+ language: str,
+ file_path: str,
+ section_index: int,
+ errors: list[str],
+ block_type: str,
+ ) -> bool:
+ """校验代码块"""
+ expected_start = f"```{language}"
+ if (
+ current_index >= len(section_lines)
+ or section_lines[current_index] != expected_start
+ ):
+ current_line = (
+ section_lines[current_index]
+ if current_index < len(section_lines)
+ else "EOF"
+ )
+ errors.append(
+ f"文件格式错误: {file_path} - 应为'{expected_start}',当前行: '{current_line}'"
+ )
+ return False
+ return True
+
+ def _find_code_block_end(
+ self, section_lines: list[str], start_index: int
+ ) -> int:
+ """查找代码块结束位置"""
+ current_index = start_index + 1
+ while current_index < len(section_lines):
+ if section_lines[current_index] == "```":
+ return current_index
+ current_index += 1
+ return len(section_lines)
+
+ def _validate_paddle_section(
+ self,
+ section_lines: list[str],
+ current_index: int,
+ category_dir: str,
+ file_path: str,
+ section_index: int,
+ errors: list[str],
+ ) -> tuple[bool, bool, int, bool]:
+ """校验paddle部分"""
+ composite_implement = category_dir == "composite_implement"
+ have_paddle_section = False
+
+ if (
+ composite_implement
+ and current_index < len(section_lines)
+ and not re.match(
+ r"^### \[.*\]\(.*\)$", section_lines[current_index]
+ )
+ ):
+ return composite_implement, False, current_index, True
- current_index += 1
+ if category_dir == "invok_only_diff":
+ # invok_only_diff 可选paddle部分
+ if current_index < len(section_lines) and re.match(
+ r"^### \[.*\]\(.*\)$", section_lines[current_index]
+ ):
+ return self._process_paddle_section(
+ section_lines,
+ current_index,
+ file_path,
+ section_index,
+ errors,
+ composite_implement,
+ )
+ else:
+ return composite_implement, False, current_index, True
+ else:
+ # 其他类别必须包含paddle部分
+ return self._process_required_paddle_section(
+ section_lines,
+ current_index,
+ file_path,
+ section_index,
+ errors,
+ composite_implement,
+ )
- elif category_dir in [
- "torch_more_args",
- "input_args_usage_diff",
- "input_args_type_diff",
- "output_args_type_diff",
- "paddle_more_args",
- "args_default_value_diff",
- ]:
- # 9.1 转写示例标题
- if (
- current_index >= len(lines)
- or lines[current_index] != "### 转写示例"
- ):
- if category_dir not in [
- "paddle_more_args",
- "args_default_value_diff",
- ]:
- error_found = True
- errors.append(
- f"文件格式错误: {file_path} - 缺少'### 转写示例'"
- )
- current_index += 1
+ def _process_paddle_section(
+ self,
+ section_lines: list[str],
+ current_index: int,
+ file_path: str,
+ section_index: int,
+ errors: list[str],
+ composite_implement: bool,
+ ) -> tuple[bool, bool, int, bool]:
+ """处理可选的paddle部分"""
+ current_index += 1
+ if not self._validate_code_block(
+ section_lines,
+ current_index,
+ "python",
+ file_path,
+ section_index,
+ errors,
+ "paddle",
+ ):
+ return composite_implement, True, current_index, False
+ current_index += 1
+
+ current_index = (
+ self._find_code_block_end(section_lines, current_index) + 1
+ )
+ return composite_implement, True, current_index, True
+
+ def _process_required_paddle_section(
+ self,
+ section_lines: list[str],
+ current_index: int,
+ file_path: str,
+ section_index: int,
+ errors: list[str],
+ composite_implement: bool,
+ ) -> tuple[bool, bool, int, bool]:
+ """处理必须的paddle部分"""
+ if current_index >= len(section_lines) or not re.match(
+ r"^### \[.*\]\(.*\)$", section_lines[current_index]
+ ):
+ current_line = (
+ section_lines[current_index]
+ if current_index < len(section_lines)
+ else "EOF"
+ )
+ errors.append(
+ f"文件格式错误: {file_path} - 应为paddle超链接,当前行: '{current_line}'"
+ )
+ return composite_implement, False, current_index, False
+
+ current_index += 1
+ if not self._validate_code_block(
+ section_lines,
+ current_index,
+ "python",
+ file_path,
+ section_index,
+ errors,
+ "paddle",
+ ):
+ return composite_implement, True, current_index, False
+ current_index += 1
+
+ current_index = (
+ self._find_code_block_end(section_lines, current_index) + 1
+ )
+ return composite_implement, True, current_index, True
+
+ def _skip_to_next_header(
+ self, section_lines: list[str], current_index: int
+ ) -> int:
+ """跳转到下一个标题"""
+ while current_index < len(section_lines) and not section_lines[
+ current_index
+ ].startswith("#"):
+ current_index += 1
+ return current_index
+
+ def _validate_parameter_table_header(
+ self,
+ section_lines: list[str],
+ current_index: int,
+ file_path: str,
+ section_index: int,
+ errors: list[str],
+ ) -> bool:
+ """校验参数映射表头"""
+ if (
+ current_index >= len(section_lines)
+ or section_lines[current_index] != "### 参数映射"
+ ):
+ current_line = (
+ section_lines[current_index]
+ if current_index < len(section_lines)
+ else "EOF"
+ )
+ errors.append(
+ f"文件格式错误: {file_path} - 缺少'### 参数映射'标题,当前行: '{current_line}'"
+ )
+ return False
+ return True
+
+ def process_file(self, file_path: str, category_dir: str) -> bool:
+ """处理单个文件"""
+ try:
+ with open(file_path, "r", encoding="utf-8") as f:
+ lines = [line.strip() for line in f if line.strip() != ""]
+ lines = [line.replace(r"\_", "_") for line in lines]
+ except Exception as e:
+ error_msg = f"读取文件失败: {file_path} - {e!s}"
+ self.errors.append(error_msg)
+ return False
+
+ torch_api_name = os.path.basename(file_path)[:-3] # 去掉.md后缀
+
+ if torch_api_name.startswith("transformers"):
+ return True
+
+ # 检查是否为重载API文档
+ is_overloaded = len(lines) > 1 and "重载" in lines[1]
+
+ if is_overloaded:
+ return self._process_overloaded_file(
+ lines, category_dir, torch_api_name, file_path
+ )
+ else:
+ return self._process_regular_file(
+ lines, category_dir, torch_api_name, file_path
+ )
- # 9.2 检查至少一个四级标题 (####)
- found_4th_level = False
- for i in range(current_index, len(lines)):
- if lines[i].startswith("####"):
- found_4th_level = True
+ def _process_overloaded_file(
+ self,
+ lines: list[str],
+ category_dir: str,
+ torch_api_name: str,
+ file_path: str,
+ ) -> bool:
+ """处理重载文件"""
+ separator = "-------------------------------------------------------------------------------------------------"
+ sections = []
+ current_section = []
+ in_section = False
+
+ for line in lines:
+ if line == separator:
+ if current_section:
+ sections.append(current_section)
+ current_section = []
+ in_section = True
+ elif in_section:
+ current_section.append(line)
+
+ if current_section:
+ sections.append(current_section)
+
+ if not sections:
+ error_msg = (
+ f"文件格式错误: {file_path} - 重载文档格式错误,未找到有效部分"
+ )
+ self.errors.append(error_msg)
+ return False
+
+ section_valid = False
+ all_errors = []
+
+ for i, section in enumerate(sections):
+ if i == 0:
+ section_start = 0
+ for j, line in enumerate(section):
+ if line.startswith("### ["):
+ section_start = j
break
- if not found_4th_level:
- if category_dir not in [
- "paddle_more_args",
- "args_default_value_diff",
- ]:
- error_found = True
- errors.append(
- f"文件格式错误: {file_path} - 转写示例应包含至少一个四级标题"
- )
+ actual_section = section[section_start:]
+ else:
+ actual_section = section
+
+ if actual_section:
+ valid, section_errors = self.validate_section(
+ actual_section,
+ category_dir,
+ torch_api_name,
+ file_path,
+ i + 1,
+ )
+ all_errors.extend(section_errors)
+ if valid:
+ section_valid = True
+ break
- else: # 类别3: args_name_diff
- # 检查不应存在转写示例
- if (
- current_index < len(lines)
- and lines[current_index] == "### 转写示例"
- ):
- error_found = True
- errors.append(
- f"文件格式错误: {file_path} - 类别3不应包含'### 转写示例'"
- )
+ if not section_valid:
+ self.errors.extend(all_errors)
+ return section_valid
+
+ def _process_regular_file(
+ self,
+ lines: list[str],
+ category_dir: str,
+ torch_api_name: str,
+ file_path: str,
+ ) -> bool:
+ """处理普通文件"""
+ current_index = 0
+ expected_title = (
+ f"## [ {self.CATEGORY_MAP[category_dir]} ]{torch_api_name}"
+ )
+
+ if (
+ current_index >= len(lines)
+ or lines[current_index] != expected_title
+ ):
+ error_msg = (
+ f"文件格式错误: {file_path} - 第一行应为 '{expected_title}'"
+ )
+ self.errors.append(error_msg)
+ return False
+
+ current_index += 1
+ valid, errors = self.validate_section(
+ lines[current_index:], category_dir, torch_api_name, file_path, 1
+ )
+ self.errors.extend(errors)
+ return valid
+
+ def run_validation(self) -> None:
+ """运行校验"""
+ script_dir = os.path.dirname(os.path.abspath(__file__))
+ error_file = os.path.join(script_dir, "api_difference_error.txt")
+ # 清空错误日志文件
+ for file_path in [error_file]:
+ if os.path.exists(file_path):
+ os.remove(file_path)
+
+ # 遍历所有类别目录
+ for category_dir in self.CATEGORY_MAP:
+ category_path = os.path.join(self.api_difference_dir, category_dir)
+ if not os.path.isdir(category_path):
+ continue
- # 更新有效文件计数
- if not error_found:
- valid_files += 1
+ for file_name in os.listdir(category_path):
+ if not file_name.endswith(".md"):
+ continue
- # 输出统计信息
- print(f"总文件数: {total_files}")
- print(f"有效文件数: {valid_files}")
- print(f"通过率: {valid_files / total_files:.2%}")
+ self.total_files += 1
+ file_path = os.path.join(category_path, file_name)
- # 保存错误信息到文件
- error_file = os.path.join(script_dir, "api_difference_error.txt")
- with open(error_file, "w", encoding="utf-8") as f:
- f.writelines(error + "\n" for error in errors)
+ try:
+ if self.process_file(file_path, category_dir):
+ self.valid_files += 1
+ except Exception as e:
+ error_msg = f"处理文件时发生异常: {file_path}"
+ self.errors.append(error_msg)
+
+ def print_results(self) -> None:
+ """打印结果"""
+ print(f"total files: {self.total_files}")
+ print(f"valid files: {self.valid_files}")
+ acc = (
+ f"{self.valid_files / self.total_files:.2%}"
+ if self.total_files > 0
+ else "N/A"
+ )
+ print(f"accuracy:\n{acc}")
- # 如果没有错误,删除错误文件
- if not errors:
- os.remove(error_file)
+
+def main():
+ """主函数"""
+ script_dir = os.path.dirname(os.path.abspath(__file__))
+ api_difference_dir = os.path.join(script_dir, "../api_difference")
+
+ validator = APIDifferenceValidator(api_difference_dir)
+ validator.run_validation()
+
+ # 保存错误信息
+ error_file = os.path.join(script_dir, "api_difference_error.txt")
+ if validator.errors:
+ with open(error_file, "w", encoding="utf-8") as f:
+ for error in validator.errors:
+ if isinstance(error, list):
+ for sub_error in error:
+ print(sub_error)
+ f.write(f"{sub_error}\n")
+ break
+ else:
+ print(error)
+ f.write(f"{error}\n")
+ print(f"error log saved to: {error_file}")
+ validator.print_results()
+ return 1
+ else:
+ if os.path.exists(error_file):
+ os.remove(error_file)
+ validator.print_results()
+ return 0
if __name__ == "__main__":
- main()
+ sys.exit(main())
diff --git a/docs/guides/model_convert/convert_from_pytorch/tools/validate_pytorch_api_mapping.py b/docs/guides/model_convert/convert_from_pytorch/tools/validate_pytorch_api_mapping.py
index 9e06a5c90d6..2d7715c7d94 100644
--- a/docs/guides/model_convert/convert_from_pytorch/tools/validate_pytorch_api_mapping.py
+++ b/docs/guides/model_convert/convert_from_pytorch/tools/validate_pytorch_api_mapping.py
@@ -3,13 +3,13 @@
import os
import random
import re
+import sys
import time
from collections import defaultdict
from urllib.parse import urlparse
import requests
from requests.adapters import HTTPAdapter
-from tqdm import tqdm # 用于显示进度条
from urllib3.util.retry import Retry
# 默认文件路径
@@ -28,6 +28,13 @@
"composite_implement": "组合替代实现",
}
+white_list = [
+ "torch.nn.Linear",
+ "torch.nn.functional.linear",
+ "torch.nn.ZeroPad1d",
+ "torch.nn.ZeroPad3d",
+]
+
# 反向映射(中文到英文)
REVERSE_CATEGORY_MAP = {v: k for k, v in CATEGORY_MAP.items()}
@@ -389,6 +396,10 @@ def check_diff_doc_consistency(categories, base_dir):
torch_api = torch_api.replace(r"\_", "_")
if not torch_api:
continue
+ if not torch_api.startswith("torch."):
+ continue
+ if torch_api in white_list:
+ continue
expected_apis[category_name].add(torch_api)
@@ -419,6 +430,9 @@ def check_diff_doc_consistency(categories, base_dir):
if filename.endswith(".md"):
torch_api = filename[:-3] # 去掉.md后缀
+ if torch_api in white_list:
+ continue
+
# 检查这个API是否在对应类别的表格中
api_found = False
for category in categories:
@@ -608,12 +622,10 @@ def check_urls_exist(urls_with_context, max_workers=10):
f"开始使用多线程检查 {total_urls} 个URL的存在性(线程数:{max_workers})..."
)
- with (
- tqdm(total=total_urls, desc="检查URL") as pbar,
- concurrent.futures.ThreadPoolExecutor(
- max_workers=max_workers
- ) as executor,
- ):
+ processed = 0
+ with concurrent.futures.ThreadPoolExecutor(
+ max_workers=max_workers
+ ) as executor:
# 为每个线程创建一个会话
sessions = [create_session() for _ in range(max_workers)]
@@ -629,8 +641,14 @@ def check_urls_exist(urls_with_context, max_workers=10):
for future in concurrent.futures.as_completed(future_to_url):
result = future.result()
- # 更新进度条
- pbar.update(1)
+ # 更新进度计数
+ processed += 1
+ if processed % 10 == 0 or processed == len(urls_with_context):
+ print(
+ f"\r检查URL进度: {processed}/{len(urls_with_context)}",
+ end="",
+ flush=True,
+ )
# 如果不是200状态码,则添加到警告列表
if result["status"] != "ok":
@@ -647,7 +665,8 @@ def check_urls_exist(urls_with_context, max_workers=10):
for session in sessions:
session.close()
- print(f"URL检查完成,发现 {len(warnings)} 个问题")
+ # 打印最终进度
+ print(f"\r检查URL完成,发现 {len(warnings)} 个问题")
return warnings
@@ -709,11 +728,21 @@ def main():
# 执行基本校验
toc_warnings = check_toc_consistency(toc, categories)
unique_warnings = check_unique_torch_apis(categories)
- link_warnings = check_links_exist(categories)
mapping_category_warnings = check_mapping_category_consistency(categories)
diff_doc_warnings = check_diff_doc_consistency(categories, base_dir)
- # 输出警告到文件
+ # 初始化 link_warnings 和 url_warnings(在 skip-url-check 时跳过)
+ link_warnings = []
+ url_warnings = []
+ if not args.skip_url_check:
+ link_warnings = check_links_exist(categories)
+ urls_with_context = extract_all_urls(categories)
+ print(f"找到 {len(urls_with_context)} 个URL需要检查")
+ url_warnings = check_urls_exist(
+ urls_with_context, max(os.cpu_count() - 4, 1)
+ )
+
+ # 输出警告到文件和标准输出
warning_files = [
("toc_warnings.txt", "目录一致性校验警告:", toc_warnings),
("unique_warnings.txt", "Torch API 唯一性校验警告:", unique_warnings),
@@ -728,42 +757,37 @@ def main():
for filename, description, warnings in warning_files:
if warnings:
+ # 同时输出到标准输出和文件
+ print(f"\n{description}")
+ for warning in warnings:
+ print(warning)
+
output_path = os.path.join(tools_dir, filename)
with open(output_path, "w", encoding="utf-8") as f:
f.write(f"{description}\n")
f.writelines(warning + "\n" for warning in warnings)
- print(f"生成 {output_path},包含 {len(warnings)} 个警告")
-
- # 执行URL存在性检查(除非明确跳过)
- url_warnings = []
- if not args.skip_url_check:
- # 提取所有URL
- urls_with_context = extract_all_urls(categories)
- print(f"找到 {len(urls_with_context)} 个URL需要检查")
-
- # 检查URL存在性(使用多线程)
- url_warnings = check_urls_exist(
- urls_with_context, max(os.cpu_count() - 4, 1)
- )
-
- if url_warnings:
- output_path = os.path.join(tools_dir, "url_warnings.txt")
- with open(output_path, "w", encoding="utf-8") as f:
- f.write("URL存在性校验警告:\n")
- f.writelines(warning + "\n" for warning in url_warnings)
- print(f"生成 {output_path},包含 {len(url_warnings)} 个警告")
- else:
- print("跳过URL存在性检查")
-
- # 汇总统计
- total_warnings = (
+ # print(f"生成 {output_path},包含 {len(warnings)} 个警告")
+
+ # 处理 URL 警告(单独处理,因为不在 warning_files 中)
+ if url_warnings:
+ print("\nURL存在性校验警告:")
+ for warning in url_warnings:
+ print(warning)
+ output_path = os.path.join(tools_dir, "url_warnings.txt")
+ with open(output_path, "w", encoding="utf-8") as f:
+ f.write("URL存在性校验警告:\n")
+ f.writelines(warning + "\n" for warning in url_warnings)
+ print(f"生成 {output_path},包含 {len(url_warnings)} 个警告")
+
+ # 汇总统计(不包括 diff_doc_warnings,因为它是警告不是错误)
+ total_errors = (
len(toc_warnings)
+ len(unique_warnings)
+ len(link_warnings)
+ len(mapping_category_warnings)
- + len(diff_doc_warnings)
+ len(url_warnings)
)
+ total_warnings = total_errors + len(diff_doc_warnings)
if total_warnings == 0:
print("所有校验通过,没有发现警告!")
@@ -771,7 +795,11 @@ def main():
print(
f"校验完成,共发现 {total_warnings} 个警告,请查看生成的警告文件。"
)
+ if total_errors > 0:
+ return 1
+
+ return 0
if __name__ == "__main__":
- main()
+ sys.exit(main())