From 5787f6784f5f4f37e168c5511e27aa4166c79a71 Mon Sep 17 00:00:00 2001 From: hd9568 <2358440725@qq.com> Date: Fri, 19 Sep 2025 10:04:22 +0000 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E6=A1=A3bug?= =?UTF-8?q?=EF=BC=8C=E4=B8=8A=E4=BC=A0=E6=96=87=E6=A1=A3=E7=94=9F=E6=88=90?= =?UTF-8?q?=E4=BB=A3=E7=A0=81+=E6=A0=A1=E9=AA=8C=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{tools => deprecated}/apply_references.py | 0 .../pytorch_api_mapping_cn.md | 896 ++++++++-------- .../convert_from_pytorch/tools/.gitignore | 10 + .../tools/generate_mapping_files.py | 583 +++++++++++ .../tools/get_docs_mappings.py | 780 ++++++++++++++ .../tools/validate_mapping_files.py | 985 +++++------------- 6 files changed, 2101 insertions(+), 1153 deletions(-) rename docs/guides/model_convert/convert_from_pytorch/{tools => deprecated}/apply_references.py (100%) create mode 100644 docs/guides/model_convert/convert_from_pytorch/tools/generate_mapping_files.py create mode 100644 docs/guides/model_convert/convert_from_pytorch/tools/get_docs_mappings.py diff --git a/docs/guides/model_convert/convert_from_pytorch/tools/apply_references.py b/docs/guides/model_convert/convert_from_pytorch/deprecated/apply_references.py similarity index 100% rename from docs/guides/model_convert/convert_from_pytorch/tools/apply_references.py rename to docs/guides/model_convert/convert_from_pytorch/deprecated/apply_references.py diff --git a/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md b/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md index ee3907eae65..54c6e054838 100644 --- a/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md +++ b/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md @@ -31,16 +31,18 @@ **转写示例** ```python # PyTorch 写法 -x = torch.eye(5) +torch.eye(5) torch.einsum('ii->i', x) -model = torch.nn.Softplus(beta=0.5, threshold=15) +torch.nn.Softplus(beta=0.5, threshold=15) # Paddle 写法 -x = paddle.eye(5) +paddle.eye(5) paddle.einsum('ii->i', x) -model = paddle.nn.Softplus(beta=0.5, threshold=15) +paddle.nn.Softplus(beta=0.5, threshold=15) ``` + + | 序号 | Pytorch 最新 release | Paddle develop | 备注 | |------|-------------------|---------------|------| | 1 | [torch.Tensor.bfloat16](https://pytorch.org/docs/stable/generated/torch.Tensor.bfloat16.html#torch.Tensor.bfloat16) | paddle.Tensor.bfloat16 | - | @@ -357,8 +359,8 @@ model = paddle.nn.Softplus(beta=0.5, threshold=15) | 312 | [torch.Tensor.trunc](https://pytorch.org/docs/stable/generated/torch.Tensor.trunc.html#torch.Tensor.trunc) | [paddle.Tensor.trunc](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#trunc-name-none) | - | | 313 | [torch.Tensor.trunc_](https://pytorch.org/docs/stable/generated/torch.Tensor.trunc_.html) | paddle.Tensor.trunc_ | - | | 314 | [torch.Tensor.values](https://pytorch.org/docs/stable/generated/torch.Tensor.values.html?highlight=torch+tensor+values#torch.Tensor.values) | [paddle.Tensor.values](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/sparse/Overview_cn.html) | - | -| 315 | torch.__version__ | paddle.__version__ | - | -| 316 | torch.__version__.split | [paddle.__version__.split](https://github.com/PaddlePaddle/Paddle/tree/develop) | - | +| 315 | torch.\_\_version\_\_ | paddle.\_\_version\_\_ | - | +| 316 | torch.\_\_version\_\_.split | paddle.\_\_version\_\_.split | - | | 317 | [torch.diag_embed](https://pytorch.org/docs/stable/generated/torch.diag_embed.html) | [paddle.diag_embed](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/diag_embed_cn.html) | - | | 318 | [torch.distributed.ReduceOp.MAX](https://pytorch.org/docs/stable/distributed.html#torch.distributed.ReduceOp) | [paddle.distributed.ReduceOp.MAX](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/ReduceOp_cn.html#reduceop) | - | | 319 | [torch.distributed.ReduceOp.MIN](https://pytorch.org/docs/stable/distributed.html#torch.distributed.ReduceOp) | [paddle.distributed.ReduceOp.MIN](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/ReduceOp_cn.html#reduceop) | - | @@ -392,20 +394,20 @@ model = paddle.nn.Softplus(beta=0.5, threshold=15) | 347 | [torch.Tensor.element_size](https://pytorch.org/docs/stable/generated/torch.Tensor.element_size.html?highlight=element_size#torch.Tensor.element_size) | [paddle.Tensor.element_size](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#element-size) | - | | 348 | [torch.Tensor.view_as](https://pytorch.org/docs/stable/generated/torch.Tensor.view_as.html?highlight=view_as#torch.Tensor.view_as) | [paddle.Tensor.view_as](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#view-as-x-other-name-none) | - | | 349 | torch.dtype | paddle.dtype | - | -| 350 | torch.Tensor.__and__ | paddle.Tensor.__and__ | - | -| 351 | torch.Tensor.__array__ | paddle.Tensor.__array__ | - | -| 352 | torch.Tensor.__bool__ | paddle.Tensor.__bool__ | - | -| 353 | torch.Tensor.__eq__ | paddle.Tensor.__eq__ | - | -| 354 | torch.Tensor.__format__ | paddle.Tensor.__format__ | - | -| 355 | torch.Tensor.__getitem__ | paddle.Tensor.__getitem__ | - | -| 356 | torch.Tensor.__index__ | paddle.Tensor.__index__ | - | -| 357 | torch.Tensor.__invert__ | paddle.Tensor.__invert__ | - | -| 358 | torch.Tensor.__len__ | paddle.Tensor.__len__ | - | -| 359 | torch.Tensor.__or__ | paddle.Tensor.__or__ | - | -| 360 | torch.Tensor.__rpow__ | paddle.Tensor.__rpow__ | - | -| 361 | torch.Tensor.__rsub__ | paddle.Tensor.__rsub__ | - | -| 362 | torch.Tensor.__rtruediv__ | paddle.Tensor.__rtruediv__ | - | -| 363 | torch.Tensor.__setitem__ | paddle.Tensor.__setitem__ | - | +| 350 | torch.Tensor.\_\_and\_\_ | paddle.Tensor.\_\_and\_\_ | - | +| 351 | torch.Tensor.\_\_array\_\_ | paddle.Tensor.\_\_array\_\_ | - | +| 352 | torch.Tensor.\_\_bool\_\_ | paddle.Tensor.\_\_bool\_\_ | - | +| 353 | torch.Tensor.\_\_eq\_\_ | paddle.Tensor.\_\_eq\_\_ | - | +| 354 | torch.Tensor.\_\_format\_\_ | paddle.Tensor.\_\_format\_\_ | - | +| 355 | torch.Tensor.\_\_getitem\_\_ | paddle.Tensor.\_\_getitem\_\_ | - | +| 356 | torch.Tensor.\_\_index\_\_ | paddle.Tensor.\_\_index\_\_ | - | +| 357 | torch.Tensor.\_\_invert\_\_ | paddle.Tensor.\_\_invert\_\_ | - | +| 358 | torch.Tensor.\_\_len\_\_ | paddle.Tensor.\_\_len\_\_ | - | +| 359 | torch.Tensor.\_\_or\_\_ | paddle.Tensor.\_\_or\_\_ | - | +| 360 | torch.Tensor.\_\_rpow\_\_ | paddle.Tensor.\_\_rpow\_\_ | - | +| 361 | torch.Tensor.\_\_rsub\_\_ | paddle.Tensor.\_\_rsub\_\_ | - | +| 362 | torch.Tensor.\_\_rtruediv\_\_ | paddle.Tensor.\_\_rtruediv\_\_ | - | +| 363 | torch.Tensor.\_\_setitem\_\_ | paddle.Tensor.\_\_setitem\_\_ | - | | 364 | [torch.matmul](https://pytorch.org/docs/stable/generated/torch.matmul.html?highlight=matmul#torch.matmul) | [paddle.matmul](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/matmul_cn.html) | - | | 365 | torch.linalg.matmul | paddle.linalg.matmul | - | | 366 | torch.mul_ | paddle.mul_ | - | @@ -504,8 +506,6 @@ model = paddle.nn.Softplus(beta=0.5, threshold=15) | 459 | torch.Tensor.scatter | paddle.Tensor.scatter | - | | 460 | torch.Tensor.scatter_ | paddle.Tensor.scatter_ | - | | 461 | torch.scatter | paddle.scatter | - | - - ## 2. 仅 API 调用方式不一致 **分类简介** @@ -513,6 +513,7 @@ model = paddle.nn.Softplus(beta=0.5, threshold=15) 此类 API 需要转换,但转换成本较低,只需要对 API 调用方式进行改写,无需处理 API 参数部分。 包括:API 名称不同、API 路径不同、Tensor 类方法改成普通方法、Tensor 方法改成属性、Tensor 属性改成方法 等情况。 + | 序号 | Pytorch 最新 release | Paddle develop | 备注 | |------|-------------------|---------------|------| | 1 | [torch.Tensor.clamp_](https://pytorch.org/docs/stable/generated/torch.Tensor.clamp_.html?highlight=clamp_#torch.Tensor.clamp_) | [paddle.Tensor.clip_](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#id6) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.clamp_.md) | @@ -611,12 +612,14 @@ model = paddle.nn.Softplus(beta=0.5, threshold=15) | 94 | [torchvision.transforms.functional.pad](https://pytorch.org/vision/main/generated/torchvision.transforms.functional.pad.html) | [paddle.vision.transforms.pad](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/transforms/pad_cn.html) | - | | 95 | [torchvision.transforms.functional.to_grayscale](https://pytorch.org/vision/main/generated/torchvision.transforms.functional.to_grayscale.html?highlight=to_grayscale#torchvision.transforms.functional.to_grayscale) | [paddle.vision.transforms.to_grayscale](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/vision/transforms/to_grayscale_cn.html#to-grayscale) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.transforms.functional.to_grayscale.md) | | 96 | [torchvision.transforms.functional.vflip](https://pytorch.org/vision/main/generated/torchvision.transforms.functional.vflip.html) | [paddle.vision.transforms.vflip](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/vision/transforms/vflip_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.transforms.functional.vflip.md) | - ## 3. 仅参数名不一致 **分类简介** 此类 API 功能相同,但部分参数名称不同。 + + + | 序号 | Pytorch 最新 release | Paddle develop | 备注 | |------|-------------------|---------------|------| | 1 | [torch.sparse.mm](https://pytorch.org/docs/stable/generated/torch.sparse.mm.html?highlight=torch+sparse+mm#torch.sparse.mm) | [paddle.sparse.matmul](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/sparse/matmul_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/sparse/torch.sparse.mm.md) | @@ -847,12 +850,14 @@ model = paddle.nn.Softplus(beta=0.5, threshold=15) | 226 | [torchvision.io.read_file](https://pytorch.org/vision/main/generated/torchvision.io.read_file.html) | [paddle.vision.ops.read_file](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/ops/read_file_cn.html#cn-api-paddle-vision-ops-read-file) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.io.read_file.md) | | 227 | [transformers.StoppingCriteriaList](https://github.com/huggingface/transformers/blob/d625294d79341662784495551abdf45e6cb9372f/src/transformers/generation/stopping_criteria.py#L503) | [paddlenlp.generation.StoppingCriteriaList](https://github.com/PaddlePaddle/PaddleNLP/blob/e336e78c338d2514ee6c937982ce5d8c960b85ff/paddlenlp/generation/stopping_criteria.py#L72) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.StoppingCriteriaList.md) | | 228 | [transformers.generation.LogitsProcessor](https://hf-mirror.com/docs/transformers/v4.42.0/en/internal/generation_utils#logitsprocessor) | [paddlenlp.generation.LogitsProcessor](https://github.com/PaddlePaddle/PaddleNLP/blob/e336e78c338d2514ee6c937982ce5d8c960b85ff/paddlenlp/generation/logits_process.py#L26) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.generation.LogitsProcessor.md) | - ## 4. paddle 参数更多 **分类简介** 此类 API 在 PaddlePaddle 中提供了更多可选参数。 + + + | 序号 | Pytorch 最新 release | Paddle develop | 备注 | |------|-------------------|---------------|------| | 1 | [torch.nn.functional.max_unpool3d](https://pytorch.org/docs/stable/generated/torch.nn.functional.max_unpool3d.html?highlight=max_unpool3d#torch.nn.functional.max_unpool3d) | [paddle.nn.functional.max_unpool3d](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/functional/max_unpool3d_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.max_unpool3d.md) | @@ -977,12 +982,14 @@ model = paddle.nn.Softplus(beta=0.5, threshold=15) | 120 | [torchvision.transforms.ToTensor](https://pytorch.org/vision/main/generated/torchvision.transforms.ToTensor.html?highlight=totensor#torchvision.transforms.ToTensor) | [paddle.vision.transforms.ToTensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/vision/transforms/ToTensor_cn.html#totensor) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.transforms.ToTensor.md) | | 121 | [torchvision.transforms.functional.to_tensor](https://pytorch.org/vision/main/generated/torchvision.transforms.functional.to_tensor.html) | [paddle.vision.transforms.to_tensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/vision/transforms/to_tensor_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.transforms.functional.to_tensor.md) | | 122 | [torchvision.ops.DeformConv2d](https://pytorch.org/vision/main/generated/torchvision.ops.DeformConv2d.html) | [paddle.vision.ops.DeformConv2D](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/ops/DeformConv2D_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.ops.DeformConv2d.md) | - ## 5. 参数默认值不一致 **分类简介** 此类 API 功能相同,但某些参数的默认值不同。 + + + | 序号 | Pytorch 最新 release | Paddle develop | 备注 | |------|-------------------|---------------|------| | 1 | [torch.nn.functional.rrelu_](https://pytorch.org/docs/stable/generated/torch.nn.functional.rrelu_.html) | [paddle.nn.functional.rrelu](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/functional/rrelu_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.rrelu_.md) | @@ -991,12 +998,14 @@ model = paddle.nn.Softplus(beta=0.5, threshold=15) | 4 | [torch.alpha_dropout](https://pytorch.org/docs/master/generated/torch.nn.functional.alpha_dropout.html) | [paddle.nn.functional.alpha_dropout](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/functional/alpha_dropout_cn.html#alpha-dropout) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.alpha_dropout.md) | | 5 | [torch.rrelu](https://pytorch.org/docs/stable/generated/torch.nn.functional.rrelu.html#torch.nn.functional.rrelu) | [paddle.nn.functional.rrelu](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/functional/rrelu_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.rrelu.md) | | 6 | [torch.cuda.amp.GradScaler](https://pytorch.org/docs/stable/amp.html#torch.cuda.amp.GradScaler) | [paddle.amp.GradScaler](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/amp/GradScaler_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/cuda/torch.cuda.amp.GradScaler.md) | - ## 6. torch 参数更多 **分类简介** 此类 API 在 PyTorch 中提供了更多参数。 + + + | 序号 | Pytorch 最新 release | Paddle develop | 备注 | |------|-------------------|---------------|------| | 1 | [torch.sparse.softmax](https://pytorch.org/docs/stable/generated/torch.sparse.softmax.html#torch.sparse.softmax) | [paddle.sparse.nn.functional.softmax](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/sparse/nn/functional/softmax_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/sparse/torch.sparse.softmax.md) | @@ -1063,365 +1072,366 @@ model = paddle.nn.Softplus(beta=0.5, threshold=15) | 62 | [torch.Tensor.nanmean](https://pytorch.org/docs/stable/generated/torch.Tensor.nanmean.html?highlight=nanmean#torch.Tensor.nanmean) | [paddle.Tensor.nanmean](暂无对应文档) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.nanmean.md) | | 63 | [torch.Tensor.resize_](https://pytorch.org/docs/stable/generated/torch.Tensor.resize_.html) | [paddle.Tensor.resize_](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#resize-shape-fill-zero-false-name-none) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.resize_.md) | | 64 | [torch.Tensor.geometric_](https://pytorch.org/docs/stable/generated/torch.Tensor.geometric_.html) | [paddle.Tensor.geometric_](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.geometric_.md) | -| 65 | torch.Tensor.add\_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.add_.md) | -| 66 | [torch.Tensor.symeig](https://pytorch.org/docs/stable/generated/torch.Tensor.symeig.html#torch.Tensor.symeig) | [paddle.linalg.eigh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/eigh_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.symeig.md) | -| 67 | [torch.Tensor.to](https://pytorch.org/docs/stable/generated/torch.Tensor.to.html#torch.Tensor.to) | [paddle.Tensor.to](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#to-args-kwargs) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.to.md) | -| 68 | torch.Tensor.exponential\_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.exponential_.md) | -| 69 | [torch.Tensor.bernoulli_](https://pytorch.org/docs/stable/generated/torch.Tensor.bernoulli_.html#torch.Tensor.bernoulli_) | [paddle.Tensor.bernoulli_](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/tensor/tensor.py) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.bernoulli_.md) | -| 70 | [torch.Tensor.to_sparse_csr](https://pytorch.org/docs/stable/generated/torch.Tensor.to_sparse_csr.html#torch-tensor-to-sparse-csr) | [paddle.Tensor.to_sparse_csr](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#tensor) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.to_sparse_csr.md) | -| 71 | [torch.Tensor.multinomial](https://pytorch.org/docs/stable/generated/torch.Tensor.multinomial.html#torch.Tensor.multinomial) | paddle.Tensor.multinomial | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.multinomial.md) | -| 72 | [torch.Tensor.cauchy_](https://pytorch.org/docs/stable/generated/torch.Tensor.cauchy_.html) | [paddle.Tensor.cauchy_](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.cauchy_.md) | -| 73 | [torch.Tensor.stft](https://pytorch.org/docs/stable/generated/torch.Tensor.stft.html#torch.Tensor.stft) | [paddle.Tensor.stft](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/signal/stft_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.stft.md) | -| 74 | [torch.linalg.inv](https://pytorch.org/docs/stable/generated/torch.linalg.inv.html#torch.linalg.inv) | [paddle.linalg.inv](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/inv_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.inv.md) | -| 75 | [torch.linalg.vecdot](https://pytorch.org/docs/stable/generated/torch.linalg.vecdot.html) | [paddle.linalg.vecdot](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/tensor/linalg.py#L1881) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.vecdot.md) | -| 76 | [torch.linalg.svdvals](https://pytorch.org/docs/stable/generated/torch.linalg.svdvals.html#torch.linalg.svdvals) | [paddle.linalg.svdvals](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/tensor/linalg.py#L3019) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.svdvals.md) | -| 77 | [torch.linalg.cholesky](https://pytorch.org/docs/stable/generated/torch.linalg.cholesky.html?highlight=linalg+cholesky#torch.linalg.cholesky) | [paddle.linalg.cholesky](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/cholesky_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.cholesky.md) | -| 78 | [torch.linalg.solve](https://pytorch.org/docs/stable/generated/torch.linalg.solve.html#torch.linalg.solve) | [paddle.linalg.solve](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/solve_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.solve.md) | -| 79 | [torch.linalg.solve_triangular](https://pytorch.org/docs/stable/generated/torch.linalg.solve_triangular.html?highlight=torch+linalg+solve_triangular#torch.linalg.solve_triangular) | [paddle.linalg.triangular_solve](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/triangular_solve_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.solve_triangular.md) | -| 80 | [torch.linalg.householder_product](https://pytorch.org/docs/stable/generated/torch.linalg.householder_product.html#torch.linalg.householder_product) | [paddle.linalg.householder_product](https://github.com/PaddlePaddle/Paddle/blob/d6ea911bd1bfda5604807eeb18318e71b395ac58/python/paddle/tensor/linalg.py#L3744) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.householder_product.md) | -| 81 | [torch.linalg.det](https://pytorch.org/docs/stable/generated/torch.linalg.det.html#torch.linalg.det) | [paddle.linalg.det](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/det_cn.html#det) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.det.md) | -| 82 | [torch.linalg.matrix_norm](https://pytorch.org/docs/stable/generated/torch.linalg.matrix_norm.html#torch.linalg.matrix_norm) | [paddle.linalg.matrix_norm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/matrix_norm_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.matrix_norm.md) | -| 83 | [torch.linalg.cross](https://pytorch.org/docs/stable/generated/torch.linalg.cross.html?highlight=torch+linalg+cross#torch.linalg.cross) | [paddle.cross](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/cross_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.cross.md) | -| 84 | [torch.linalg.svd](https://pytorch.org/docs/stable/generated/torch.linalg.svd.html?highlight=svd#torch.linalg.svd) | [paddle.linalg.svd](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/svd_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.svd.md) | -| 85 | [torch.linalg.eigvalsh](https://pytorch.org/docs/stable/generated/torch.linalg.eigvalsh.html#torch.linalg.eigvalsh) | [paddle.linalg.eigvalsh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/eigvalsh_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.eigvalsh.md) | -| 86 | [torch.linalg.qr](https://pytorch.org/docs/stable/generated/torch.linalg.qr.html#torch.linalg.qr) | [paddle.linalg.qr](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/qr_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.qr.md) | -| 87 | [torch.linalg.eigvals](https://pytorch.org/docs/stable/generated/torch.linalg.eigvals.html?highlight=torch+linalg+eigvals#torch.linalg.eigvals) | [paddle.linalg.eigvals](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/eigvals_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.eigvals.md) | -| 88 | [torch.linalg.pinv](https://pytorch.org/docs/stable/generated/torch.linalg.pinv.html#torch.linalg.pinv) | [paddle.linalg.pinv](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/pinv_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.pinv.md) | -| 89 | [torch.linalg.matrix_power](https://pytorch.org/docs/stable/generated/torch.linalg.matrix_power.html?highlight=torch+linalg+matrix_power#torch.linalg.matrix_power) | [paddle.linalg.matrix_power](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/matrix_power_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.matrix_power.md) | -| 90 | [torch.linalg.cond](https://pytorch.org/docs/stable/generated/torch.linalg.cond.html#torch.linalg.cond) | [paddle.linalg.cond](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/cond_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.cond.md) | -| 91 | [torch.linalg.matrix_rank](https://pytorch.org/docs/stable/generated/torch.linalg.matrix_rank.html?highlight=matrix_rank#torch.linalg.matrix_rank) | [paddle.linalg.matrix_rank](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/matrix_rank_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.matrix_rank.md) | -| 92 | [torch.linalg.lu_factor](https://pytorch.org/docs/stable/generated/torch.linalg.lu_factor.html#torch.linalg.lu_factor) | [paddle.linalg.lu](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/lu_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.lu_factor.md) | -| 93 | [torch.linalg.lu_factor_ex](https://pytorch.org/docs/stable/generated/torch.linalg.lu_factor_ex.html?highlight=lu_factor_ex#torch.linalg.lu_factor_ex) | [paddle.linalg.lu](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/lu_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.lu_factor_ex.md) | -| 94 | [torch.linalg.multi_dot](https://pytorch.org/docs/stable/generated/torch.linalg.multi_dot.html?highlight=torch+linalg+multi_dot#torch.linalg.multi_dot) | [paddle.linalg.multi_dot](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/multi_dot_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.multi_dot.md) | -| 95 | [torch.linalg.eig](https://pytorch.org/docs/stable/generated/torch.linalg.eig.html?highlight=torch+linalg+eig#torch.linalg.eig) | [paddle.linalg.eig](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/eig_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.eig.md) | -| 96 | [torch.linalg.eigh](https://pytorch.org/docs/stable/generated/torch.linalg.eigh.html#torch.linalg.eigh) | [paddle.linalg.eigh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/eigh_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.eigh.md) | -| 97 | [torch.special.i1](https://pytorch.org/docs/stable/special.html#torch.special.i1) | [paddle.i1](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/i1_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.i1.md) | -| 98 | [torch.special.i0e](https://pytorch.org/docs/stable/special.html#torch.special.i0e) | [paddle.i0e](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/i0e_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.i0e.md) | -| 99 | [torch.jit.save](https://pytorch.org/docs/stable/generated/torch.jit.save.html#torch-jit-save) | [paddle.jit.save](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/jit/save_cn.html#cn-api-paddle-jit-save) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.jit.save.md) | -| 100 | [torch.special.round](https://pytorch.org/docs/stable/special.html#torch.special.round) | [paddle.round](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/round_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.round.md) | -| 101 | [torch.special.log1p](https://pytorch.org/docs/stable/special.html#torch.special.log1p) | [paddle.log1p](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/log1p_cn.html#log1p) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.log1p.md) | -| 102 | [torch.autograd.functional.jacobian](https://pytorch.org/docs/stable/generated/torch.autograd.functional.jacobian.html#torch.autograd.functional.jacobian) | [paddle.incubate.autograd.Jacobian](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/incubate/autograd/Jacobian_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.autograd.functional.jacobian.md) | -| 103 | [torch.autograd.grad](https://pytorch.org/docs/stable/generated/torch.autograd.grad.html#torch.autograd.grad) | [paddle.grad](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/grad_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.autograd.grad.md) | -| 104 | [torch.jit.load](https://pytorch.org/docs/stable/generated/torch.jit.load.html#torch.jit.load) | [paddle.jit.load](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/jit/load_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.jit.load.md) | -| 105 | [torch.special.erf](https://pytorch.org/docs/stable/special.html?highlight=torch+special+erf#torch.special.erf) | [paddle.erf](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/erf_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.erf.md) | -| 106 | [torch.special.sinc](https://pytorch.org/docs/stable/special.html#torch.special.sinc) | [paddle.sinc](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/sinc_cn.html#sinc) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.sinc.md) | -| 107 | [torch.special.erfinv](https://pytorch.org/docs/stable/special.html#torch.special.erfinv) | [paddle.erfinv](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/erfinv_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.erfinv.md) | -| 108 | [torch.special.polygamma](https://pytorch.org/docs/stable/special.html#torch.special.polygamma) | [paddle.polygamma](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/polygamma_cn.html#paddle.polygamma) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.polygamma.md) | -| 109 | [torch.autograd.backward](https://pytorch.org/docs/stable/generated/torch.autograd.backward.html#torch.autograd.backward) | [paddle.autograd.backward](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/autograd/backward_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.autograd.backward.md) | -| 110 | [torch.autograd.functional.hessian](https://pytorch.org/docs/stable/generated/torch.autograd.functional.hessian.html#torch.autograd.functional.hessian) | [paddle.incubate.autograd.Hessian](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/incubate/autograd/Hessian_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.autograd.functional.hessian.md) | -| 111 | [torch.special.psi](https://pytorch.org/docs/stable/special.html#torch.special.psi) | [paddle.digamma](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/special.digamma_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.psi.md) | -| 112 | [torch.profiler.profile](https://pytorch.org/docs/stable/profiler.html#torch.profiler.profile) | [paddle.profiler.Profiler](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/profiler/Profiler_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.profiler.profile.md) | -| 113 | [torch.special.multigammaln](https://pytorch.org/docs/stable/special.html#torch.special.multigammaln) | [paddle.multigammaln](https://github.com/PaddlePaddle/Paddle/blob/be090bd0bc9ac7a8595296c316b3a6ed3dc60ba6/python/paddle/tensor/math.py#L5099) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.multigammaln.md) | -| 114 | [torch.autograd.functional.vjp](https://pytorch.org/docs/stable/generated/torch.autograd.functional.vjp.html#torch.autograd.functional.vjp) | [paddle.incubate.autograd.vjp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/incubate/autograd/vjp_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.autograd.functional.vjp.md) | -| 115 | [torch.jit.ignore](https://pytorch.org/docs/stable/generated/torch.jit.ignore.html#torch-jit-ignore) | [paddle.jit.not_to_static](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/jit/not_to_static_cn.html#not-to-static) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.jit.ignore.md) | -| 116 | [torch.special.gammaincc](https://pytorch.org/docs/stable/special.html#torch.special.gammaincc) | [paddle.gammaincc](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/index_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.gammaincc.md) | -| 117 | [torch.jit.script](https://pytorch.org/docs/stable/generated/torch.jit.script.html#torch-jit-script) | [paddle.jit.to_static](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/jit/to_static_cn.html#paddle.jit.to_static) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.jit.script.md) | -| 118 | [torch.onnx.export](https://pytorch.org/docs/stable/onnx.html#torch.onnx.export) | [paddle.onnx.export](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/onnx/export_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.onnx.export.md) | -| 119 | [torch.special.logit](https://pytorch.org/docs/stable/special.html#torch.special.logit) | [paddle.logit](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/logit_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.logit.md) | -| 120 | [torch.special.i0](https://pytorch.org/docs/stable/special.html#torch.special.i0) | [paddle.i0](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/i0_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.i0.md) | -| 121 | [torch.multiprocessing.spawn](https://pytorch.org/docs/stable/multiprocessing.html#torch.multiprocessing.spawn) | [paddle.distributed.spawn](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/spawn_cn.html#spawn) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.multiprocessing.spawn.md) | -| 122 | [torch.special.i1e](https://pytorch.org/docs/stable/special.html#torch.special.i1e) | [paddle.i1e](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/i1e_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.i1e.md) | -| 123 | [torch.special.digamma](https://pytorch.org/docs/stable/special.html#torch.special.digamma) | [paddle.digamma](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/special.digamma_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.digamma.md) | -| 124 | [torch.autograd.functional.jvp](https://pytorch.org/docs/stable/generated/torch.autograd.functional.jvp.html#torch.autograd.functional.jvp) | [paddle.incubate.autograd.jvp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/incubate/autograd/jvp_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.autograd.functional.jvp.md) | -| 125 | [torch.special.expm1](https://pytorch.org/docs/stable/special.html#torch.special.expm1) | [paddle.expm1](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/expm1_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.expm1.md) | -| 126 | [torch.special.gammainc](https://pytorch.org/docs/stable/special.html#torch.special.gammainc) | [paddle.gammainc](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/index_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.gammainc.md) | -| 127 | [torch.special.gammaln](https://pytorch.org/docs/stable/special.html#torch.special.gammaln) | [paddle.gammaln](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/gammaln_cn.html#gammaln) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.gammaln.md) | -| 128 | [torch.optim.SGD](https://pytorch.org/docs/stable/generated/torch.optim.SGD.html) | [paddle.optimizer.SGD](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/SGD_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.SGD.md) | -| 129 | [torch.optim.ASGD](https://pytorch.org/docs/stable/generated/torch.optim.ASGD.html) | [paddle.optimizer.ASGD](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/ASGD_cn.html#cn-api-paddle-optimizer-asgd) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.ASGD.md) | -| 130 | [torch.optim.RMSprop](https://pytorch.org/docs/stable/generated/torch.optim.RMSprop.html) | [paddle.optimizer.RMSProp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/RMSProp_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.RMSprop.md) | -| 131 | [torch.optim.Optimizer.step](https://pytorch.org/docs/stable/generated/torch.optim.Optimizer.step.html#torch-optim-optimizer-step) | [paddle.optimizer.Optimizer.step](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/Optimizer_cn.html#step) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.Optimizer.step.md) | -| 132 | [torch.optim.RAdam](https://pytorch.org/docs/stable/generated/torch.optim.RAdam.html#torch.optim.RAdam) | [paddle.optimizer.RAdam](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/RAdam_cn.html#radam) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.RAdam.md) | -| 133 | [torch.optim.NAdam](https://pytorch.org/docs/stable/generated/torch.optim.NAdam.html#torch.optim.NAdam) | [paddle.optimizer.NAdam](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/NAdam_cn.html#nadam) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.NAdam.md) | -| 134 | [torch.optim.Adamax](https://pytorch.org/docs/stable/generated/torch.optim.Adamax.html) | [paddle.optimizer.Adamax](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/Adamax_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.Adamax.md) | -| 135 | [torch.optim.Adam](https://pytorch.org/docs/stable/generated/torch.optim.Adam.html) | [paddle.optimizer.Adam](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/Adam_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.Adam.md) | -| 136 | [torch.optim.Adagrad](https://pytorch.org/docs/stable/generated/torch.optim.Adagrad.html) | [paddle.optimizer.Adagrad](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/Adagrad_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.Adagrad.md) | -| 137 | [torch.optim.Rprop](https://pytorch.org/docs/stable/generated/torch.optim.Rprop.html) | [paddle.optimizer.Rprop](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/Rprop_cn.html#cn-api-paddle-optimizer-rprop) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.Rprop.md) | -| 138 | [torch.optim.AdamW](https://pytorch.org/docs/stable/generated/torch.optim.AdamW.html) | [paddle.optimizer.AdamW](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/AdamW_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.AdamW.md) | -| 139 | [torch.optim.Adadelta](https://pytorch.org/docs/stable/generated/torch.optim.Adadelta.html) | [paddle.optimizer.Adadelta](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/Adadelta_cn.html#cn-api-paddle-optimizer-adadelta) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.Adadelta.md) | -| 140 | torch.clamp_min | [paddle.clip](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/clip_cn.html#clip) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.clamp_min.md) | -| 141 | [torch.randint_like](https://pytorch.org/docs/stable/generated/torch.randint_like.html?highlight=randint_like#torch.randint_like) | [paddle.randint_like](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/randint_like_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.randint_like.md) | -| 142 | [torch.lerp](https://pytorch.org/docs/stable/generated/torch.lerp.html?highlight=lerp#torch.lerp) | [paddle.lerp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/lerp_cn.html#lerp) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.lerp.md) | -| 143 | [torch.neg](https://pytorch.org/docs/stable/generated/torch.neg.html?highlight=neg#torch.neg) | [paddle.neg](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/neg_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.neg.md) | -| 144 | [torch.hamming_window](https://pytorch.org/docs/stable/generated/torch.hamming_window.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.hamming_window.md) | -| 145 | [torch.std](https://pytorch.org/docs/stable/generated/torch.std.html) | [paddle.std](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/std_cn.html#std) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.std.md) | -| 146 | [torch.blackman_window](https://pytorch.org/docs/stable/generated/torch.blackman_window.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.blackman_window.md) | -| 147 | [torch.logaddexp](https://pytorch.org/docs/stable/generated/torch.logaddexp.html#torch.logaddexp) | [paddle.logaddexp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/logaddexp_cn.html#logaddexp) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.logaddexp.md) | -| 148 | [torch.cummax](https://pytorch.org/docs/stable/generated/torch.cummax.html?highlight=cummax#torch.cummax) | [paddle.cummax](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/cummax_cn.html#cummax) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.cummax.md) | -| 149 | [torch.amp.autocast](https://pytorch.org/docs/stable/amp.html#torch.cuda.amp.autocast) | [paddle.amp.auto_cast](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/amp/auto_cast_cn.html#auto-cast) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.amp.autocast.md) | -| 150 | [torch.cosh](https://pytorch.org/docs/stable/generated/torch.cosh.html#torch.cosh) | [paddle.cosh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/cosh_cn.html#cosh) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.cosh.md) | -| 151 | [torch.angle](https://pytorch.org/docs/stable/generated/torch.angle.html) | [paddle.angle](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/angle_cn.html#angle) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.angle.md) | -| 152 | [torch.isneginf](https://pytorch.org/docs/stable/generated/torch.isneginf.html#torch-isneginf) | [paddle.isneginf](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/isneginf_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.isneginf.md) | -| 153 | [torch.remainder](https://pytorch.org/docs/stable/generated/torch.remainder.html?highlight=remainder#torch.remainder) | [paddle.remainder](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/remainder_cn.html#remainder) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.remainder.md) | -| 154 | [torch.cross](https://pytorch.org/docs/stable/generated/torch.cross.html?highlight=cross#torch.cross) | [paddle.cross](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/cross_cn.html#cross) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.cross.md) | -| 155 | [torch.cholesky_inverse](https://pytorch.org/docs/stable/generated/torch.cholesky_inverse.html?highlight=cholesky_inverse#torch.cholesky_inverse) | [paddle.linalg.cholesky_inverse](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/cholesky_inverse_cn.html#cholesky-inverse) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.cholesky_inverse.md) | -| 156 | [torch.max_pool2d](https://pytorch.org/docs/stable/jit_builtin_functions.html#supported-pytorch-functions) | [paddle.nn.functional.max_pool2d](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/functional/max_pool2d_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.max_pool2d.md) | -| 157 | [torch.copysign](https://pytorch.org/docs/stable/generated/torch.copysign.html#torch.copysign) | [paddle.copysign](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/copysign_cn.html#copysign) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.copysign.md) | -| 158 | [torch.square](https://pytorch.org/docs/stable/generated/torch.square.html?highlight=square#torch.square) | [paddle.square](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/square_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.square.md) | -| 159 | [torch.lu](https://pytorch.org/docs/stable/generated/torch.lu.html?highlight=lu#torch.lu) | [paddle.linalg.lu](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/lu_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.lu.md) | -| 160 | [torch.quantile](https://pytorch.org/docs/stable/generated/torch.quantile.html?highlight=quantile#torch.quantile) | [paddle.quantile](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/quantile_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.quantile.md) | -| 161 | [torch.ormqr](https://pytorch.org/docs/stable/generated/torch.ormqr.html#torch.ormqr) | [paddle.linalg.ormqr](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/ormqr_cn.html#ormqr) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.ormqr.md) | -| 162 | [torch.asarray](https://pytorch.org/docs/stable/generated/torch.asarray.html#torch.asarray) | [paddle.to_tensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/to_tensor_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.asarray.md) | -| 163 | [torch.cumprod](https://pytorch.org/docs/stable/generated/torch.cumprod.html?highlight=cumprod#torch.cumprod) | [paddle.cumprod](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/cumprod_cn.html#cumprod) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.cumprod.md) | -| 164 | [torch.cummin](https://pytorch.org/docs/stable/generated/torch.cummin.html) | [paddle.cummin](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/cummin_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.cummin.md) | -| 165 | [torch.asinh](https://pytorch.org/docs/stable/generated/torch.asinh.html#torch.asinh) | [paddle.asinh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/asinh_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.asinh.md) | -| 166 | [torch.hypot](https://pytorch.org/docs/stable/generated/torch.hypot.html#torch.hypot) | [paddle.hypot](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/hypot_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.hypot.md) | -| 167 | [torch.nextafter](https://pytorch.org/docs/stable/generated/torch.nextafter.html?highlight=nextafter#torch.nextafter) | [paddle.nextafter](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nextafter_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.nextafter.md) | -| 168 | [torch.fmod](https://pytorch.org/docs/stable/generated/torch.fmod.html?highlight=fmod#torch.fmod) | [paddle.mod](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/mod_cn.html#mod) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.fmod.md) | -| 169 | [torch.fix](https://pytorch.org/docs/stable/generated/torch.fix.html?highlight=torch+fix#torch.fix) | [paddle.trunc](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/trunc_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.fix.md) | -| 170 | [torch.median](https://pytorch.org/docs/stable/generated/torch.median.html?highlight=median#torch.median) | [paddle.median](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/median_cn.html#median) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.median.md) | -| 171 | [torch.lgamma](https://pytorch.org/docs/stable/generated/torch.lgamma.html?highlight=lgamma#torch.lgamma) | [paddle.lgamma](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/lgamma_cn.html#lgamma) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.lgamma.md) | -| 172 | [torch.atan2](https://pytorch.org/docs/stable/generated/torch.atan2.html#torch.atan2) | [paddle.atan2](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/atan2_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.atan2.md) | -| 173 | [torch.acosh](https://pytorch.org/docs/stable/generated/torch.acosh.html?highlight=acosh#torch.acosh) | [paddle.acosh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/acosh_cn.html#acos) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.acosh.md) | -| 174 | [torch.nanmedian](https://pytorch.org/docs/stable/generated/torch.nanmedian.html?highlight=nanmedian#torch.nanmedian) | [paddle.nanmedian](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nanmedian_cn.html#nanmedian) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.nanmedian.md) | -| 175 | [torch.inverse](https://pytorch.org/docs/stable/generated/torch.inverse.html?highlight=inverse#torch.inverse) | [paddle.linalg.inv](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/inv_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.inverse.md) | -| 176 | [torch.linspace](https://pytorch.org/docs/stable/generated/torch.linspace.html?highlight=linspace#torch.linspace) | [paddle.linspace](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linspace_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.linspace.md) | -| 177 | torch.scalar_tensor | [paddle.to_tensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/to_tensor_cn.html#to-tensor) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.scalar_tensor.md) | -| 178 | [torch.isposinf](https://pytorch.org/docs/stable/generated/torch.isposinf.html#torch-isposinf) | [paddle.isposinf](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/isposinf_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.isposinf.md) | -| 179 | [torch.index_add](https://pytorch.org/docs/stable/generated/torch.index_add.html#torch.index_add) | [paddle.index_add](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/index_add_cn.html#index-add) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.index_add.md) | -| 180 | [torch.acos](https://pytorch.org/docs/stable/generated/torch.acos.html?highlight=acos#torch.acos) | [paddle.acos](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/acos_cn.html#acos) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.acos.md) | -| 181 | [torch.randint](https://pytorch.org/docs/stable/generated/torch.randint.html?highlight=randint#torch.randint) | [paddle.randint](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/randint_cn.html#randint) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.randint.md) | -| 182 | [torch.mv](https://pytorch.org/docs/stable/generated/torch.mv.html?highlight=torch+mv#torch.mv) | [paddle.mv](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/mv_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.mv.md) | -| 183 | [torch.vdot](https://pytorch.org/docs/stable/generated/torch.vdot.html#torch.vdot) | [paddle.dot](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/dot_cn.html#dot) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.vdot.md) | -| 184 | [torch.negative](https://pytorch.org/docs/stable/generated/torch.negative.html?highlight=torch+negative#torch.negative) | [paddle.neg](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/neg_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.negative.md) | -| 185 | [torch.bernoulli](https://pytorch.org/docs/stable/generated/torch.bernoulli.html#torch.bernoulli) | [paddle.bernoulli](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/bernoulli_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.bernoulli.md) | -| 186 | [torch.inner](https://pytorch.org/docs/stable/generated/torch.inner.html?highlight=inner#torch.inner) | [paddle.inner](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/inner_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.inner.md) | -| 187 | [torch.bucketize](https://pytorch.org/docs/stable/generated/torch.bucketize.html#torch.bucketize) | [paddle.bucketize](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/bucketize_cn.html#paddle-bucketize) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.bucketize.md) | -| 188 | [torch.nan_to_num](https://pytorch.org/docs/stable/generated/torch.nan_to_num.html?highlight=nan_to_num#torch.nan_to_num) | [paddle.nan_to_num](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nan_to_num_cn.html#nan-to-num) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.nan_to_num.md) | -| 189 | [torch.triu_indices](https://pytorch.org/docs/stable/generated/torch.triu_indices.html?highlight=triu_indices#torch.triu_indices) | [paddle.triu_indices](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/triu_indices_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.triu_indices.md) | -| 190 | [torch.logspace](https://pytorch.org/docs/stable/generated/torch.logspace.html?highlight=logspace#torch.logspace) | [paddle.logspace](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/logspace_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.logspace.md) | -| 191 | [torch.set_printoptions](https://pytorch.org/docs/stable/generated/torch.set_printoptions.html?highlight=torch+set_printoptions#torch.set_printoptions) | [paddle.set_printoptions](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/set_printoptions_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.set_printoptions.md) | -| 192 | [torch.save](https://pytorch.org/docs/stable/generated/torch.save.html?highlight=save#torch.save) | [paddle.save](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/save_cn.html#save) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.save.md) | -| 193 | [torch.fmax](https://pytorch.org/docs/stable/generated/torch.fmax.html#torch.fmax) | [paddle.fmax](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fmax_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.fmax.md) | -| 194 | [torch.baddbmm](https://pytorch.org/docs/stable/generated/torch.baddbmm.html?highlight=baddbmm#torch.baddbmm) | [paddle.baddbmm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/baddbmm_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.baddbmm.md) | -| 195 | [torch.deg2rad](https://pytorch.org/docs/stable/generated/torch.deg2rad.html#torch-deg2rad) | [paddle.deg2rad](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/deg2rad_cn.html#paddle.deg2rad) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.deg2rad.md) | -| 196 | [torch.gcd](https://pytorch.org/docs/stable/generated/torch.gcd.html#torch-gcd) | [paddle.gcd](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/gcd_cn.html#gcd) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.gcd.md) | -| 197 | [torch.trunc](https://pytorch.org/docs/stable/generated/torch.trunc.html?highlight=torch+trunc#torch.trunc) | [paddle.trunc](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/trunc_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.trunc.md) | -| 198 | [torch.qr](https://pytorch.org/docs/stable/generated/torch.qr.html#torch.qr) | [paddle.linalg.qr](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/qr_cn.html#qr) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.qr.md) | -| 199 | [torch.ldexp](https://pytorch.org/docs/stable/generated/torch.ldexp.html#torch.ldexp) | [paddle.ldexp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/ldexp_cn.html#ldexp) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.ldexp.md) | -| 200 | [torch.asin](https://pytorch.org/docs/stable/generated/torch.asin.html#torch.asin) | [paddle.asin](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/asin_cn.html#asin) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.asin.md) | -| 201 | [torch.unique](https://pytorch.org/docs/stable/generated/torch.unique.html?highlight=unique#torch.unique) | [paddle.unique](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/unique_cn.html#unique) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.unique.md) | -| 202 | [torch.signbit](https://pytorch.org/docs/stable/generated/torch.signbit.html#torch-signbit) | [paddle.signbit](https://github.com/PaddlePaddle/Paddle/blob/9ce3a54f456011c664c70fbcd318f2e1af0a7d81/python/paddle/tensor/math.py#L7175) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.signbit.md) | -| 203 | [torch.svd](https://pytorch.org/docs/stable/generated/torch.svd.html?highlight=torch+svd#torch.svd) | [paddle.linalg.svd](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/svd_cn.html#svd) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.svd.md) | -| 204 | [torch.atan](https://pytorch.org/docs/stable/generated/torch.atan.html#torch.atan) | [paddle.atan](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/atan_cn.html#atan) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.atan.md) | -| 205 | [torch.normal](https://pytorch.org/docs/stable/generated/torch.normal.html#torch.normal) | [paddle.normal](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/normal_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.normal.md) | -| 206 | [torch.nanmean](https://pytorch.org/docs/stable/generated/torch.nanmean.html?highlight=nanmean#torch.nanmean) | [paddle.nanmean](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nanmean_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.nanmean.md) | -| 207 | [torch.searchsorted](https://pytorch.org/docs/stable/generated/torch.searchsorted.html#torch-searchsorted) | [paddle.searchsorted](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/searchsorted_cn.html#searchsorted) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.searchsorted.md) | -| 208 | [torch.lt](https://pytorch.org/docs/stable/generated/torch.lt.html#torch.lt) | [paddle.less_than](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/less_than_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.lt.md) | -| 209 | [torch.autocast](https://pytorch.org/docs/stable/amp.html?highlight=autocast#torch.autocast) | [paddle.amp.auto_cast](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/amp/auto_cast_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.autocast.md) | -| 210 | [torch.sparse_csr_tensor](https://pytorch.org/docs/stable/generated/torch.sparse_csr_tensor.html#torch.sparse_csr_tensor) | [paddle.sparse.sparse_csr_tensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/sparse/sparse_csr_tensor_cn.html#sparse-csr-tensor) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.sparse_csr_tensor.md) | -| 211 | [torch.abs](https://pytorch.org/docs/stable/generated/torch.abs.html?highlight=abs#torch.abs) | [paddle.abs](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/abs_cn.html#abs) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.abs.md) | -| 212 | [torch.atanh](https://pytorch.org/docs/stable/generated/torch.atanh.html#torch.atanh) | [paddle.atanh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/atanh_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.atanh.md) | -| 213 | [torch.lu_unpack](https://pytorch.org/docs/stable/generated/torch.lu_unpack.html?highlight=lu_unpack#torch.lu_unpack) | [paddle.linalg.lu_unpack](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/lu_unpack_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.lu_unpack.md) | -| 214 | [torch.max_pool1d](https://pytorch.org/docs/stable/jit_builtin_functions.html#supported-pytorch-functions) | [paddle.nn.functional.max_pool1d](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/functional/max_pool1d_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.max_pool1d.md) | -| 215 | [torch.exp](https://pytorch.org/docs/stable/generated/torch.exp.html?highlight=torch+exp#torch.exp) | [paddle.exp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/exp_cn.html#exp) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.exp.md) | -| 216 | [torch.stft](https://pytorch.org/docs/stable/generated/torch.stft.html?highlight=stft#torch.stft) | [paddle.signal.stft](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/signal/stft_cn.html#paddle.signal.stft) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.stft.md) | -| 217 | [torch.logcumsumexp](https://pytorch.org/docs/stable/generated/torch.logcumsumexp.html#torch-logcumsumexp) | [paddle.logcumsumexp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/logcumsumexp_cn.html#logcumsumexp) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.logcumsumexp.md) | -| 218 | [torch.ne](https://pytorch.org/docs/stable/generated/torch.ne.html?highlight=torch.ne#torch.ne) | [paddle.not_equal](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/not_equal_cn.html#not_equal) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.ne.md) | -| 219 | [torch.renorm](https://pytorch.org/docs/stable/generated/torch.renorm.html#torch-renorm) | paddle.renorm | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.renorm.md) | -| 220 | [torch.randn_like](https://pytorch.org/docs/stable/generated/torch.randn_like.html#torch.randn_like) | [paddle.randn_like](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/randn_like_cn.html#randn_like) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.randn_like.md) | -| 221 | [torch.log1p](https://pytorch.org/docs/stable/generated/torch.log1p.html?highlight=log1p#torch.log1p) | [paddle.log1p](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/log1p_cn.html#log1p) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.log1p.md) | -| 222 | [torch.load](https://pytorch.org/docs/stable/generated/torch.load.html?highlight=load#torch.load) | [paddle.load](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/load_cn.html#load) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.load.md) | -| 223 | [torch.hann_window](https://pytorch.org/docs/stable/generated/torch.hann_window.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.hann_window.md) | -| 224 | [torch.hub.load_state_dict_from_url](https://pytorch.org/docs/stable/hub.html#torch.hub.load_state_dict_from_url) | [paddle.hub.load_state_dict_from_url](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/hub/load_state_dict_from_url_cn.html#load-state-dict-from-url) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.hub.load_state_dict_from_url.md) | -| 225 | [torch.fmin](https://pytorch.org/docs/stable/generated/torch.fmin.html#torch.fmin) | [paddle.fmin](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fmin_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.fmin.md) | -| 226 | [torch.mode](https://pytorch.org/docs/stable/generated/torch.mode.html) | [paddle.mode](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/mode_cn.html#mode) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.mode.md) | -| 227 | [torch.addmm](https://pytorch.org/docs/stable/generated/torch.addmm.html?highlight=addmm#torch.addmm) | [paddle.addmm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/addmm_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.addmm.md) | -| 228 | [torch.log10](https://pytorch.org/docs/stable/generated/torch.log10.html?highlight=log10#torch.log10) | [paddle.log10](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/log10_cn.html#log10) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.log10.md) | -| 229 | [torch.nn.modules.batchnorm._BatchNorm](https://pytorch.org/docs/stable/_modules/torch/nn/modules/batchnorm.html) | [paddle.nn.layer.norm._BatchNormBase](https://github.com/PaddlePaddle/Paddle/blob/b51d50bc9ee9eaa5cefa18507195b239e4513194/python/paddle/nn/layer/norm.py#L701) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.nn.modules.batchnorm._BatchNorm.md) | -| 230 | [torch.sgn](https://pytorch.org/docs/stable/generated/torch.sgn.html?highlight=torch+sgn#torch.sgn) | [paddle.sgn](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/sgn_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.sgn.md) | -| 231 | [torch.tril_indices](https://pytorch.org/docs/stable/generated/torch.tril_indices.html?highlight=tril_indices#torch.tril_indices) | [paddle.tril_indices](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/tril_indices_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.tril_indices.md) | -| 232 | [torch.cholesky](https://pytorch.org/docs/stable/generated/torch.cholesky.html?highlight=cholesky#torch.cholesky) | [paddle.linalg.cholesky](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/cholesky_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.cholesky.md) | -| 233 | [torch.frac](https://pytorch.org/docs/stable/generated/torch.frac.html?highlight=frac#torch.frac) | [paddle.frac](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/frac_cn.html#frac) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.frac.md) | -| 234 | [torch.randperm](https://pytorch.org/docs/stable/generated/torch.randperm.html?highlight=rand#torch.randperm) | [paddle.randperm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/randperm_cn.html#randperm) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.randperm.md) | -| 235 | [torch.rad2deg](https://pytorch.org/docs/stable/generated/torch.rad2deg.html?highlight=torch+rad2deg#torch.rad2deg) | [paddle.rad2deg](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/rad2deg_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.rad2deg.md) | -| 236 | [torch.frexp](https://pytorch.org/docs/stable/generated/torch.frexp.html?highlight=frexp#torch.frexp) | [paddle.frexp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/frexp_cn.html#frexp) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.frexp.md) | -| 237 | [torch.tensordot](https://pytorch.org/docs/stable/generated/torch.tensordot.html?highlight=tensordot#torch.tensordot) | [paddle.tensordot](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/tensordot_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.tensordot.md) | -| 238 | [torch.mvlgamma](https://pytorch.org/docs/stable/generated/torch.mvlgamma.html) | [paddle.multigammaln](https://github.com/PaddlePaddle/Paddle/blob/be090bd0bc9ac7a8595296c316b3a6ed3dc60ba6/python/paddle/tensor/math.py#L5099) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.mvlgamma.md) | -| 239 | [torch.sinh](https://pytorch.org/docs/stable/generated/torch.sinh.html?highlight=sinh#torch.sinh) | [paddle.sinh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/sinh_cn.html#sinh) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.sinh.md) | -| 240 | [torch.lcm](https://pytorch.org/docs/stable/generated/torch.lcm.html#torch-lcm) | [paddle.lcm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/lcm_cn.html#lcm) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.lcm.md) | -| 241 | [torch.diag](https://pytorch.org/docs/stable/generated/torch.diag.html?highlight=diag#torch.diag) | [paddle.diag](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/diag_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.diag.md) | -| 242 | [torch.reciprocal](https://pytorch.org/docs/stable/generated/torch.reciprocal.html?highlight=torch+reciprocal#torch.reciprocal) | [paddle.reciprocal](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/reciprocal_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.reciprocal.md) | -| 243 | [torch.conj_physical](https://pytorch.org/docs/stable/generated/torch.conj_physical.html#torch.conj_physical) | [paddle.conj](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/conj_cn.html#conj) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.conj_physical.md) | -| 244 | [torch.heaviside](https://pytorch.org/docs/stable/generated/torch.heaviside.html#torch.heaviside) | [paddle.heaviside](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/heaviside_cn.html#heaviside) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.heaviside.md) | -| 245 | [torch.nanquantile](https://pytorch.org/docs/stable/generated/torch.nanquantile.html?highlight=nanquantile#torch.nanquantile) | [paddle.nanquantile](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nanquantile_cn.html#nanquantile) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.nanquantile.md) | -| 246 | [torch.mm](https://pytorch.org/docs/stable/generated/torch.mm.html?highlight=torch+mm#torch.mm) | [paddle.mm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/mm_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.mm.md) | -| 247 | [torch.clone](https://pytorch.org/docs/stable/generated/torch.clone.html?highlight=clone#torch.clone) | [paddle.clone](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/clone_cn.html#clone) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.clone.md) | -| 248 | torch.clamp_max | [paddle.clip](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/clip_cn.html#clip) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.clamp_max.md) | -| 249 | [torch.round](https://pytorch.org/docs/stable/generated/torch.round.html?highlight=round#torch.round) | [paddle.round](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/round_cn.html#round) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.round.md) | -| 250 | [torch.sub](https://pytorch.org/docs/stable/generated/torch.sub.html?highlight=torch%20sub#torch.sub) | [paddle.subtract](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/subtract_cn.html#subtract) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.sub.md) | -| 251 | [torch.column_stack](https://pytorch.org/docs/stable/generated/torch.column_stack.html#torch.column_stack) | [paddle.column_stack](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/column_stack_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.column_stack.md) | -| 252 | [torch.meshgrid](https://pytorch.org/docs/stable/generated/torch.meshgrid.html?highlight=meshgrid#torch.meshgrid) | [paddle.meshgrid](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/meshgrid_cn.html#meshgrid) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.meshgrid.md) | -| 253 | [torch.symeig](https://pytorch.org/docs/stable/generated/torch.symeig.html?highlight=torch+symeig#torch.symeig) | [paddle.linalg.eigh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/eigh_cn.html#eigh) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.symeig.md) | -| 254 | [torch.poisson](https://pytorch.org/docs/stable/generated/torch.poisson.html#torch.poisson) | [paddle.poisson](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/poisson_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.poisson.md) | -| 255 | [torch.hub.list](https://pytorch.org/docs/stable/hub.html?highlight=hub+list#torch.hub.list) | [paddle.hub.list](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/hub/list_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.list.md) | -| 256 | [torch.hub.help](https://pytorch.org/docs/stable/hub.html?highlight=hub+help#torch.hub.help) | [paddle.hub.help](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/hub/help_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.help.md) | -| 257 | [torch.hub.download_url_to_file](https://pytorch.org/docs/stable/hub.html?highlight=download#torch.hub.download_url_to_file) | [paddle.utils.download.get_weights_path_from_url](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/utils/download/get_weights_path_from_url_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.download_url_to_file.md) | -| 258 | [torch.hub.load](https://pytorch.org/docs/stable/hub.html?highlight=hub+load#torch.hub.load) | [paddle.hub.load](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/hub/load_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.load.md) | -| 259 | [torch.fft.fft](https://pytorch.org/docs/stable/generated/torch.fft.fft.html?highlight=fft#torch.fft.fft) | [paddle.fft.fft](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/fft_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.fft.md) | -| 260 | [torch.fft.hfft2](https://pytorch.org/docs/stable/generated/torch.fft.hfft2.html?highlight=torch+fft+hfft2#torch.fft.hfft2) | [paddle.fft.hfft2](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/hfft2_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.hfft2.md) | -| 261 | [torch.fft.irfft2](https://pytorch.org/docs/stable/generated/torch.fft.irfft2.html#torch-fft-irfft2) | [paddle.fft.irfft2](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/irfft2_cn.html#irfft2) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.irfft2.md) | -| 262 | [torch.fft.fftn](https://pytorch.org/docs/stable/generated/torch.fft.fftn.html?highlight=fftn#torch.fft.fftn) | [paddle.fft.fftn](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/fftn_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.fftn.md) | -| 263 | [torch.fft.rfftfreq](https://pytorch.org/docs/stable/generated/torch.fft.rfftfreq.html?highlight=rfftfreq#torch.fft.rfftfreq) | [paddle.fft.rfftfreq](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/rfftfreq_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.rfftfreq.md) | -| 264 | [torch.fft.irfft](https://pytorch.org/docs/stable/generated/torch.fft.irfft.html#torch-fft-irfft) | [paddle.fft.irfft](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/irfft_cn.html#irfft) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.irfft.md) | -| 265 | [torch.fft.ifft2](https://pytorch.org/docs/stable/generated/torch.fft.ifft2.html?highlight=ifft2#torch.fft.ifft2) | [paddle.fft.ifft2](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/ifft2_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.ifft2.md) | -| 266 | [torch.fft.hfft](https://pytorch.org/docs/stable/generated/torch.fft.hfft.html?highlight=hfft#torch.fft.hfft) | [paddle.fft.hfft](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/hfft_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.hfft.md) | -| 267 | [torch.fft.fftfreq](https://pytorch.org/docs/stable/generated/torch.fft.fftfreq.html?highlight=fftfreq#torch.fft.fftfreq) | [paddle.fft.fftfreq](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/fftfreq_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.fftfreq.md) | -| 268 | [torch.fft.rfft](https://pytorch.org/docs/stable/generated/torch.fft.rfft.html#torch-fft-rfft) | [paddle.fft.rfft](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/rfft_cn.html#rfft) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.rfft.md) | -| 269 | [torch.fft.ihfft2](https://pytorch.org/docs/stable/generated/torch.fft.ihfft2.html?highlight=torch+fft+ihfft2#torch.fft.ihfft2) | [paddle.fft.ihfft2](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/ihfft2_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.ihfft2.md) | -| 270 | [torch.fft.hfftn](https://pytorch.org/docs/stable/generated/torch.fft.hfftn.html?highlight=torch+fft+hfftn#torch.fft.hfftn) | [paddle.fft.hfftn](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/hfftn_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.hfftn.md) | -| 271 | [torch.fft.ihfftn](https://pytorch.org/docs/stable/generated/torch.fft.ihfftn.html?highlight=torch+fft+ihfftn#torch.fft.ihfftn) | [paddle.fft.ihfftn](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/ihfftn_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.ihfftn.md) | -| 272 | [torch.fft.irfftn](https://pytorch.org/docs/stable/generated/torch.fft.irfftn.html?highlight=irfftn#torch.fft.irfftn) | [paddle.fft.irfftn](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/irfftn_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.irfftn.md) | -| 273 | [torch.fft.ihfft](https://pytorch.org/docs/stable/generated/torch.fft.ihfft.html?highlight=ihfft#torch.fft.ihfft) | [paddle.fft.ihfft](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/ihfft_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.ihfft.md) | -| 274 | [torch.fft.fft2](https://pytorch.org/docs/stable/generated/torch.fft.fft2.html?highlight=fft2#torch.fft.fft2) | [paddle.fft.fft2](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/fft2_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.fft2.md) | -| 275 | [torch.fft.rfft2](https://pytorch.org/docs/stable/generated/torch.fft.rfft2.html) | [paddle.fft.rfft2](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/rfft2_cn.html#rfft2) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.rfft2.md) | -| 276 | [torch.fft.ifftn](https://pytorch.org/docs/stable/generated/torch.fft.ifftn.html?highlight=ifftn#torch.fft.ifftn) | [paddle.fft.ifftn](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/ifftn_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.ifftn.md) | -| 277 | [torch.fft.rfftn](https://pytorch.org/docs/stable/generated/torch.fft.rfftn.html#torch-fft-rfftn) | [paddle.fft.rfftn](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/rfftn_cn.html#rfftn) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.rfftn.md) | -| 278 | [torch.fft.ifft](https://pytorch.org/docs/stable/generated/torch.fft.ifft.html?highlight=ifft#torch.fft.ifft) | [paddle.fft.ifft](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/ifft_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.ifft.md) | -| 279 | [torch.cuda.comm.broadcast](https://pytorch.org/docs/stable/generated/torch.cuda.comm.broadcast.html#torch.cuda.comm.broadcast) | [paddle.distributed.broadcast](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/broadcast_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/cuda/torch.cuda.comm.broadcast.md) | -| 280 | [torch.distributed.init_process_group](https://pytorch.org/docs/stable/distributed.html?highlight=init_process#torch.distributed.init_process_group) | [paddle.distributed.init_parallel_env](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/init_parallel_env_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.init_process_group.md) | -| 281 | [torch.distributed.ReduceOp](https://pytorch.org/docs/stable/distributed.html?highlight=torch+distributed+reduceop#torch.distributed.ReduceOp) | [paddle.distributed.ReduceOp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/ReduceOp_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.ReduceOp.md) | -| 282 | [torch.distributed.broadcast_object_list](https://pytorch.org/docs/stable/distributed.html?highlight=broadcast_object_list#torch.distributed.broadcast_object_list) | [paddle.distributed.broadcast_object_list](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/distributed/broadcast_object_list_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.broadcast_object_list.md) | -| 283 | [torch.distributed.P2POp](https://pytorch.org/docs/stable/distributed.html#torch.distributed.P2POp) | [paddle.distributed.P2POp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/Overview_cn.html#paddle-distributed) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.P2POp.md) | -| 284 | [torch.distributed.new_group](https://pytorch.org/docs/stable/distributed.html#torch.distributed.new_group) | [paddle.distributed.new_group](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/new_group_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.new_group.md) | -| 285 | [torch.distributed.recv](https://pytorch.org/docs/stable/distributed.html#torch.distributed.recv) | [paddle.distributed.recv](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/recv_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.recv.md) | -| 286 | [torch.distributed.rpc.init_rpc](https://pytorch.org/docs/stable/rpc.html#torch.distributed.rpc.init_rpc) | [paddle.distributed.rpc.init_rpc](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/rpc/init_rpc_cn.html#init-rpc) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.rpc.init_rpc.md) | -| 287 | [torch.distributed.monitored_barrier](https://pytorch.org/docs/stable/distributed.html#torch.distributed.monitored_barrier) | [paddle.distributed.barrier](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/barrier_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.monitored_barrier.md) | -| 288 | [torch.distributed.isend](https://pytorch.org/docs/stable/distributed.html#torch.distributed.isend) | [paddle.distributed.isend](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/distributed/isend_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.isend.md) | -| 289 | [torch.distributed.barrier](https://pytorch.org/docs/stable/distributed.html?highlight=barrier#torch.distributed.barrier) | [paddle.distributed.barrier](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/barrier_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.barrier.md) | -| 290 | [torch.distributed.send](https://pytorch.org/docs/stable/distributed.html#torch.distributed.send) | [paddle.distributed.send](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/send_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.send.md) | -| 291 | [torch.distributed.rpc.shutdown](https://pytorch.org/docs/stable/rpc.html#torch.distributed.rpc.shutdown) | [paddle.distributed.rpc.shutdown](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/rpc/shutdown_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.rpc.shutdown.md) | -| 292 | [torch.distributed.irecv](https://pytorch.org/docs/stable/distributed.html?highlight=send#torch.distributed.irecv) | [paddle.distributed.irecv](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/distributed/irecv_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.irecv.md) | -| 293 | [torch.nn.Bilinear](https://pytorch.org/docs/stable/generated/torch.nn.Bilinear.html#torch.nn.Bilinear) | [paddle.nn.Bilinear](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Bilinear_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Bilinear.md) | -| 294 | [torch.nn.SiLU](https://pytorch.org/docs/stable/generated/torch.nn.SiLU.html#torch.nn.SiLU) | [paddle.nn.Silu](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Silu_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.SiLU.md) | -| 295 | [torch.nn.MultiLabelMarginLoss](https://pytorch.org/docs/stable/generated/torch.nn.MultiLabelMarginLoss.html#torch.nn.MultiLabelMarginLoss) | [paddle.nn.MultiLabelMarginLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/MultiLabelMarginLoss_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.MultiLabelMarginLoss.md) | -| 296 | [torch.nn.Dropout](https://pytorch.org/docs/stable/generated/torch.nn.Dropout.html?highlight=dropout#torch.nn.Dropout) | [paddle.nn.Dropout](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Dropout_cn.html#dropout) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Dropout.md) | -| 297 | [torch.nn.LayerNorm](https://pytorch.org/docs/stable/generated/torch.nn.LayerNorm.html?highlight=layernorm#torch.nn.LayerNorm) | [paddle.nn.LayerNorm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/LayerNorm_cn.html#layernorm) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.LayerNorm.md) | -| 298 | [torch.nn.GroupNorm](https://pytorch.org/docs/stable/generated/torch.nn.GroupNorm.html?highlight=groupnorm#torch.nn.GroupNorm) | [paddle.nn.GroupNorm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/GroupNorm_cn.html#groupnorm) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.GroupNorm.md) | -| 299 | [torch.nn.BCEWithLogitsLoss](https://pytorch.org/docs/stable/generated/torch.nn.BCEWithLogitsLoss.html#bcewithlogitsloss) | [paddle.nn.BCEWithLogitsLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/BCEWithLogitsLoss_cn.html#bcewithlogitsloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.BCEWithLogitsLoss.md) | -| 300 | [torch.nn.ELU](https://pytorch.org/docs/stable/generated/torch.nn.ELU.html?highlight=elu#torch.nn.ELU) | [paddle.nn.ELU](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/ELU_cn.html#elu) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.ELU.md) | -| 301 | [torch.nn.NLLLoss](https://pytorch.org/docs/stable/generated/torch.nn.NLLLoss.html?highlight=nllloss#torch.nn.NLLLoss) | [paddle.nn.NLLLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/NLLLoss_cn.html#nllloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.NLLLoss.md) | -| 302 | [torch.nn.InstanceNorm3d](https://pytorch.org/docs/stable/generated/torch.nn.InstanceNorm3d.html#torch.nn.InstanceNorm3d) | [paddle.nn.InstanceNorm3D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/InstanceNorm3D_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.InstanceNorm3d.md) | -| 303 | [torch.nn.Dropout3d](https://pytorch.org/docs/stable/generated/torch.nn.Dropout3d.html?highlight=dropout3d#torch.nn.Dropout3d) | [paddle.nn.Dropout3D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Dropout3D_cn.html#dropout3d) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Dropout3d.md) | -| 304 | [torch.nn.FractionalMaxPool3d](https://pytorch.org/docs/stable/generated/torch.nn.FractionalMaxPool3d.html#fractionalmaxpool3d) | [paddle.nn.FractionalMaxPool3D](https://www.paddlepaddle.org.cn/documentation/docs/en/develop/api/paddle/nn/FractionalMaxPool3D_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.FractionalMaxPool3d.md) | -| 305 | [torch.nn.Module.register_forward_pre_hook](https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.register_forward_pre_hook) | [paddle.nn.Layer.register_forward_pre_hook](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Layer_cn.html#register-forward-pre-hook-hook) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Module.register_forward_pre_hook.md) | -| 306 | [torch.nn.Mish](https://pytorch.org/docs/stable/generated/torch.nn.Mish.html?highlight=torch+nn+mish) | [paddle.nn.Mish](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Mish_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Mish.md) | -| 307 | [torch.nn.Hardswish](https://pytorch.org/docs/stable/generated/torch.nn.Hardswish.html#torch.nn.Hardswish) | [paddle.nn.Hardswish](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Hardswish_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Hardswish.md) | -| 308 | [torch.nn.Module.load_state_dict](https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.load_state_dict) | [paddle.nn.Layer.set_state_dict](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Layer_cn.html#set-state-dict-state-dict-use-structured-name-true) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Module.load_state_dict.md) | -| 309 | [torch.nn.PoissonNLLLoss](https://pytorch.org/docs/stable/generated/torch.nn.PoissonNLLLoss) | [paddle.nn.PoissonNLLLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/PoissonNLLLoss_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.PoissonNLLLoss.md) | -| 310 | [torch.nn.MaxPool1d](https://pytorch.org/docs/stable/generated/torch.nn.MaxPool1d.html?highlight=maxpool1d#torch.nn.MaxPool1d) | [paddle.nn.MaxPool1D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/MaxPool1D_cn.html#maxpool1d) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.MaxPool1d.md) | -| 311 | [torch.nn.FractionalMaxPool2d](https://pytorch.org/docs/stable/generated/torch.nn.FractionalMaxPool2d.html#fractionalmaxpool2d) | [paddle.nn.FractionalMaxPool2D](https://www.paddlepaddle.org.cn/documentation/docs/en/develop/api/paddle/nn/FractionalMaxPool2D_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.FractionalMaxPool2d.md) | -| 312 | [torch.nn.Hardtanh](https://pytorch.org/docs/stable/generated/torch.nn.Hardtanh.html#torch.nn.Hardtanh) | [paddle.nn.Hardtanh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Hardtanh_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Hardtanh.md) | -| 313 | [torch.nn.AdaptiveLogSoftmaxWithLoss](https://pytorch.org/docs/stable/generated/torch.nn.AdaptiveLogSoftmaxWithLoss.html#adaptivelogsoftmaxwithloss) | [paddle.nn.AdaptiveLogSoftmaxWithLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/AdaptiveLogSoftmaxWithLoss_cn.html#adaptivelogsoftmaxwithloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.AdaptiveLogSoftmaxWithLoss.md) | -| 314 | [torch.nn.Transformer](https://pytorch.org/docs/stable/generated/torch.nn.Transformer.html#torch.nn.Transformer) | [paddle.nn.Transformer](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Transformer_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Transformer.md) | -| 315 | [torch.nn.LeakyReLU](https://pytorch.org/docs/stable/generated/torch.nn.LeakyReLU.html?highlight=leakyrelu#torch.nn.LeakyReLU) | [paddle.nn.LeakyReLU](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/LeakyReLU_cn.html#leakyrelu) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.LeakyReLU.md) | -| 316 | [torch.nn.TransformerEncoder](https://pytorch.org/docs/stable/generated/torch.nn.TransformerEncoder.html#torch.nn.TransformerEncoder) | [paddle.nn.TransformerEncoder](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/TransformerEncoder_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.TransformerEncoder.md) | -| 317 | [torch.nn.SmoothL1Loss](https://pytorch.org/docs/stable/generated/torch.nn.SmoothL1Loss.html?highlight=smoothl1loss#torch.nn.SmoothL1Loss) | [paddle.nn.SmoothL1Loss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/SmoothL1Loss_cn.html#smoothl1loss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.SmoothL1Loss.md) | -| 318 | [torch.nn.MultiLabelSoftMarginLoss](https://pytorch.org/docs/stable/generated/torch.nn.MultiLabelSoftMarginLoss.html#torch.nn.MultiLabelSoftMarginLoss) | [paddle.nn.MultiLabelSoftMarginLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/MultiLabelSoftMarginLoss_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.MultiLabelSoftMarginLoss.md) | -| 319 | [torch.nn.CosineEmbeddingLoss](https://pytorch.org/docs/stable/generated/torch.nn.CosineEmbeddingLoss.html#torch.nn.CosineEmbeddingLoss) | [paddle.nn.CosineEmbeddingLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/CosineEmbeddingLoss_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.CosineEmbeddingLoss.md) | -| 320 | [torch.nn.MaxPool3d](https://pytorch.org/docs/stable/generated/torch.nn.MaxPool3d.html?highlight=maxpool3d#torch.nn.MaxPool3d) | [paddle.nn.MaxPool3D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/MaxPool3D_cn.html#maxpool3d) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.MaxPool3d.md) | -| 321 | [torch.nn.SELU](https://pytorch.org/docs/stable/generated/torch.nn.SELU.html#torch.nn.SELU) | [paddle.nn.SELU](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/SELU_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.SELU.md) | -| 322 | [torch.nn.parallel.DistributedDataParallel](https://pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html#torch.nn.parallel.DistributedDataParallel) | [paddle.DataParallel](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/DataParallel_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.parallel.DistributedDataParallel.md) | -| 323 | [torch.nn.TransformerEncoderLayer](https://pytorch.org/docs/stable/generated/torch.nn.TransformerEncoderLayer.html#torch.nn.TransformerEncoderLayer) | [paddle.nn.TransformerEncoderLayer](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/TransformerEncoderLayer_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.TransformerEncoderLayer.md) | -| 324 | [torch.nn.SoftMarginLoss](https://pytorch.org/docs/stable/generated/torch.nn.SoftMarginLoss.html#torch.nn.SoftMarginLoss) | [paddle.nn.SoftMarginLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/SoftMarginLoss_cn.html#softmarginloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.SoftMarginLoss.md) | -| 325 | [torch.nn.DataParallel](https://pytorch.org/docs/stable/generated/torch.nn.DataParallel.html?highlight=dataparallel#torch.nn.DataParallel) | [paddle.DataParallel](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/DataParallel_cn.html#dataparallel) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.DataParallel.md) | -| 326 | [torch.nn.Module.register_forward_hook](https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.register_forward_hook) | [paddle.nn.Layer.register_forward_post_hook](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Layer_cn.html#register-forward-post-hook-hook) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Module.register_forward_hook.md) | -| 327 | [torch.nn.TransformerDecoderLayer](https://pytorch.org/docs/stable/generated/torch.nn.TransformerDecoderLayer.html?highlight=transformerdecoderlayer#torch.nn.TransformerDecoderLayer) | [paddle.nn.TransformerDecoderLayer](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/TransformerDecoderLayer_cn.html#transformerdecoderlayer) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.TransformerDecoderLayer.md) | -| 328 | [torch.nn.CELU](https://pytorch.org/docs/stable/generated/torch.nn.CELU.html#torch.nn.CELU) | [paddle.nn.CELU](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/CELU_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.CELU.md) | -| 329 | [torch.nn.MultiMarginLoss](https://pytorch.org/docs/stable/generated/torch.nn.MultiMarginLoss) | [paddle.nn.MultiMarginLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/MultiMarginLoss_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.MultiMarginLoss.md) | -| 330 | [torch.nn.Dropout2d](https://pytorch.org/docs/stable/generated/torch.nn.Dropout2d.html?highlight=dropout2d#torch.nn.Dropout2d) | [paddle.nn.Dropout2D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Dropout2D_cn.html#dropout2d) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Dropout2d.md) | -| 331 | [torch.nn.SyncBatchNorm.convert_sync_batchnorm](https://pytorch.org/docs/stable/generated/torch.nn.SyncBatchNorm.html?highlight=convert_sync_batchnorm#torch.nn.SyncBatchNorm.convert_sync_batchnorm) | [paddle.nn.SyncBatchNorm.convert_sync_batchnorm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/SyncBatchNorm_cn.html#convert-sync-batchnorm-layer) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.SyncBatchNorm.convert_sync_batchnorm.md) | -| 332 | [torch.nn.AlphaDropout](https://pytorch.org/docs/stable/generated/torch.nn.AlphaDropout.html#torch.nn.AlphaDropout) | [paddle.nn.AlphaDropout](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/AlphaDropout_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.AlphaDropout.md) | -| 333 | [torch.nn.CTCLoss](https://pytorch.org/docs/stable/generated/torch.nn.CTCLoss.html#torch.nn.CTCLoss) | [paddle.nn.CTCLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/CTCLoss_cn.html#ctcloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.CTCLoss.md) | -| 334 | [torch.nn.RReLU](https://pytorch.org/docs/stable/generated/torch.nn.RReLU.html#torch.nn.RReLU) | [paddle.nn.RReLU](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/RReLU_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.RReLU.md) | -| 335 | [torch.nn.L1Loss](https://pytorch.org/docs/stable/generated/torch.nn.L1Loss.html?highlight=l1loss#torch.nn.L1Loss) | [paddle.nn.L1Loss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/L1Loss_cn.html#l1loss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.L1Loss.md) | -| 336 | [torch.nn.ReLU](https://pytorch.org/docs/stable/generated/torch.nn.ReLU.html?highlight=relu#torch.nn.ReLU) | [paddle.nn.ReLU](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/ReLU_cn.html#relu) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.ReLU.md) | -| 337 | [torch.nn.PReLU](https://pytorch.org/docs/stable/generated/torch.nn.PReLU.html?highlight=prelu#torch.nn.PReLU) | [paddle.nn.PReLU](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/PReLU_cn.html#prelu) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.PReLU.md) | -| 338 | [torch.nn.RNNBase](https://pytorch.org/docs/stable/generated/torch.nn.RNNBase.html#torch.nn.RNNBase) | [paddle.nn.layer.rnn.RNNBase](https://github.com/PaddlePaddle/Paddle/blob/e25e86f4f6d1bbd043b621a75e93d0070719c3d8/python/paddle/nn/layer/rnn.py#L1300) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.RNNBase.md) | -| 339 | [torch.nn.MarginRankingLoss](https://pytorch.org/docs/stable/generated/torch.nn.MarginRankingLoss.html#marginrankingloss) | [paddle.nn.MarginRankingLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/MarginRankingLoss_cn.html#marginrankingloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.MarginRankingLoss.md) | -| 340 | [torch.nn.Threshold](https://pytorch.org/docs/stable/generated/torch.nn.Threshold.html#torch.nn.Threshold) | [paddle.nn.ThresholdedReLU](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/ThresholdedReLU_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Threshold.md) | -| 341 | [torch.nn.KLDivLoss](https://pytorch.org/docs/stable/generated/torch.nn.KLDivLoss.html?highlight=kldivloss#torch.nn.KLDivLoss) | [paddle.nn.KLDivLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/KLDivLoss_cn.html#kldivloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.KLDivLoss.md) | -| 342 | [torch.nn.MSELoss](https://pytorch.org/docs/stable/generated/torch.nn.MSELoss.html?highlight=mseloss#torch.nn.MSELoss) | [paddle.nn.MSELoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/MSELoss_cn.html#mseloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.MSELoss.md) | -| 343 | [torch.nn.BCELoss](https://pytorch.org/docs/stable/generated/torch.nn.BCELoss.html?highlight=bceloss#torch.nn.BCELoss) | [paddle.nn.BCELoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/BCELoss_cn.html#bceloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.BCELoss.md) | -| 344 | [torch.nn.TripletMarginLoss](https://pytorch.org/docs/stable/generated/torch.nn.TripletMarginLoss.html#torch.nn.TripletMarginLoss) | [paddle.nn.TripletMarginLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/TripletMarginLoss_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.TripletMarginLoss.md) | -| 345 | [torch.nn.FeatureAlphaDropout](https://pytorch.org/docs/stable/generated/torch.nn.FeatureAlphaDropout.html#torch.nn.FeatureAlphaDropout) | [paddle.nn.FeatureAlphaDropout](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/FeatureAlphaDropout_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.FeatureAlphaDropout.md) | -| 346 | [torch.nn.ReLU6](https://pytorch.org/docs/stable/generated/torch.nn.ReLU6.html#torch.nn.ReLU6) | [paddle.nn.ReLU6](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/ReLU6_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.ReLU6.md) | -| 347 | [torch.nn.HingeEmbeddingLoss](https://pytorch.org/docs/stable/generated/torch.nn.HingeEmbeddingLoss.html#hingeembeddingloss) | [paddle.nn.HingeEmbeddingLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/HingeEmbeddingLoss_cn.html#hingeembeddingloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.HingeEmbeddingLoss.md) | -| 348 | [torch.nn.Hardsigmoid](https://pytorch.org/docs/stable/generated/torch.nn.Hardsigmoid.html?highlight=hardsigmoid#torch.nn.Hardsigmoid) | [paddle.nn.Hardsigmoid](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Hardsigmoid_cn.html#hardsigmoid) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Hardsigmoid.md) | -| 349 | [torch.nn.CrossEntropyLoss](https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html#torch.nn.CrossEntropyLoss) | [paddle.nn.CrossEntropyLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/CrossEntropyLoss_cn.html#crossentropyloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.CrossEntropyLoss.md) | -| 350 | [torch.nn.Dropout1d](https://pytorch.org/docs/stable/generated/torch.nn.Dropout1d.html#torch.nn.Dropout1d) | [paddle.nn.Dropout](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Dropout_cn.html#dropout) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Dropout1d.md) | -| 351 | [torch.nn.MaxPool2d](https://pytorch.org/docs/stable/generated/torch.nn.MaxPool2d.html?highlight=maxpool2d#torch.nn.MaxPool2d) | [paddle.nn.MaxPool2D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/MaxPool2D_cn.html#maxpool2d) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.MaxPool2d.md) | -| 352 | [torch.nn.MultiheadAttention](https://pytorch.org/docs/stable/generated/torch.nn.MultiheadAttention.html#torch.nn.MultiheadAttention) | [paddle.nn.MultiHeadAttention](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/MultiHeadAttention_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.MultiheadAttention.md) | -| 353 | [torch.utils.data.SubsetRandomSampler](https://pytorch.org/docs/stable/data.html#torch.utils.data.SubsetRandomSampler) | [paddle.io.SubsetRandomSampler](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/io/SubsetRandomSampler_cn.html#paddle.io.SubsetRandomSampler) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/utils/torch.utils.data.SubsetRandomSampler.md) | -| 354 | [torch.utils.cpp_extension.CUDAExtension](https://pytorch.org/docs/stable/cpp_extension.html?highlight=torch+utils+cpp_extension+cudaextension#torch.utils.cpp_extension.CUDAExtension) | [paddle.utils.cpp_extension.CUDAExtension](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/utils/cpp_extension/CUDAExtension_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/utils/torch.utils.cpp_extension.CUDAExtension.md) | -| 355 | [torch.utils.checkpoint.checkpoint](https://pytorch.org/docs/stable/checkpoint.html#torch.utils.checkpoint.checkpoint) | [paddle.distributed.fleet.utils.recompute](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/utils/cpp_extension/CppExtension_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/utils/torch.utils.checkpoint.checkpoint.md) | -| 356 | [torch.utils.cpp_extension.CppExtension](https://pytorch.org/docs/stable/cpp_extension.html?highlight=torch+utils+cpp_extension+cppextension#torch.utils.cpp_extension.CppExtension) | [paddle.utils.cpp_extension.CppExtension](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/utils/cpp_extension/CppExtension_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/utils/torch.utils.cpp_extension.CppExtension.md) | -| 357 | [torch.utils.data.DataLoader](https://pytorch.org/docs/stable/data.html?highlight=dataloader#torch.utils.data.DataLoader) | [paddle.io.DataLoader](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/io/DataLoader_cn.html#dataloader) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/utils/torch.utils.data.DataLoader.md) | -| 358 | [torch.utils.data.distributed.DistributedSampler](https://docs.pytorch.org/docs/stable/data.html#torch.utils.data.distributed.DistributedSampler) | [paddle.io.DistributedBatchSampler](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/io/DistributedBatchSampler_cn.html#distributedbatchsampler) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/utils/torch.utils.data.distributed.DistributedSampler.md) | -| 359 | [torch.utils.cpp_extension.load](https://pytorch.org/docs/stable/cpp_extension.html?highlight=torch+utils+cpp_extension+load#torch.utils.cpp_extension.load) | [paddle.utils.cpp_extension.load](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/utils/cpp_extension/load_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/utils/torch.utils.cpp_extension.load.md) | -| 360 | [torch.signal.windows.general_cosine](https://pytorch.org/docs/stable/generated/torch.signal.windows.general_cosine.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/audio/functional/torch.signal.windows.general_cosine.md) | -| 361 | [torch.signal.windows.general_hamming](https://pytorch.org/docs/stable/generated/torch.signal.windows.general_hamming.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/audio/functional/torch.signal.windows.general_hamming.md) | -| 362 | [torch.signal.windows.hann](https://pytorch.org/docs/stable/generated/torch.signal.windows.hann.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/audio/functional/torch.signal.windows.hann.md) | -| 363 | [torch.signal.windows.exponential](https://pytorch.org/docs/stable/generated/torch.signal.windows.exponential.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/audio/functional/torch.signal.windows.exponential.md) | -| 364 | [torch.signal.windows.hamming](https://pytorch.org/docs/stable/generated/torch.signal.windows.hamming.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/audio/functional/torch.signal.windows.hamming.md) | -| 365 | [torch.signal.windows.gaussian](https://pytorch.org/docs/stable/generated/torch.signal.windows.gaussian.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/audio/functional/torch.signal.windows.gaussian.md) | -| 366 | [torch.signal.windows.blackman](https://pytorch.org/docs/stable/generated/torch.signal.windows.blackman.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/audio/functional/torch.signal.windows.blackman.md) | -| 367 | [torch.signal.windows.cosine](https://pytorch.org/docs/stable/generated/torch.signal.windows.cosine.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/audio/functional/torch.signal.windows.cosine.md) | -| 368 | [torch.distributions.transforms.SigmoidTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.SigmoidTransform) | [paddle.distribution.SigmoidTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/SigmoidTransform_cn.html#sigmoidtransform) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.SigmoidTransform.md) | -| 369 | [torch.distributions.transformed_distribution.TransformedDistribution](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transformed_distribution.TransformedDistribution) | [paddle.distribution.TransformedDistribution](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/TransformedDistribution_cn.html#transformeddistribution) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transformed_distribution.TransformedDistribution.md) | -| 370 | [torch.distributions.gamma.Gamma](https://pytorch.org/docs/stable/distributions.html#gamma) | [paddle.distribution.Gamma](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Gamma_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.gamma.Gamma.md) | -| 371 | [torch.distributions.transforms.StackTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.StackTransform) | [paddle.distribution.StackTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/StackTransform_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.StackTransform.md) | -| 372 | [torch.distributions.transforms.PowerTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.SigmoidTransform) | [paddle.distribution.PowerTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/PowerTransform_cn.html#powertransform) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.PowerTransform.md) | -| 373 | [torch.distributions.beta.Beta](https://pytorch.org/docs/stable/distributions.html#torch.distributions.beta.Beta) | [paddle.distribution.Beta](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Beta_cn.html#beta) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.beta.Beta.md) | -| 374 | [torch.distributions.transforms.Transform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.Transform) | [paddle.distribution.Transform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Transform_cn.html#transform) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.Transform.md) | -| 375 | [torch.distributions.transforms.SoftmaxTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.SoftmaxTransform) | [paddle.distribution.SoftmaxTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/SoftmaxTransform_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.SoftmaxTransform.md) | -| 376 | [torch.distributions.log_normal.LogNormal](https://pytorch.org/docs/stable/distributions.html#torch.distributions.log_normal.LogNormal) | [paddle.distribution.LogNormal](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/LogNormal_cn.html#lognormal) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.log_normal.LogNormal.md) | -| 377 | [torch.distributions.bernoulli.Bernoulli](https://pytorch.org/docs/stable/distributions.html#torch.distributions.bernoulli.Bernoulli) | [paddle.distribution.Bernoulli](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Bernoulli_cn.html#bernoulli) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.bernoulli.Bernoulli.md) | -| 378 | [torch.distributions.binomial.Binomial](https://pytorch.org/docs/stable/distributions.html#torch.distributions.binomial.Binomial) | [paddle.distribution.Binomial](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/distribution/Binomial_cn.html#binomial) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.binomial.Binomial.md) | -| 379 | [torch.distributions.laplace.Laplace](https://pytorch.org/docs/stable/distributions.html#torch.distributions.laplace.Laplace) | [paddle.distribution.Laplace](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Laplace_cn.html#laplace) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.laplace.Laplace.md) | -| 380 | [torch.distributions.lkj_cholesky.LKJCholesky](https://pytorch.org/docs/stable/distributions.html#torch.distributions.lkj_cholesky.LKJCholesky) | [paddle.distribution.LKJCholesky](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/distribution/LKJCholesky_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.lkj_cholesky.LKJCholesky.md) | -| 381 | [torch.distributions.cauchy.Cauchy](https://pytorch.org/docs/stable/distributions.html#torch.distributions.cauchy.Cauchy) | [paddle.distribution.Cauchy](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Cauchy_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.cauchy.Cauchy.md) | -| 382 | [torch.distributions.studentT.StudentT](https://pytorch.org/docs/stable/distributions.html#studentt) | [paddle.distribution.StudentT](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/distribution/StudentT_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.studentT.StudentT.md) | -| 383 | [torch.distributions.continuous_bernoulli.ContinuousBernoulli](https://pytorch.org/docs/stable/distributions.html) | [paddle.distribution.ContinuousBernoulli](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/distribution/ContinuousBernoulli_cn.html#continuousbernoulli) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.continuous_bernoulli.ContinuousBernoulli.md) | -| 384 | [torch.distributions.multinomial.Multinomial](https://pytorch.org/docs/stable/distributions.html#torch.distributions.multinomial.Multinomial) | [paddle.distribution.Multinomial](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Multinomial_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.multinomial.Multinomial.md) | -| 385 | [torch.distributions.dirichlet.Dirichlet](https://pytorch.org/docs/stable/distributions.html#torch.distributions.dirichlet.Dirichlet) | [paddle.distribution.Dirichlet](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Dirichlet_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.dirichlet.Dirichlet.md) | -| 386 | [torch.distributions.exp_family.ExponentialFamily](https://pytorch.org/docs/stable/distributions.html#torch.distributions.exp_family.ExponentialFamily) | [paddle.distribution.ExponentialFamily](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/ExponentialFamily_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.exp_family.ExponentialFamily.md) | -| 387 | [torch.distributions.categorical.Categorical](https://pytorch.org/docs/stable/distributions.html#torch.distributions.categorical.Categorical) | [paddle.distribution.Categorical](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Categorical_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.categorical.Categorical.md) | -| 388 | [torch.distributions.transforms.ReshapeTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.ReshapeTransform) | [paddle.distribution.ReshapeTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/ReshapeTransform_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.ReshapeTransform.md) | -| 389 | [torch.distributions.gumbel.Gumbel](https://pytorch.org/docs/stable/distributions.html#torch.distributions.gumbel.Gumbel) | [paddle.distribution.Gumbel](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Gumbel_cn.html#gumbel) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.gumbel.Gumbel.md) | -| 390 | [torch.distributions.transforms.AbsTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.AbsTransform) | [paddle.distribution.AbsTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/AbsTransform_cn.html#paddle.distribution.AbsTransform) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.AbsTransform.md) | -| 391 | [torch.distributions.normal.Normal](https://pytorch.org/docs/stable/distributions.html#torch.distributions.normal.Normal) | [paddle.distribution.Normal](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Normal_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.normal.Normal.md) | -| 392 | [torch.distributions.transforms.ExpTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.ExpTransform) | [paddle.distribution.ExpTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/ExpTransform_cn.html#exptransform) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.ExpTransform.md) | -| 393 | [torch.distributions.chi2.Chi2](https://pytorch.org/docs/stable/distributions.html#chi2) | [paddle.distribution.Chi2](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Chi2_cn.html#prob-value) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.chi2.Chi2.md) | -| 394 | [torch.distributions.uniform.Uniform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.uniform.Uniform) | [paddle.distribution.Uniform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Uniform_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.uniform.Uniform.md) | -| 395 | [torch.distributions.transforms.StickBreakingTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.StickBreakingTransform) | [paddle.distribution.StickBreakingTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/StickBreakingTransform_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.StickBreakingTransform.md) | -| 396 | [torch.distributions.exponential.Exponential](https://pytorch.org/docs/stable/distributions.html#torch.distributions.exponential.Exponential.arg_constraints) | [paddle.distribution.Exponential](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/distribution/ExponentialFamily_cn.html#exponential) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.exponential.Exponential.md) | -| 397 | [torch.distributions.multivariate_normal.MultivariateNormal](https://pytorch.org/docs/stable/distributions.html#multivariatenormal) | [paddle.distribution.MultivariateNormal](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/distribution/MultivariateNormal_cn.html#multivariatenormal) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.multivariate_normal.MultivariateNormal.md) | -| 398 | [torch.distributions.geometric.Geometric](https://pytorch.org/docs/stable/distributions.html#torch.distributions.geometric.Geometric) | [paddle.distribution.Geometric](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Geometric_cn.html#geometric) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.geometric.Geometric.md) | -| 399 | [torch.distributions.transforms.ComposeTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.ComposeTransform) | [paddle.distribution.ChainTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/ChainTransform_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.ComposeTransform.md) | -| 400 | [torch.distributions.transforms.AffineTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.AffineTransform) | [paddle.distribution.AffineTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/AffineTransform_cn.html#affinetransform) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.AffineTransform.md) | -| 401 | [torch.distributions.independent.Independent](https://pytorch.org/docs/stable/distributions.html#torch.distributions.independent.Independent) | [paddle.distribution.Independent](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Independent_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.independent.Independent.md) | -| 402 | [torch.distributions.poisson.Poisson](https://pytorch.org/docs/stable/distributions.html#poisson) | [paddle.distribution.Poisson](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/distribution/Poisson_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.poisson.Poisson.md) | -| 403 | [torch.distributions.transforms.IndependentTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.IndependentTransform) | [paddle.distribution.IndependentTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/IndependentTransform_cn.html#independenttransform) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.IndependentTransform.md) | -| 404 | [torch.distributions.distribution.Distribution](https://pytorch.org/docs/stable/distributions.html#torch.distributions.distribution.Distribution) | [paddle.distribution.Distribution](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Distribution_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.distribution.Distribution.md) | -| 405 | [torch.distributions.transforms.TanhTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.TanhTransform) | [paddle.distribution.TanhTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/TanhTransform_cn.html#tanhtransform) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.TanhTransform.md) | -| 406 | [flash_attn.flash_attn_interface.flash_attn_func](https://github.com/Dao-AILab/flash-attention/blob/72e27c6320555a37a83338178caa25a388e46121/flash_attn/flash_attn_interface.py#L808) | [paddle.nn.functional.flash_attention.flash_attention](https://github.com/PaddlePaddle/Paddle/blob/900d27c40ef4567d7ea6342f3f0eedd394885ecb/python/paddle/nn/functional/flash_attention.py#L248) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/flash_attn/flash_attn.flash_attn_interface.flash_attn_func.md) | -| 407 | [flash_attn.flash_attn_interface.flash_attn_unpadded_func](https://github.com/Dao-AILab/flash-attention/blob/d0787acc16c3667156b51ce5b01bdafc7594ed39/flash_attn/flash_attn_interface.py#L1050) | [paddle.nn.functional.flash_attention.flash_attn_unpadded](https://github.com/PaddlePaddle/Paddle/blob/b32b51b7c21ad62bf794512c849a603c8c0ece44/python/paddle/nn/functional/flash_attention.py#L664) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/flash_attn/flash_attn.flash_attn_interface.flash_attn_unpadded_func.md) | -| 408 | [torchvision.ops.RoIAlign](https://pytorch.org/vision/main/generated/torchvision.ops.RoIAlign.html) | [paddle.vision.ops.RoIAlign](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/ops/RoIAlign_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.ops.RoIAlign.md) | -| 409 | [torchvision.transforms.functional.normalize](https://pytorch.org/vision/stable/generated/torchvision.transforms.functional.normalize.html) | [paddle.vision.transforms.normalize](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/transforms/normalize_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.transforms.functional.normalize.md) | -| 410 | [torchvision.transforms.Normalize](https://pytorch.org/vision/main/generated/torchvision.transforms.Normalize.html) | [paddle.vision.transforms.Normalize](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/vision/transforms/Normalize__upper_cn.html#normalize) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.transforms.Normalize.md) | -| 411 | [torchvision.datasets.ImageFolder](https://pytorch.org/vision/main/generated/torchvision.datasets.ImageFolder.html) | [paddle.vision.datasets.ImageFolder](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/datasets/ImageFolder_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.datasets.ImageFolder.md) | -| 412 | [fairscale.nn.model_parallel.layers.RowParallelLinear](https://github.com/facebookresearch/fairscale/blob/164cc0f3170b4a3951dd84dda29c3e1504ac4d6e/fairscale/nn/model_parallel/layers.py#L299) | [paddle.distributed.fleet.meta_parallel.RowParallelLinear](https://github.com/PaddlePaddle/Paddle/blob/016766cc89fabc10181453ce70b701dd8ed019f6/python/paddle/distributed/fleet/layers/mpu/mp_layers.py#L291) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/fairscale/fairscale.nn.model_parallel.layers.RowParallelLinear.md) | -| 413 | [fairscale.nn.model_parallel.layers.ColumnParallelLinear](https://github.com/facebookresearch/fairscale/blob/164cc0f3170b4a3951dd84dda29c3e1504ac4d6e/fairscale/nn/model_parallel/layers.py#L218) | [paddle.distributed.fleet.meta_parallel.ColumnParallelLinear](https://github.com/PaddlePaddle/Paddle/blob/016766cc89fabc10181453ce70b701dd8ed019f6/python/paddle/distributed/fleet/layers/mpu/mp_layers.py#L153) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/fairscale/fairscale.nn.model_parallel.layers.ColumnParallelLinear.md) | -| 414 | [fairscale.nn.model_parallel.layers.ParallelEmbedding](https://github.com/facebookresearch/fairscale/blob/164cc0f3170b4a3951dd84dda29c3e1504ac4d6e/fairscale/nn/model_parallel/layers.py#L152) | [paddle.distributed.fleet.meta_parallel.VocabParallelEmbedding](https://github.com/PaddlePaddle/Paddle/blob/016766cc89fabc10181453ce70b701dd8ed019f6/python/paddle/distributed/fleet/layers/mpu/mp_layers.py#L37) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/fairscale/fairscale.nn.model_parallel.layers.ParallelEmbedding.md) | -| 415 | [transformers.GenerationConfig](https://hf-mirror.com/docs/transformers/v4.42.0/en/main_classes/text_generation#transformers.GenerationConfig) | [paddlenlp.generation.GenerationConfig](https://github.com/PaddlePaddle/PaddleNLP/blob/e336e78c338d2514ee6c937982ce5d8c960b85ff/paddlenlp/generation/configuration_utils.py#L62) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.GenerationConfig.md) | -| 416 | [transformers.AddedToken](https://github.com/huggingface/transformers/blob/d625294d79341662784495551abdf45e6cb9372f/src/transformers/tokenization_utils_base.py#L84) | [paddlenlp.transformers.AddedToken](https://github.com/PaddlePaddle/PaddleNLP/blob/e336e78c338d2514ee6c937982ce5d8c960b85ff/paddlenlp/transformers/tokenizer_utils_base.py#L48) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.AddedToken.md) | -| 417 | [transformers.PretrainedConfig](https://hf-mirror.com/docs/transformers/v4.42.0/en/main_classes/configuration#transformers.PretrainedConfig) | [paddlenlp.transformers.PretrainedConfig](https://github.com/PaddlePaddle/PaddleNLP/blob/57000fa12ce67024238f0b56a6fde63c592c54ce/paddlenlp/transformers/configuration_utils.py#L317) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.PretrainedConfig.md) | - +| 65 | [torch.Tensor.symeig](https://pytorch.org/docs/stable/generated/torch.Tensor.symeig.html#torch.Tensor.symeig) | [paddle.linalg.eigh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/eigh_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.symeig.md) | +| 66 | [torch.Tensor.to](https://pytorch.org/docs/stable/generated/torch.Tensor.to.html#torch.Tensor.to) | [paddle.Tensor.to](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#to-args-kwargs) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.to.md) | +| 67 | [torch.Tensor.exponential_](https://pytorch.org/docs/stable/generated/torch.Tensor.exponential_.html#torch.Tensor.exponential_) | [paddle.Tensor.exponential_](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#exponential-lam-1-0-name-none) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.exponential_.md) | +| 68 | [torch.Tensor.bernoulli_](https://pytorch.org/docs/stable/generated/torch.Tensor.bernoulli_.html#torch.Tensor.bernoulli_) | [paddle.Tensor.bernoulli_](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/tensor/tensor.py) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.bernoulli_.md) | +| 69 | [torch.Tensor.to_sparse_csr](https://pytorch.org/docs/stable/generated/torch.Tensor.to_sparse_csr.html#torch-tensor-to-sparse-csr) | [paddle.Tensor.to_sparse_csr](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#tensor) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.to_sparse_csr.md) | +| 70 | [torch.Tensor.multinomial](https://pytorch.org/docs/stable/generated/torch.Tensor.multinomial.html#torch.Tensor.multinomial) | paddle.Tensor.multinomial | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.multinomial.md) | +| 71 | [torch.Tensor.cauchy_](https://pytorch.org/docs/stable/generated/torch.Tensor.cauchy_.html) | [paddle.Tensor.cauchy_](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.cauchy_.md) | +| 72 | [torch.Tensor.stft](https://pytorch.org/docs/stable/generated/torch.Tensor.stft.html#torch.Tensor.stft) | [paddle.Tensor.stft](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/signal/stft_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.stft.md) | +| 73 | [torch.linalg.inv](https://pytorch.org/docs/stable/generated/torch.linalg.inv.html#torch.linalg.inv) | [paddle.linalg.inv](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/inv_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.inv.md) | +| 74 | [torch.linalg.vecdot](https://pytorch.org/docs/stable/generated/torch.linalg.vecdot.html) | [paddle.linalg.vecdot](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/tensor/linalg.py#L1881) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.vecdot.md) | +| 75 | [torch.linalg.svdvals](https://pytorch.org/docs/stable/generated/torch.linalg.svdvals.html#torch.linalg.svdvals) | [paddle.linalg.svdvals](https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/tensor/linalg.py#L3019) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.svdvals.md) | +| 76 | [torch.linalg.cholesky](https://pytorch.org/docs/stable/generated/torch.linalg.cholesky.html?highlight=linalg+cholesky#torch.linalg.cholesky) | [paddle.linalg.cholesky](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/cholesky_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.cholesky.md) | +| 77 | [torch.linalg.solve](https://pytorch.org/docs/stable/generated/torch.linalg.solve.html#torch.linalg.solve) | [paddle.linalg.solve](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/solve_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.solve.md) | +| 78 | [torch.linalg.solve_triangular](https://pytorch.org/docs/stable/generated/torch.linalg.solve_triangular.html?highlight=torch+linalg+solve_triangular#torch.linalg.solve_triangular) | [paddle.linalg.triangular_solve](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/triangular_solve_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.solve_triangular.md) | +| 79 | [torch.linalg.householder_product](https://pytorch.org/docs/stable/generated/torch.linalg.householder_product.html#torch.linalg.householder_product) | [paddle.linalg.householder_product](https://github.com/PaddlePaddle/Paddle/blob/d6ea911bd1bfda5604807eeb18318e71b395ac58/python/paddle/tensor/linalg.py#L3744) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.householder_product.md) | +| 80 | [torch.linalg.det](https://pytorch.org/docs/stable/generated/torch.linalg.det.html#torch.linalg.det) | [paddle.linalg.det](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/det_cn.html#det) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.det.md) | +| 81 | [torch.linalg.matrix_norm](https://pytorch.org/docs/stable/generated/torch.linalg.matrix_norm.html#torch.linalg.matrix_norm) | [paddle.linalg.matrix_norm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/matrix_norm_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.matrix_norm.md) | +| 82 | [torch.linalg.cross](https://pytorch.org/docs/stable/generated/torch.linalg.cross.html?highlight=torch+linalg+cross#torch.linalg.cross) | [paddle.cross](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/cross_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.cross.md) | +| 83 | [torch.linalg.svd](https://pytorch.org/docs/stable/generated/torch.linalg.svd.html?highlight=svd#torch.linalg.svd) | [paddle.linalg.svd](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/svd_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.svd.md) | +| 84 | [torch.linalg.eigvalsh](https://pytorch.org/docs/stable/generated/torch.linalg.eigvalsh.html#torch.linalg.eigvalsh) | [paddle.linalg.eigvalsh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/eigvalsh_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.eigvalsh.md) | +| 85 | [torch.linalg.qr](https://pytorch.org/docs/stable/generated/torch.linalg.qr.html#torch.linalg.qr) | [paddle.linalg.qr](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/qr_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.qr.md) | +| 86 | [torch.linalg.eigvals](https://pytorch.org/docs/stable/generated/torch.linalg.eigvals.html?highlight=torch+linalg+eigvals#torch.linalg.eigvals) | [paddle.linalg.eigvals](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/eigvals_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.eigvals.md) | +| 87 | [torch.linalg.pinv](https://pytorch.org/docs/stable/generated/torch.linalg.pinv.html#torch.linalg.pinv) | [paddle.linalg.pinv](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/pinv_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.pinv.md) | +| 88 | [torch.linalg.matrix_power](https://pytorch.org/docs/stable/generated/torch.linalg.matrix_power.html?highlight=torch+linalg+matrix_power#torch.linalg.matrix_power) | [paddle.linalg.matrix_power](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/matrix_power_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.matrix_power.md) | +| 89 | [torch.linalg.cond](https://pytorch.org/docs/stable/generated/torch.linalg.cond.html#torch.linalg.cond) | [paddle.linalg.cond](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/cond_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.cond.md) | +| 90 | [torch.linalg.matrix_rank](https://pytorch.org/docs/stable/generated/torch.linalg.matrix_rank.html?highlight=matrix_rank#torch.linalg.matrix_rank) | [paddle.linalg.matrix_rank](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/matrix_rank_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.matrix_rank.md) | +| 91 | [torch.linalg.lu_factor](https://pytorch.org/docs/stable/generated/torch.linalg.lu_factor.html#torch.linalg.lu_factor) | [paddle.linalg.lu](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/lu_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.lu_factor.md) | +| 92 | [torch.linalg.lu_factor_ex](https://pytorch.org/docs/stable/generated/torch.linalg.lu_factor_ex.html?highlight=lu_factor_ex#torch.linalg.lu_factor_ex) | [paddle.linalg.lu](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/lu_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.lu_factor_ex.md) | +| 93 | [torch.linalg.multi_dot](https://pytorch.org/docs/stable/generated/torch.linalg.multi_dot.html?highlight=torch+linalg+multi_dot#torch.linalg.multi_dot) | [paddle.linalg.multi_dot](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/multi_dot_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.multi_dot.md) | +| 94 | [torch.linalg.eig](https://pytorch.org/docs/stable/generated/torch.linalg.eig.html?highlight=torch+linalg+eig#torch.linalg.eig) | [paddle.linalg.eig](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/eig_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.eig.md) | +| 95 | [torch.linalg.eigh](https://pytorch.org/docs/stable/generated/torch.linalg.eigh.html#torch.linalg.eigh) | [paddle.linalg.eigh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/eigh_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/linalg/torch.linalg.eigh.md) | +| 96 | [torch.special.i1](https://pytorch.org/docs/stable/special.html#torch.special.i1) | [paddle.i1](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/i1_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.i1.md) | +| 97 | [torch.special.i0e](https://pytorch.org/docs/stable/special.html#torch.special.i0e) | [paddle.i0e](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/i0e_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.i0e.md) | +| 98 | [torch.jit.save](https://pytorch.org/docs/stable/generated/torch.jit.save.html#torch-jit-save) | [paddle.jit.save](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/jit/save_cn.html#cn-api-paddle-jit-save) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.jit.save.md) | +| 99 | [torch.special.round](https://pytorch.org/docs/stable/special.html#torch.special.round) | [paddle.round](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/round_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.round.md) | +| 100 | [torch.special.log1p](https://pytorch.org/docs/stable/special.html#torch.special.log1p) | [paddle.log1p](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/log1p_cn.html#log1p) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.log1p.md) | +| 101 | [torch.autograd.functional.jacobian](https://pytorch.org/docs/stable/generated/torch.autograd.functional.jacobian.html#torch.autograd.functional.jacobian) | [paddle.incubate.autograd.Jacobian](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/incubate/autograd/Jacobian_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.autograd.functional.jacobian.md) | +| 102 | [torch.autograd.grad](https://pytorch.org/docs/stable/generated/torch.autograd.grad.html#torch.autograd.grad) | [paddle.grad](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/grad_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.autograd.grad.md) | +| 103 | [torch.jit.load](https://pytorch.org/docs/stable/generated/torch.jit.load.html#torch.jit.load) | [paddle.jit.load](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/jit/load_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.jit.load.md) | +| 104 | [torch.special.erf](https://pytorch.org/docs/stable/special.html?highlight=torch+special+erf#torch.special.erf) | [paddle.erf](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/erf_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.erf.md) | +| 105 | [torch.special.sinc](https://pytorch.org/docs/stable/special.html#torch.special.sinc) | [paddle.sinc](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/sinc_cn.html#sinc) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.sinc.md) | +| 106 | [torch.special.erfinv](https://pytorch.org/docs/stable/special.html#torch.special.erfinv) | [paddle.erfinv](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/erfinv_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.erfinv.md) | +| 107 | [torch.special.polygamma](https://pytorch.org/docs/stable/special.html#torch.special.polygamma) | [paddle.polygamma](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/polygamma_cn.html#paddle.polygamma) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.polygamma.md) | +| 108 | [torch.autograd.backward](https://pytorch.org/docs/stable/generated/torch.autograd.backward.html#torch.autograd.backward) | [paddle.autograd.backward](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/autograd/backward_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.autograd.backward.md) | +| 109 | [torch.autograd.functional.hessian](https://pytorch.org/docs/stable/generated/torch.autograd.functional.hessian.html#torch.autograd.functional.hessian) | [paddle.incubate.autograd.Hessian](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/incubate/autograd/Hessian_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.autograd.functional.hessian.md) | +| 110 | [torch.special.psi](https://pytorch.org/docs/stable/special.html#torch.special.psi) | [paddle.digamma](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/special.digamma_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.psi.md) | +| 111 | [torch.profiler.profile](https://pytorch.org/docs/stable/profiler.html#torch.profiler.profile) | [paddle.profiler.Profiler](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/profiler/Profiler_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.profiler.profile.md) | +| 112 | [torch.special.multigammaln](https://pytorch.org/docs/stable/special.html#torch.special.multigammaln) | [paddle.multigammaln](https://github.com/PaddlePaddle/Paddle/blob/be090bd0bc9ac7a8595296c316b3a6ed3dc60ba6/python/paddle/tensor/math.py#L5099) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.multigammaln.md) | +| 113 | [torch.autograd.functional.vjp](https://pytorch.org/docs/stable/generated/torch.autograd.functional.vjp.html#torch.autograd.functional.vjp) | [paddle.incubate.autograd.vjp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/incubate/autograd/vjp_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.autograd.functional.vjp.md) | +| 114 | [torch.jit.ignore](https://pytorch.org/docs/stable/generated/torch.jit.ignore.html#torch-jit-ignore) | [paddle.jit.not_to_static](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/jit/not_to_static_cn.html#not-to-static) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.jit.ignore.md) | +| 115 | [torch.special.gammaincc](https://pytorch.org/docs/stable/special.html#torch.special.gammaincc) | [paddle.gammaincc](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/index_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.gammaincc.md) | +| 116 | [torch.jit.script](https://pytorch.org/docs/stable/generated/torch.jit.script.html#torch-jit-script) | [paddle.jit.to_static](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/jit/to_static_cn.html#paddle.jit.to_static) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.jit.script.md) | +| 117 | [torch.onnx.export](https://pytorch.org/docs/stable/onnx.html#torch.onnx.export) | [paddle.onnx.export](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/onnx/export_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.onnx.export.md) | +| 118 | [torch.special.logit](https://pytorch.org/docs/stable/special.html#torch.special.logit) | [paddle.logit](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/logit_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.logit.md) | +| 119 | [torch.special.i0](https://pytorch.org/docs/stable/special.html#torch.special.i0) | [paddle.i0](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/i0_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.i0.md) | +| 120 | [torch.multiprocessing.spawn](https://pytorch.org/docs/stable/multiprocessing.html#torch.multiprocessing.spawn) | [paddle.distributed.spawn](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/spawn_cn.html#spawn) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.multiprocessing.spawn.md) | +| 121 | [torch.special.i1e](https://pytorch.org/docs/stable/special.html#torch.special.i1e) | [paddle.i1e](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/i1e_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.i1e.md) | +| 122 | [torch.special.digamma](https://pytorch.org/docs/stable/special.html#torch.special.digamma) | [paddle.digamma](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/special.digamma_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.digamma.md) | +| 123 | [torch.autograd.functional.jvp](https://pytorch.org/docs/stable/generated/torch.autograd.functional.jvp.html#torch.autograd.functional.jvp) | [paddle.incubate.autograd.jvp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/incubate/autograd/jvp_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.autograd.functional.jvp.md) | +| 124 | [torch.special.expm1](https://pytorch.org/docs/stable/special.html#torch.special.expm1) | [paddle.expm1](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/expm1_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.expm1.md) | +| 125 | [torch.special.gammainc](https://pytorch.org/docs/stable/special.html#torch.special.gammainc) | [paddle.gammainc](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/index_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.gammainc.md) | +| 126 | [torch.special.gammaln](https://pytorch.org/docs/stable/special.html#torch.special.gammaln) | [paddle.gammaln](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/gammaln_cn.html#gammaln) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/others/torch.special.gammaln.md) | +| 127 | [torch.optim.SGD](https://pytorch.org/docs/stable/generated/torch.optim.SGD.html) | [paddle.optimizer.SGD](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/SGD_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.SGD.md) | +| 128 | [torch.optim.ASGD](https://pytorch.org/docs/stable/generated/torch.optim.ASGD.html) | [paddle.optimizer.ASGD](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/ASGD_cn.html#cn-api-paddle-optimizer-asgd) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.ASGD.md) | +| 129 | [torch.optim.RMSprop](https://pytorch.org/docs/stable/generated/torch.optim.RMSprop.html) | [paddle.optimizer.RMSProp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/RMSProp_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.RMSprop.md) | +| 130 | [torch.optim.Optimizer.step](https://pytorch.org/docs/stable/generated/torch.optim.Optimizer.step.html#torch-optim-optimizer-step) | [paddle.optimizer.Optimizer.step](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/Optimizer_cn.html#step) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.Optimizer.step.md) | +| 131 | [torch.optim.RAdam](https://pytorch.org/docs/stable/generated/torch.optim.RAdam.html#torch.optim.RAdam) | [paddle.optimizer.RAdam](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/RAdam_cn.html#radam) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.RAdam.md) | +| 132 | [torch.optim.NAdam](https://pytorch.org/docs/stable/generated/torch.optim.NAdam.html#torch.optim.NAdam) | [paddle.optimizer.NAdam](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/NAdam_cn.html#nadam) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.NAdam.md) | +| 133 | [torch.optim.Adamax](https://pytorch.org/docs/stable/generated/torch.optim.Adamax.html) | [paddle.optimizer.Adamax](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/Adamax_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.Adamax.md) | +| 134 | [torch.optim.Adam](https://pytorch.org/docs/stable/generated/torch.optim.Adam.html) | [paddle.optimizer.Adam](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/Adam_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.Adam.md) | +| 135 | [torch.optim.Adagrad](https://pytorch.org/docs/stable/generated/torch.optim.Adagrad.html) | [paddle.optimizer.Adagrad](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/Adagrad_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.Adagrad.md) | +| 136 | [torch.optim.Rprop](https://pytorch.org/docs/stable/generated/torch.optim.Rprop.html) | [paddle.optimizer.Rprop](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/Rprop_cn.html#cn-api-paddle-optimizer-rprop) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.Rprop.md) | +| 137 | [torch.optim.AdamW](https://pytorch.org/docs/stable/generated/torch.optim.AdamW.html) | [paddle.optimizer.AdamW](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/AdamW_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.AdamW.md) | +| 138 | [torch.optim.Adadelta](https://pytorch.org/docs/stable/generated/torch.optim.Adadelta.html) | [paddle.optimizer.Adadelta](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/Adadelta_cn.html#cn-api-paddle-optimizer-adadelta) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.Adadelta.md) | +| 139 | torch.clamp_min | [paddle.clip](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/clip_cn.html#clip) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.clamp_min.md) | +| 140 | [torch.randint_like](https://pytorch.org/docs/stable/generated/torch.randint_like.html?highlight=randint_like#torch.randint_like) | [paddle.randint_like](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/randint_like_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.randint_like.md) | +| 141 | [torch.lerp](https://pytorch.org/docs/stable/generated/torch.lerp.html?highlight=lerp#torch.lerp) | [paddle.lerp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/lerp_cn.html#lerp) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.lerp.md) | +| 142 | [torch.neg](https://pytorch.org/docs/stable/generated/torch.neg.html?highlight=neg#torch.neg) | [paddle.neg](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/neg_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.neg.md) | +| 143 | [torch.hamming_window](https://pytorch.org/docs/stable/generated/torch.hamming_window.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.hamming_window.md) | +| 144 | [torch.std](https://pytorch.org/docs/stable/generated/torch.std.html) | [paddle.std](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/std_cn.html#std) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.std.md) | +| 145 | [torch.blackman_window](https://pytorch.org/docs/stable/generated/torch.blackman_window.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.blackman_window.md) | +| 146 | [torch.logaddexp](https://pytorch.org/docs/stable/generated/torch.logaddexp.html#torch.logaddexp) | [paddle.logaddexp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/logaddexp_cn.html#logaddexp) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.logaddexp.md) | +| 147 | [torch.cummax](https://pytorch.org/docs/stable/generated/torch.cummax.html?highlight=cummax#torch.cummax) | [paddle.cummax](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/cummax_cn.html#cummax) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.cummax.md) | +| 148 | [torch.amp.autocast](https://pytorch.org/docs/stable/amp.html#torch.cuda.amp.autocast) | [paddle.amp.auto_cast](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/amp/auto_cast_cn.html#auto-cast) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.amp.autocast.md) | +| 149 | [torch.cosh](https://pytorch.org/docs/stable/generated/torch.cosh.html#torch.cosh) | [paddle.cosh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/cosh_cn.html#cosh) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.cosh.md) | +| 150 | [torch.angle](https://pytorch.org/docs/stable/generated/torch.angle.html) | [paddle.angle](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/angle_cn.html#angle) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.angle.md) | +| 151 | [torch.isneginf](https://pytorch.org/docs/stable/generated/torch.isneginf.html#torch-isneginf) | [paddle.isneginf](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/isneginf_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.isneginf.md) | +| 152 | [torch.remainder](https://pytorch.org/docs/stable/generated/torch.remainder.html?highlight=remainder#torch.remainder) | [paddle.remainder](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/remainder_cn.html#remainder) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.remainder.md) | +| 153 | [torch.cross](https://pytorch.org/docs/stable/generated/torch.cross.html?highlight=cross#torch.cross) | [paddle.cross](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/cross_cn.html#cross) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.cross.md) | +| 154 | [torch.cholesky_inverse](https://pytorch.org/docs/stable/generated/torch.cholesky_inverse.html?highlight=cholesky_inverse#torch.cholesky_inverse) | [paddle.linalg.cholesky_inverse](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/cholesky_inverse_cn.html#cholesky-inverse) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.cholesky_inverse.md) | +| 155 | [torch.max_pool2d](https://pytorch.org/docs/stable/jit_builtin_functions.html#supported-pytorch-functions) | [paddle.nn.functional.max_pool2d](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/functional/max_pool2d_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.max_pool2d.md) | +| 156 | [torch.copysign](https://pytorch.org/docs/stable/generated/torch.copysign.html#torch.copysign) | [paddle.copysign](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/copysign_cn.html#copysign) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.copysign.md) | +| 157 | [torch.square](https://pytorch.org/docs/stable/generated/torch.square.html?highlight=square#torch.square) | [paddle.square](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/square_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.square.md) | +| 158 | [torch.lu](https://pytorch.org/docs/stable/generated/torch.lu.html?highlight=lu#torch.lu) | [paddle.linalg.lu](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/lu_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.lu.md) | +| 159 | [torch.quantile](https://pytorch.org/docs/stable/generated/torch.quantile.html?highlight=quantile#torch.quantile) | [paddle.quantile](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/quantile_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.quantile.md) | +| 160 | [torch.ormqr](https://pytorch.org/docs/stable/generated/torch.ormqr.html#torch.ormqr) | [paddle.linalg.ormqr](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/linalg/ormqr_cn.html#ormqr) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.ormqr.md) | +| 161 | [torch.asarray](https://pytorch.org/docs/stable/generated/torch.asarray.html#torch.asarray) | [paddle.to_tensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/to_tensor_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.asarray.md) | +| 162 | [torch.cumprod](https://pytorch.org/docs/stable/generated/torch.cumprod.html?highlight=cumprod#torch.cumprod) | [paddle.cumprod](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/cumprod_cn.html#cumprod) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.cumprod.md) | +| 163 | [torch.cummin](https://pytorch.org/docs/stable/generated/torch.cummin.html) | [paddle.cummin](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/cummin_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.cummin.md) | +| 164 | [torch.asinh](https://pytorch.org/docs/stable/generated/torch.asinh.html#torch.asinh) | [paddle.asinh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/asinh_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.asinh.md) | +| 165 | [torch.hypot](https://pytorch.org/docs/stable/generated/torch.hypot.html#torch.hypot) | [paddle.hypot](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/hypot_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.hypot.md) | +| 166 | [torch.nextafter](https://pytorch.org/docs/stable/generated/torch.nextafter.html?highlight=nextafter#torch.nextafter) | [paddle.nextafter](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nextafter_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.nextafter.md) | +| 167 | [torch.fmod](https://pytorch.org/docs/stable/generated/torch.fmod.html?highlight=fmod#torch.fmod) | [paddle.mod](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/mod_cn.html#mod) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.fmod.md) | +| 168 | [torch.fix](https://pytorch.org/docs/stable/generated/torch.fix.html?highlight=torch+fix#torch.fix) | [paddle.trunc](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/trunc_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.fix.md) | +| 169 | [torch.median](https://pytorch.org/docs/stable/generated/torch.median.html?highlight=median#torch.median) | [paddle.median](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/median_cn.html#median) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.median.md) | +| 170 | [torch.lgamma](https://pytorch.org/docs/stable/generated/torch.lgamma.html?highlight=lgamma#torch.lgamma) | [paddle.lgamma](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/lgamma_cn.html#lgamma) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.lgamma.md) | +| 171 | [torch.atan2](https://pytorch.org/docs/stable/generated/torch.atan2.html#torch.atan2) | [paddle.atan2](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/atan2_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.atan2.md) | +| 172 | [torch.acosh](https://pytorch.org/docs/stable/generated/torch.acosh.html?highlight=acosh#torch.acosh) | [paddle.acosh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/acosh_cn.html#acos) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.acosh.md) | +| 173 | [torch.nanmedian](https://pytorch.org/docs/stable/generated/torch.nanmedian.html?highlight=nanmedian#torch.nanmedian) | [paddle.nanmedian](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nanmedian_cn.html#nanmedian) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.nanmedian.md) | +| 174 | [torch.inverse](https://pytorch.org/docs/stable/generated/torch.inverse.html?highlight=inverse#torch.inverse) | [paddle.linalg.inv](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/inv_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.inverse.md) | +| 175 | [torch.linspace](https://pytorch.org/docs/stable/generated/torch.linspace.html?highlight=linspace#torch.linspace) | [paddle.linspace](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linspace_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.linspace.md) | +| 176 | torch.scalar_tensor | [paddle.to_tensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/to_tensor_cn.html#to-tensor) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.scalar_tensor.md) | +| 177 | [torch.isposinf](https://pytorch.org/docs/stable/generated/torch.isposinf.html#torch-isposinf) | [paddle.isposinf](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/isposinf_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.isposinf.md) | +| 178 | [torch.index_add](https://pytorch.org/docs/stable/generated/torch.index_add.html#torch.index_add) | [paddle.index_add](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/index_add_cn.html#index-add) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.index_add.md) | +| 179 | [torch.acos](https://pytorch.org/docs/stable/generated/torch.acos.html?highlight=acos#torch.acos) | [paddle.acos](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/acos_cn.html#acos) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.acos.md) | +| 180 | [torch.randint](https://pytorch.org/docs/stable/generated/torch.randint.html?highlight=randint#torch.randint) | [paddle.randint](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/randint_cn.html#randint) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.randint.md) | +| 181 | [torch.mv](https://pytorch.org/docs/stable/generated/torch.mv.html?highlight=torch+mv#torch.mv) | [paddle.mv](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/mv_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.mv.md) | +| 182 | [torch.vdot](https://pytorch.org/docs/stable/generated/torch.vdot.html#torch.vdot) | [paddle.dot](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/dot_cn.html#dot) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.vdot.md) | +| 183 | [torch.negative](https://pytorch.org/docs/stable/generated/torch.negative.html?highlight=torch+negative#torch.negative) | [paddle.neg](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/neg_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.negative.md) | +| 184 | [torch.bernoulli](https://pytorch.org/docs/stable/generated/torch.bernoulli.html#torch.bernoulli) | [paddle.bernoulli](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/bernoulli_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.bernoulli.md) | +| 185 | [torch.inner](https://pytorch.org/docs/stable/generated/torch.inner.html?highlight=inner#torch.inner) | [paddle.inner](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/inner_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.inner.md) | +| 186 | [torch.bucketize](https://pytorch.org/docs/stable/generated/torch.bucketize.html#torch.bucketize) | [paddle.bucketize](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/bucketize_cn.html#paddle-bucketize) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.bucketize.md) | +| 187 | [torch.nan_to_num](https://pytorch.org/docs/stable/generated/torch.nan_to_num.html?highlight=nan_to_num#torch.nan_to_num) | [paddle.nan_to_num](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nan_to_num_cn.html#nan-to-num) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.nan_to_num.md) | +| 188 | [torch.triu_indices](https://pytorch.org/docs/stable/generated/torch.triu_indices.html?highlight=triu_indices#torch.triu_indices) | [paddle.triu_indices](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/triu_indices_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.triu_indices.md) | +| 189 | [torch.logspace](https://pytorch.org/docs/stable/generated/torch.logspace.html?highlight=logspace#torch.logspace) | [paddle.logspace](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/logspace_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.logspace.md) | +| 190 | [torch.set_printoptions](https://pytorch.org/docs/stable/generated/torch.set_printoptions.html?highlight=torch+set_printoptions#torch.set_printoptions) | [paddle.set_printoptions](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/set_printoptions_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.set_printoptions.md) | +| 191 | [torch.save](https://pytorch.org/docs/stable/generated/torch.save.html?highlight=save#torch.save) | [paddle.save](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/save_cn.html#save) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.save.md) | +| 192 | [torch.fmax](https://pytorch.org/docs/stable/generated/torch.fmax.html#torch.fmax) | [paddle.fmax](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fmax_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.fmax.md) | +| 193 | [torch.baddbmm](https://pytorch.org/docs/stable/generated/torch.baddbmm.html?highlight=baddbmm#torch.baddbmm) | [paddle.baddbmm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/baddbmm_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.baddbmm.md) | +| 194 | [torch.deg2rad](https://pytorch.org/docs/stable/generated/torch.deg2rad.html#torch-deg2rad) | [paddle.deg2rad](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/deg2rad_cn.html#paddle.deg2rad) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.deg2rad.md) | +| 195 | [torch.gcd](https://pytorch.org/docs/stable/generated/torch.gcd.html#torch-gcd) | [paddle.gcd](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/gcd_cn.html#gcd) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.gcd.md) | +| 196 | [torch.trunc](https://pytorch.org/docs/stable/generated/torch.trunc.html?highlight=torch+trunc#torch.trunc) | [paddle.trunc](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/trunc_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.trunc.md) | +| 197 | [torch.qr](https://pytorch.org/docs/stable/generated/torch.qr.html#torch.qr) | [paddle.linalg.qr](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/qr_cn.html#qr) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.qr.md) | +| 198 | [torch.ldexp](https://pytorch.org/docs/stable/generated/torch.ldexp.html#torch.ldexp) | [paddle.ldexp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/ldexp_cn.html#ldexp) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.ldexp.md) | +| 199 | [torch.asin](https://pytorch.org/docs/stable/generated/torch.asin.html#torch.asin) | [paddle.asin](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/asin_cn.html#asin) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.asin.md) | +| 200 | [torch.unique](https://pytorch.org/docs/stable/generated/torch.unique.html?highlight=unique#torch.unique) | [paddle.unique](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/unique_cn.html#unique) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.unique.md) | +| 201 | [torch.signbit](https://pytorch.org/docs/stable/generated/torch.signbit.html#torch-signbit) | [paddle.signbit](https://github.com/PaddlePaddle/Paddle/blob/9ce3a54f456011c664c70fbcd318f2e1af0a7d81/python/paddle/tensor/math.py#L7175) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.signbit.md) | +| 202 | [torch.svd](https://pytorch.org/docs/stable/generated/torch.svd.html?highlight=torch+svd#torch.svd) | [paddle.linalg.svd](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/svd_cn.html#svd) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.svd.md) | +| 203 | [torch.atan](https://pytorch.org/docs/stable/generated/torch.atan.html#torch.atan) | [paddle.atan](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/atan_cn.html#atan) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.atan.md) | +| 204 | [torch.normal](https://pytorch.org/docs/stable/generated/torch.normal.html#torch.normal) | [paddle.normal](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/normal_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.normal.md) | +| 205 | [torch.nanmean](https://pytorch.org/docs/stable/generated/torch.nanmean.html?highlight=nanmean#torch.nanmean) | [paddle.nanmean](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nanmean_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.nanmean.md) | +| 206 | [torch.searchsorted](https://pytorch.org/docs/stable/generated/torch.searchsorted.html#torch-searchsorted) | [paddle.searchsorted](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/searchsorted_cn.html#searchsorted) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.searchsorted.md) | +| 207 | [torch.lt](https://pytorch.org/docs/stable/generated/torch.lt.html#torch.lt) | [paddle.less_than](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/less_than_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.lt.md) | +| 208 | [torch.autocast](https://pytorch.org/docs/stable/amp.html?highlight=autocast#torch.autocast) | [paddle.amp.auto_cast](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/amp/auto_cast_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.autocast.md) | +| 209 | [torch.sparse_csr_tensor](https://pytorch.org/docs/stable/generated/torch.sparse_csr_tensor.html#torch.sparse_csr_tensor) | [paddle.sparse.sparse_csr_tensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/sparse/sparse_csr_tensor_cn.html#sparse-csr-tensor) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.sparse_csr_tensor.md) | +| 210 | [torch.abs](https://pytorch.org/docs/stable/generated/torch.abs.html?highlight=abs#torch.abs) | [paddle.abs](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/abs_cn.html#abs) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.abs.md) | +| 211 | [torch.atanh](https://pytorch.org/docs/stable/generated/torch.atanh.html#torch.atanh) | [paddle.atanh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/atanh_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.atanh.md) | +| 212 | [torch.lu_unpack](https://pytorch.org/docs/stable/generated/torch.lu_unpack.html?highlight=lu_unpack#torch.lu_unpack) | [paddle.linalg.lu_unpack](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/lu_unpack_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.lu_unpack.md) | +| 213 | [torch.max_pool1d](https://pytorch.org/docs/stable/jit_builtin_functions.html#supported-pytorch-functions) | [paddle.nn.functional.max_pool1d](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/functional/max_pool1d_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.max_pool1d.md) | +| 214 | [torch.exp](https://pytorch.org/docs/stable/generated/torch.exp.html?highlight=torch+exp#torch.exp) | [paddle.exp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/exp_cn.html#exp) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.exp.md) | +| 215 | [torch.stft](https://pytorch.org/docs/stable/generated/torch.stft.html?highlight=stft#torch.stft) | [paddle.signal.stft](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/signal/stft_cn.html#paddle.signal.stft) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.stft.md) | +| 216 | [torch.logcumsumexp](https://pytorch.org/docs/stable/generated/torch.logcumsumexp.html#torch-logcumsumexp) | [paddle.logcumsumexp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/logcumsumexp_cn.html#logcumsumexp) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.logcumsumexp.md) | +| 217 | [torch.ne](https://pytorch.org/docs/stable/generated/torch.ne.html?highlight=torch.ne#torch.ne) | [paddle.not_equal](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/not_equal_cn.html#not_equal) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.ne.md) | +| 218 | [torch.renorm](https://pytorch.org/docs/stable/generated/torch.renorm.html#torch-renorm) | paddle.renorm | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.renorm.md) | +| 219 | [torch.randn_like](https://pytorch.org/docs/stable/generated/torch.randn_like.html#torch.randn_like) | [paddle.randn_like](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/randn_like_cn.html#randn_like) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.randn_like.md) | +| 220 | [torch.log1p](https://pytorch.org/docs/stable/generated/torch.log1p.html?highlight=log1p#torch.log1p) | [paddle.log1p](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/log1p_cn.html#log1p) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.log1p.md) | +| 221 | [torch.load](https://pytorch.org/docs/stable/generated/torch.load.html?highlight=load#torch.load) | [paddle.load](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/load_cn.html#load) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.load.md) | +| 222 | [torch.hann_window](https://pytorch.org/docs/stable/generated/torch.hann_window.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.hann_window.md) | +| 223 | [torch.hub.load_state_dict_from_url](https://pytorch.org/docs/stable/hub.html#torch.hub.load_state_dict_from_url) | [paddle.hub.load_state_dict_from_url](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/hub/load_state_dict_from_url_cn.html#load-state-dict-from-url) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.hub.load_state_dict_from_url.md) | +| 224 | [torch.fmin](https://pytorch.org/docs/stable/generated/torch.fmin.html#torch.fmin) | [paddle.fmin](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fmin_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.fmin.md) | +| 225 | [torch.mode](https://pytorch.org/docs/stable/generated/torch.mode.html) | [paddle.mode](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/mode_cn.html#mode) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.mode.md) | +| 226 | [torch.addmm](https://pytorch.org/docs/stable/generated/torch.addmm.html?highlight=addmm#torch.addmm) | [paddle.addmm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/addmm_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.addmm.md) | +| 227 | [torch.log10](https://pytorch.org/docs/stable/generated/torch.log10.html?highlight=log10#torch.log10) | [paddle.log10](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/log10_cn.html#log10) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.log10.md) | +| 228 | [torch.nn.modules.batchnorm._BatchNorm](https://pytorch.org/docs/stable/_modules/torch/nn/modules/batchnorm.html) | [paddle.nn.layer.norm._BatchNormBase](https://github.com/PaddlePaddle/Paddle/blob/b51d50bc9ee9eaa5cefa18507195b239e4513194/python/paddle/nn/layer/norm.py#L701) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.nn.modules.batchnorm._BatchNorm.md) | +| 229 | [torch.sgn](https://pytorch.org/docs/stable/generated/torch.sgn.html?highlight=torch+sgn#torch.sgn) | [paddle.sgn](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/sgn_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.sgn.md) | +| 230 | [torch.tril_indices](https://pytorch.org/docs/stable/generated/torch.tril_indices.html?highlight=tril_indices#torch.tril_indices) | [paddle.tril_indices](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/tril_indices_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.tril_indices.md) | +| 231 | [torch.cholesky](https://pytorch.org/docs/stable/generated/torch.cholesky.html?highlight=cholesky#torch.cholesky) | [paddle.linalg.cholesky](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/cholesky_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.cholesky.md) | +| 232 | [torch.frac](https://pytorch.org/docs/stable/generated/torch.frac.html?highlight=frac#torch.frac) | [paddle.frac](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/frac_cn.html#frac) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.frac.md) | +| 233 | [torch.randperm](https://pytorch.org/docs/stable/generated/torch.randperm.html?highlight=rand#torch.randperm) | [paddle.randperm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/randperm_cn.html#randperm) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.randperm.md) | +| 234 | [torch.rad2deg](https://pytorch.org/docs/stable/generated/torch.rad2deg.html?highlight=torch+rad2deg#torch.rad2deg) | [paddle.rad2deg](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/rad2deg_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.rad2deg.md) | +| 235 | [torch.frexp](https://pytorch.org/docs/stable/generated/torch.frexp.html?highlight=frexp#torch.frexp) | [paddle.frexp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/frexp_cn.html#frexp) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.frexp.md) | +| 236 | [torch.tensordot](https://pytorch.org/docs/stable/generated/torch.tensordot.html?highlight=tensordot#torch.tensordot) | [paddle.tensordot](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/tensordot_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.tensordot.md) | +| 237 | [torch.mvlgamma](https://pytorch.org/docs/stable/generated/torch.mvlgamma.html) | [paddle.multigammaln](https://github.com/PaddlePaddle/Paddle/blob/be090bd0bc9ac7a8595296c316b3a6ed3dc60ba6/python/paddle/tensor/math.py#L5099) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.mvlgamma.md) | +| 238 | [torch.sinh](https://pytorch.org/docs/stable/generated/torch.sinh.html?highlight=sinh#torch.sinh) | [paddle.sinh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/sinh_cn.html#sinh) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.sinh.md) | +| 239 | [torch.lcm](https://pytorch.org/docs/stable/generated/torch.lcm.html#torch-lcm) | [paddle.lcm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/lcm_cn.html#lcm) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.lcm.md) | +| 240 | [torch.diag](https://pytorch.org/docs/stable/generated/torch.diag.html?highlight=diag#torch.diag) | [paddle.diag](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/diag_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.diag.md) | +| 241 | [torch.reciprocal](https://pytorch.org/docs/stable/generated/torch.reciprocal.html?highlight=torch+reciprocal#torch.reciprocal) | [paddle.reciprocal](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/reciprocal_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.reciprocal.md) | +| 242 | [torch.conj_physical](https://pytorch.org/docs/stable/generated/torch.conj_physical.html#torch.conj_physical) | [paddle.conj](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/conj_cn.html#conj) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.conj_physical.md) | +| 243 | [torch.heaviside](https://pytorch.org/docs/stable/generated/torch.heaviside.html#torch.heaviside) | [paddle.heaviside](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/heaviside_cn.html#heaviside) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.heaviside.md) | +| 244 | [torch.nanquantile](https://pytorch.org/docs/stable/generated/torch.nanquantile.html?highlight=nanquantile#torch.nanquantile) | [paddle.nanquantile](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nanquantile_cn.html#nanquantile) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.nanquantile.md) | +| 245 | [torch.mm](https://pytorch.org/docs/stable/generated/torch.mm.html?highlight=torch+mm#torch.mm) | [paddle.mm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/mm_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.mm.md) | +| 246 | [torch.clone](https://pytorch.org/docs/stable/generated/torch.clone.html?highlight=clone#torch.clone) | [paddle.clone](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/clone_cn.html#clone) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.clone.md) | +| 247 | torch.clamp_max | [paddle.clip](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/clip_cn.html#clip) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.clamp_max.md) | +| 248 | [torch.round](https://pytorch.org/docs/stable/generated/torch.round.html?highlight=round#torch.round) | [paddle.round](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/round_cn.html#round) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.round.md) | +| 249 | [torch.sub](https://pytorch.org/docs/stable/generated/torch.sub.html?highlight=torch%20sub#torch.sub) | [paddle.subtract](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/subtract_cn.html#subtract) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.sub.md) | +| 250 | [torch.column_stack](https://pytorch.org/docs/stable/generated/torch.column_stack.html#torch.column_stack) | [paddle.column_stack](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/column_stack_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.column_stack.md) | +| 251 | [torch.meshgrid](https://pytorch.org/docs/stable/generated/torch.meshgrid.html?highlight=meshgrid#torch.meshgrid) | [paddle.meshgrid](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/meshgrid_cn.html#meshgrid) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.meshgrid.md) | +| 252 | [torch.symeig](https://pytorch.org/docs/stable/generated/torch.symeig.html?highlight=torch+symeig#torch.symeig) | [paddle.linalg.eigh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/linalg/eigh_cn.html#eigh) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.symeig.md) | +| 253 | [torch.poisson](https://pytorch.org/docs/stable/generated/torch.poisson.html#torch.poisson) | [paddle.poisson](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/poisson_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.poisson.md) | +| 254 | [torch.hub.list](https://pytorch.org/docs/stable/hub.html?highlight=hub+list#torch.hub.list) | [paddle.hub.list](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/hub/list_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.list.md) | +| 255 | [torch.hub.help](https://pytorch.org/docs/stable/hub.html?highlight=hub+help#torch.hub.help) | [paddle.hub.help](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/hub/help_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.help.md) | +| 256 | [torch.hub.download_url_to_file](https://pytorch.org/docs/stable/hub.html?highlight=download#torch.hub.download_url_to_file) | [paddle.utils.download.get_weights_path_from_url](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/utils/download/get_weights_path_from_url_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.download_url_to_file.md) | +| 257 | [torch.hub.load](https://pytorch.org/docs/stable/hub.html?highlight=hub+load#torch.hub.load) | [paddle.hub.load](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/hub/load_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/hub/torch.hub.load.md) | +| 258 | [torch.fft.fft](https://pytorch.org/docs/stable/generated/torch.fft.fft.html?highlight=fft#torch.fft.fft) | [paddle.fft.fft](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/fft_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.fft.md) | +| 259 | [torch.fft.hfft2](https://pytorch.org/docs/stable/generated/torch.fft.hfft2.html?highlight=torch+fft+hfft2#torch.fft.hfft2) | [paddle.fft.hfft2](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/hfft2_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.hfft2.md) | +| 260 | [torch.fft.irfft2](https://pytorch.org/docs/stable/generated/torch.fft.irfft2.html#torch-fft-irfft2) | [paddle.fft.irfft2](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/irfft2_cn.html#irfft2) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.irfft2.md) | +| 261 | [torch.fft.fftn](https://pytorch.org/docs/stable/generated/torch.fft.fftn.html?highlight=fftn#torch.fft.fftn) | [paddle.fft.fftn](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/fftn_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.fftn.md) | +| 262 | [torch.fft.rfftfreq](https://pytorch.org/docs/stable/generated/torch.fft.rfftfreq.html?highlight=rfftfreq#torch.fft.rfftfreq) | [paddle.fft.rfftfreq](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/rfftfreq_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.rfftfreq.md) | +| 263 | [torch.fft.irfft](https://pytorch.org/docs/stable/generated/torch.fft.irfft.html#torch-fft-irfft) | [paddle.fft.irfft](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/irfft_cn.html#irfft) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.irfft.md) | +| 264 | [torch.fft.ifft2](https://pytorch.org/docs/stable/generated/torch.fft.ifft2.html?highlight=ifft2#torch.fft.ifft2) | [paddle.fft.ifft2](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/ifft2_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.ifft2.md) | +| 265 | [torch.fft.hfft](https://pytorch.org/docs/stable/generated/torch.fft.hfft.html?highlight=hfft#torch.fft.hfft) | [paddle.fft.hfft](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/hfft_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.hfft.md) | +| 266 | [torch.fft.fftfreq](https://pytorch.org/docs/stable/generated/torch.fft.fftfreq.html?highlight=fftfreq#torch.fft.fftfreq) | [paddle.fft.fftfreq](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/fftfreq_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.fftfreq.md) | +| 267 | [torch.fft.rfft](https://pytorch.org/docs/stable/generated/torch.fft.rfft.html#torch-fft-rfft) | [paddle.fft.rfft](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/rfft_cn.html#rfft) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.rfft.md) | +| 268 | [torch.fft.ihfft2](https://pytorch.org/docs/stable/generated/torch.fft.ihfft2.html?highlight=torch+fft+ihfft2#torch.fft.ihfft2) | [paddle.fft.ihfft2](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/ihfft2_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.ihfft2.md) | +| 269 | [torch.fft.hfftn](https://pytorch.org/docs/stable/generated/torch.fft.hfftn.html?highlight=torch+fft+hfftn#torch.fft.hfftn) | [paddle.fft.hfftn](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/hfftn_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.hfftn.md) | +| 270 | [torch.fft.ihfftn](https://pytorch.org/docs/stable/generated/torch.fft.ihfftn.html?highlight=torch+fft+ihfftn#torch.fft.ihfftn) | [paddle.fft.ihfftn](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/ihfftn_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.ihfftn.md) | +| 271 | [torch.fft.irfftn](https://pytorch.org/docs/stable/generated/torch.fft.irfftn.html?highlight=irfftn#torch.fft.irfftn) | [paddle.fft.irfftn](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/irfftn_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.irfftn.md) | +| 272 | [torch.fft.ihfft](https://pytorch.org/docs/stable/generated/torch.fft.ihfft.html?highlight=ihfft#torch.fft.ihfft) | [paddle.fft.ihfft](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/ihfft_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.ihfft.md) | +| 273 | [torch.fft.fft2](https://pytorch.org/docs/stable/generated/torch.fft.fft2.html?highlight=fft2#torch.fft.fft2) | [paddle.fft.fft2](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/fft2_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.fft2.md) | +| 274 | [torch.fft.rfft2](https://pytorch.org/docs/stable/generated/torch.fft.rfft2.html) | [paddle.fft.rfft2](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/rfft2_cn.html#rfft2) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.rfft2.md) | +| 275 | [torch.fft.ifftn](https://pytorch.org/docs/stable/generated/torch.fft.ifftn.html?highlight=ifftn#torch.fft.ifftn) | [paddle.fft.ifftn](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/ifftn_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.ifftn.md) | +| 276 | [torch.fft.rfftn](https://pytorch.org/docs/stable/generated/torch.fft.rfftn.html#torch-fft-rfftn) | [paddle.fft.rfftn](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/rfftn_cn.html#rfftn) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.rfftn.md) | +| 277 | [torch.fft.ifft](https://pytorch.org/docs/stable/generated/torch.fft.ifft.html?highlight=ifft#torch.fft.ifft) | [paddle.fft.ifft](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fft/ifft_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/fft/torch.fft.ifft.md) | +| 278 | [torch.cuda.comm.broadcast](https://pytorch.org/docs/stable/generated/torch.cuda.comm.broadcast.html#torch.cuda.comm.broadcast) | [paddle.distributed.broadcast](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/broadcast_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/cuda/torch.cuda.comm.broadcast.md) | +| 279 | [torch.distributed.init_process_group](https://pytorch.org/docs/stable/distributed.html?highlight=init_process#torch.distributed.init_process_group) | [paddle.distributed.init_parallel_env](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/init_parallel_env_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.init_process_group.md) | +| 280 | [torch.distributed.ReduceOp](https://pytorch.org/docs/stable/distributed.html?highlight=torch+distributed+reduceop#torch.distributed.ReduceOp) | [paddle.distributed.ReduceOp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/ReduceOp_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.ReduceOp.md) | +| 281 | [torch.distributed.broadcast_object_list](https://pytorch.org/docs/stable/distributed.html?highlight=broadcast_object_list#torch.distributed.broadcast_object_list) | [paddle.distributed.broadcast_object_list](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/distributed/broadcast_object_list_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.broadcast_object_list.md) | +| 282 | [torch.distributed.P2POp](https://pytorch.org/docs/stable/distributed.html#torch.distributed.P2POp) | [paddle.distributed.P2POp](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/Overview_cn.html#paddle-distributed) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.P2POp.md) | +| 283 | [torch.distributed.new_group](https://pytorch.org/docs/stable/distributed.html#torch.distributed.new_group) | [paddle.distributed.new_group](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/new_group_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.new_group.md) | +| 284 | [torch.distributed.recv](https://pytorch.org/docs/stable/distributed.html#torch.distributed.recv) | [paddle.distributed.recv](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/recv_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.recv.md) | +| 285 | [torch.distributed.rpc.init_rpc](https://pytorch.org/docs/stable/rpc.html#torch.distributed.rpc.init_rpc) | [paddle.distributed.rpc.init_rpc](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/rpc/init_rpc_cn.html#init-rpc) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.rpc.init_rpc.md) | +| 286 | [torch.distributed.monitored_barrier](https://pytorch.org/docs/stable/distributed.html#torch.distributed.monitored_barrier) | [paddle.distributed.barrier](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/barrier_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.monitored_barrier.md) | +| 287 | [torch.distributed.isend](https://pytorch.org/docs/stable/distributed.html#torch.distributed.isend) | [paddle.distributed.isend](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/distributed/isend_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.isend.md) | +| 288 | [torch.distributed.barrier](https://pytorch.org/docs/stable/distributed.html?highlight=barrier#torch.distributed.barrier) | [paddle.distributed.barrier](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/barrier_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.barrier.md) | +| 289 | [torch.distributed.send](https://pytorch.org/docs/stable/distributed.html#torch.distributed.send) | [paddle.distributed.send](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/send_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.send.md) | +| 290 | [torch.distributed.rpc.shutdown](https://pytorch.org/docs/stable/rpc.html#torch.distributed.rpc.shutdown) | [paddle.distributed.rpc.shutdown](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distributed/rpc/shutdown_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.rpc.shutdown.md) | +| 291 | [torch.distributed.irecv](https://pytorch.org/docs/stable/distributed.html?highlight=send#torch.distributed.irecv) | [paddle.distributed.irecv](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/distributed/irecv_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributed/torch.distributed.irecv.md) | +| 292 | [torch.nn.Bilinear](https://pytorch.org/docs/stable/generated/torch.nn.Bilinear.html#torch.nn.Bilinear) | [paddle.nn.Bilinear](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Bilinear_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Bilinear.md) | +| 293 | [torch.nn.SiLU](https://pytorch.org/docs/stable/generated/torch.nn.SiLU.html#torch.nn.SiLU) | [paddle.nn.Silu](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Silu_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.SiLU.md) | +| 294 | [torch.nn.MultiLabelMarginLoss](https://pytorch.org/docs/stable/generated/torch.nn.MultiLabelMarginLoss.html#torch.nn.MultiLabelMarginLoss) | [paddle.nn.MultiLabelMarginLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/MultiLabelMarginLoss_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.MultiLabelMarginLoss.md) | +| 295 | [torch.nn.Dropout](https://pytorch.org/docs/stable/generated/torch.nn.Dropout.html?highlight=dropout#torch.nn.Dropout) | [paddle.nn.Dropout](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Dropout_cn.html#dropout) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Dropout.md) | +| 296 | [torch.nn.LayerNorm](https://pytorch.org/docs/stable/generated/torch.nn.LayerNorm.html?highlight=layernorm#torch.nn.LayerNorm) | [paddle.nn.LayerNorm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/LayerNorm_cn.html#layernorm) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.LayerNorm.md) | +| 297 | [torch.nn.GroupNorm](https://pytorch.org/docs/stable/generated/torch.nn.GroupNorm.html?highlight=groupnorm#torch.nn.GroupNorm) | [paddle.nn.GroupNorm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/GroupNorm_cn.html#groupnorm) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.GroupNorm.md) | +| 298 | [torch.nn.BCEWithLogitsLoss](https://pytorch.org/docs/stable/generated/torch.nn.BCEWithLogitsLoss.html#bcewithlogitsloss) | [paddle.nn.BCEWithLogitsLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/BCEWithLogitsLoss_cn.html#bcewithlogitsloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.BCEWithLogitsLoss.md) | +| 299 | [torch.nn.ELU](https://pytorch.org/docs/stable/generated/torch.nn.ELU.html?highlight=elu#torch.nn.ELU) | [paddle.nn.ELU](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/ELU_cn.html#elu) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.ELU.md) | +| 300 | [torch.nn.NLLLoss](https://pytorch.org/docs/stable/generated/torch.nn.NLLLoss.html?highlight=nllloss#torch.nn.NLLLoss) | [paddle.nn.NLLLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/NLLLoss_cn.html#nllloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.NLLLoss.md) | +| 301 | [torch.nn.InstanceNorm3d](https://pytorch.org/docs/stable/generated/torch.nn.InstanceNorm3d.html#torch.nn.InstanceNorm3d) | [paddle.nn.InstanceNorm3D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/InstanceNorm3D_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.InstanceNorm3d.md) | +| 302 | [torch.nn.Dropout3d](https://pytorch.org/docs/stable/generated/torch.nn.Dropout3d.html?highlight=dropout3d#torch.nn.Dropout3d) | [paddle.nn.Dropout3D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Dropout3D_cn.html#dropout3d) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Dropout3d.md) | +| 303 | [torch.nn.FractionalMaxPool3d](https://pytorch.org/docs/stable/generated/torch.nn.FractionalMaxPool3d.html#fractionalmaxpool3d) | [paddle.nn.FractionalMaxPool3D](https://www.paddlepaddle.org.cn/documentation/docs/en/develop/api/paddle/nn/FractionalMaxPool3D_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.FractionalMaxPool3d.md) | +| 304 | [torch.nn.Module.register_forward_pre_hook](https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.register_forward_pre_hook) | [paddle.nn.Layer.register_forward_pre_hook](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Layer_cn.html#register-forward-pre-hook-hook) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Module.register_forward_pre_hook.md) | +| 305 | [torch.nn.Mish](https://pytorch.org/docs/stable/generated/torch.nn.Mish.html?highlight=torch+nn+mish) | [paddle.nn.Mish](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Mish_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Mish.md) | +| 306 | [torch.nn.Hardswish](https://pytorch.org/docs/stable/generated/torch.nn.Hardswish.html#torch.nn.Hardswish) | [paddle.nn.Hardswish](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Hardswish_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Hardswish.md) | +| 307 | [torch.nn.Module.load_state_dict](https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.load_state_dict) | [paddle.nn.Layer.set_state_dict](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Layer_cn.html#set-state-dict-state-dict-use-structured-name-true) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Module.load_state_dict.md) | +| 308 | [torch.nn.PoissonNLLLoss](https://pytorch.org/docs/stable/generated/torch.nn.PoissonNLLLoss) | [paddle.nn.PoissonNLLLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/PoissonNLLLoss_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.PoissonNLLLoss.md) | +| 309 | [torch.nn.MaxPool1d](https://pytorch.org/docs/stable/generated/torch.nn.MaxPool1d.html?highlight=maxpool1d#torch.nn.MaxPool1d) | [paddle.nn.MaxPool1D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/MaxPool1D_cn.html#maxpool1d) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.MaxPool1d.md) | +| 310 | [torch.nn.FractionalMaxPool2d](https://pytorch.org/docs/stable/generated/torch.nn.FractionalMaxPool2d.html#fractionalmaxpool2d) | [paddle.nn.FractionalMaxPool2D](https://www.paddlepaddle.org.cn/documentation/docs/en/develop/api/paddle/nn/FractionalMaxPool2D_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.FractionalMaxPool2d.md) | +| 311 | [torch.nn.Hardtanh](https://pytorch.org/docs/stable/generated/torch.nn.Hardtanh.html#torch.nn.Hardtanh) | [paddle.nn.Hardtanh](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Hardtanh_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Hardtanh.md) | +| 312 | [torch.nn.AdaptiveLogSoftmaxWithLoss](https://pytorch.org/docs/stable/generated/torch.nn.AdaptiveLogSoftmaxWithLoss.html#adaptivelogsoftmaxwithloss) | [paddle.nn.AdaptiveLogSoftmaxWithLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/AdaptiveLogSoftmaxWithLoss_cn.html#adaptivelogsoftmaxwithloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.AdaptiveLogSoftmaxWithLoss.md) | +| 313 | [torch.nn.Transformer](https://pytorch.org/docs/stable/generated/torch.nn.Transformer.html#torch.nn.Transformer) | [paddle.nn.Transformer](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Transformer_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Transformer.md) | +| 314 | [torch.nn.LeakyReLU](https://pytorch.org/docs/stable/generated/torch.nn.LeakyReLU.html?highlight=leakyrelu#torch.nn.LeakyReLU) | [paddle.nn.LeakyReLU](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/LeakyReLU_cn.html#leakyrelu) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.LeakyReLU.md) | +| 315 | [torch.nn.TransformerEncoder](https://pytorch.org/docs/stable/generated/torch.nn.TransformerEncoder.html#torch.nn.TransformerEncoder) | [paddle.nn.TransformerEncoder](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/TransformerEncoder_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.TransformerEncoder.md) | +| 316 | [torch.nn.SmoothL1Loss](https://pytorch.org/docs/stable/generated/torch.nn.SmoothL1Loss.html?highlight=smoothl1loss#torch.nn.SmoothL1Loss) | [paddle.nn.SmoothL1Loss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/SmoothL1Loss_cn.html#smoothl1loss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.SmoothL1Loss.md) | +| 317 | [torch.nn.MultiLabelSoftMarginLoss](https://pytorch.org/docs/stable/generated/torch.nn.MultiLabelSoftMarginLoss.html#torch.nn.MultiLabelSoftMarginLoss) | [paddle.nn.MultiLabelSoftMarginLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/MultiLabelSoftMarginLoss_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.MultiLabelSoftMarginLoss.md) | +| 318 | [torch.nn.CosineEmbeddingLoss](https://pytorch.org/docs/stable/generated/torch.nn.CosineEmbeddingLoss.html#torch.nn.CosineEmbeddingLoss) | [paddle.nn.CosineEmbeddingLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/CosineEmbeddingLoss_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.CosineEmbeddingLoss.md) | +| 319 | [torch.nn.MaxPool3d](https://pytorch.org/docs/stable/generated/torch.nn.MaxPool3d.html?highlight=maxpool3d#torch.nn.MaxPool3d) | [paddle.nn.MaxPool3D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/MaxPool3D_cn.html#maxpool3d) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.MaxPool3d.md) | +| 320 | [torch.nn.SELU](https://pytorch.org/docs/stable/generated/torch.nn.SELU.html#torch.nn.SELU) | [paddle.nn.SELU](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/SELU_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.SELU.md) | +| 321 | [torch.nn.parallel.DistributedDataParallel](https://pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html#torch.nn.parallel.DistributedDataParallel) | [paddle.DataParallel](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/DataParallel_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.parallel.DistributedDataParallel.md) | +| 322 | [torch.nn.TransformerEncoderLayer](https://pytorch.org/docs/stable/generated/torch.nn.TransformerEncoderLayer.html#torch.nn.TransformerEncoderLayer) | [paddle.nn.TransformerEncoderLayer](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/TransformerEncoderLayer_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.TransformerEncoderLayer.md) | +| 323 | [torch.nn.SoftMarginLoss](https://pytorch.org/docs/stable/generated/torch.nn.SoftMarginLoss.html#torch.nn.SoftMarginLoss) | [paddle.nn.SoftMarginLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/SoftMarginLoss_cn.html#softmarginloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.SoftMarginLoss.md) | +| 324 | [torch.nn.DataParallel](https://pytorch.org/docs/stable/generated/torch.nn.DataParallel.html?highlight=dataparallel#torch.nn.DataParallel) | [paddle.DataParallel](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/DataParallel_cn.html#dataparallel) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.DataParallel.md) | +| 325 | [torch.nn.Module.register_forward_hook](https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.register_forward_hook) | [paddle.nn.Layer.register_forward_post_hook](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Layer_cn.html#register-forward-post-hook-hook) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Module.register_forward_hook.md) | +| 326 | [torch.nn.TransformerDecoderLayer](https://pytorch.org/docs/stable/generated/torch.nn.TransformerDecoderLayer.html?highlight=transformerdecoderlayer#torch.nn.TransformerDecoderLayer) | [paddle.nn.TransformerDecoderLayer](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/TransformerDecoderLayer_cn.html#transformerdecoderlayer) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.TransformerDecoderLayer.md) | +| 327 | [torch.nn.CELU](https://pytorch.org/docs/stable/generated/torch.nn.CELU.html#torch.nn.CELU) | [paddle.nn.CELU](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/CELU_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.CELU.md) | +| 328 | [torch.nn.MultiMarginLoss](https://pytorch.org/docs/stable/generated/torch.nn.MultiMarginLoss) | [paddle.nn.MultiMarginLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/MultiMarginLoss_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.MultiMarginLoss.md) | +| 329 | [torch.nn.Dropout2d](https://pytorch.org/docs/stable/generated/torch.nn.Dropout2d.html?highlight=dropout2d#torch.nn.Dropout2d) | [paddle.nn.Dropout2D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Dropout2D_cn.html#dropout2d) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Dropout2d.md) | +| 330 | [torch.nn.SyncBatchNorm.convert_sync_batchnorm](https://pytorch.org/docs/stable/generated/torch.nn.SyncBatchNorm.html?highlight=convert_sync_batchnorm#torch.nn.SyncBatchNorm.convert_sync_batchnorm) | [paddle.nn.SyncBatchNorm.convert_sync_batchnorm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/SyncBatchNorm_cn.html#convert-sync-batchnorm-layer) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.SyncBatchNorm.convert_sync_batchnorm.md) | +| 331 | [torch.nn.AlphaDropout](https://pytorch.org/docs/stable/generated/torch.nn.AlphaDropout.html#torch.nn.AlphaDropout) | [paddle.nn.AlphaDropout](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/AlphaDropout_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.AlphaDropout.md) | +| 332 | [torch.nn.CTCLoss](https://pytorch.org/docs/stable/generated/torch.nn.CTCLoss.html#torch.nn.CTCLoss) | [paddle.nn.CTCLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/CTCLoss_cn.html#ctcloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.CTCLoss.md) | +| 333 | [torch.nn.RReLU](https://pytorch.org/docs/stable/generated/torch.nn.RReLU.html#torch.nn.RReLU) | [paddle.nn.RReLU](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/RReLU_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.RReLU.md) | +| 334 | [torch.nn.L1Loss](https://pytorch.org/docs/stable/generated/torch.nn.L1Loss.html?highlight=l1loss#torch.nn.L1Loss) | [paddle.nn.L1Loss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/L1Loss_cn.html#l1loss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.L1Loss.md) | +| 335 | [torch.nn.ReLU](https://pytorch.org/docs/stable/generated/torch.nn.ReLU.html?highlight=relu#torch.nn.ReLU) | [paddle.nn.ReLU](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/ReLU_cn.html#relu) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.ReLU.md) | +| 336 | [torch.nn.PReLU](https://pytorch.org/docs/stable/generated/torch.nn.PReLU.html?highlight=prelu#torch.nn.PReLU) | [paddle.nn.PReLU](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/PReLU_cn.html#prelu) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.PReLU.md) | +| 337 | [torch.nn.RNNBase](https://pytorch.org/docs/stable/generated/torch.nn.RNNBase.html#torch.nn.RNNBase) | [paddle.nn.layer.rnn.RNNBase](https://github.com/PaddlePaddle/Paddle/blob/e25e86f4f6d1bbd043b621a75e93d0070719c3d8/python/paddle/nn/layer/rnn.py#L1300) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.RNNBase.md) | +| 338 | [torch.nn.MarginRankingLoss](https://pytorch.org/docs/stable/generated/torch.nn.MarginRankingLoss.html#marginrankingloss) | [paddle.nn.MarginRankingLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/MarginRankingLoss_cn.html#marginrankingloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.MarginRankingLoss.md) | +| 339 | [torch.nn.Threshold](https://pytorch.org/docs/stable/generated/torch.nn.Threshold.html#torch.nn.Threshold) | [paddle.nn.ThresholdedReLU](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/ThresholdedReLU_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Threshold.md) | +| 340 | [torch.nn.KLDivLoss](https://pytorch.org/docs/stable/generated/torch.nn.KLDivLoss.html?highlight=kldivloss#torch.nn.KLDivLoss) | [paddle.nn.KLDivLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/KLDivLoss_cn.html#kldivloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.KLDivLoss.md) | +| 341 | [torch.nn.MSELoss](https://pytorch.org/docs/stable/generated/torch.nn.MSELoss.html?highlight=mseloss#torch.nn.MSELoss) | [paddle.nn.MSELoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/MSELoss_cn.html#mseloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.MSELoss.md) | +| 342 | [torch.nn.BCELoss](https://pytorch.org/docs/stable/generated/torch.nn.BCELoss.html?highlight=bceloss#torch.nn.BCELoss) | [paddle.nn.BCELoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/BCELoss_cn.html#bceloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.BCELoss.md) | +| 343 | [torch.nn.TripletMarginLoss](https://pytorch.org/docs/stable/generated/torch.nn.TripletMarginLoss.html#torch.nn.TripletMarginLoss) | [paddle.nn.TripletMarginLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/TripletMarginLoss_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.TripletMarginLoss.md) | +| 344 | [torch.nn.FeatureAlphaDropout](https://pytorch.org/docs/stable/generated/torch.nn.FeatureAlphaDropout.html#torch.nn.FeatureAlphaDropout) | [paddle.nn.FeatureAlphaDropout](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/FeatureAlphaDropout_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.FeatureAlphaDropout.md) | +| 345 | [torch.nn.ReLU6](https://pytorch.org/docs/stable/generated/torch.nn.ReLU6.html#torch.nn.ReLU6) | [paddle.nn.ReLU6](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/ReLU6_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.ReLU6.md) | +| 346 | [torch.nn.HingeEmbeddingLoss](https://pytorch.org/docs/stable/generated/torch.nn.HingeEmbeddingLoss.html#hingeembeddingloss) | [paddle.nn.HingeEmbeddingLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/HingeEmbeddingLoss_cn.html#hingeembeddingloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.HingeEmbeddingLoss.md) | +| 347 | [torch.nn.Hardsigmoid](https://pytorch.org/docs/stable/generated/torch.nn.Hardsigmoid.html?highlight=hardsigmoid#torch.nn.Hardsigmoid) | [paddle.nn.Hardsigmoid](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Hardsigmoid_cn.html#hardsigmoid) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Hardsigmoid.md) | +| 348 | [torch.nn.CrossEntropyLoss](https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html#torch.nn.CrossEntropyLoss) | [paddle.nn.CrossEntropyLoss](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/CrossEntropyLoss_cn.html#crossentropyloss) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.CrossEntropyLoss.md) | +| 349 | [torch.nn.Dropout1d](https://pytorch.org/docs/stable/generated/torch.nn.Dropout1d.html#torch.nn.Dropout1d) | [paddle.nn.Dropout](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/Dropout_cn.html#dropout) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.Dropout1d.md) | +| 350 | [torch.nn.MaxPool2d](https://pytorch.org/docs/stable/generated/torch.nn.MaxPool2d.html?highlight=maxpool2d#torch.nn.MaxPool2d) | [paddle.nn.MaxPool2D](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/MaxPool2D_cn.html#maxpool2d) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.MaxPool2d.md) | +| 351 | [torch.nn.MultiheadAttention](https://pytorch.org/docs/stable/generated/torch.nn.MultiheadAttention.html#torch.nn.MultiheadAttention) | [paddle.nn.MultiHeadAttention](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/MultiHeadAttention_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/nn/torch.nn.MultiheadAttention.md) | +| 352 | [torch.utils.data.SubsetRandomSampler](https://pytorch.org/docs/stable/data.html#torch.utils.data.SubsetRandomSampler) | [paddle.io.SubsetRandomSampler](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/io/SubsetRandomSampler_cn.html#paddle.io.SubsetRandomSampler) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/utils/torch.utils.data.SubsetRandomSampler.md) | +| 353 | [torch.utils.cpp_extension.CUDAExtension](https://pytorch.org/docs/stable/cpp_extension.html?highlight=torch+utils+cpp_extension+cudaextension#torch.utils.cpp_extension.CUDAExtension) | [paddle.utils.cpp_extension.CUDAExtension](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/utils/cpp_extension/CUDAExtension_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/utils/torch.utils.cpp_extension.CUDAExtension.md) | +| 354 | [torch.utils.checkpoint.checkpoint](https://pytorch.org/docs/stable/checkpoint.html#torch.utils.checkpoint.checkpoint) | [paddle.distributed.fleet.utils.recompute](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/utils/cpp_extension/CppExtension_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/utils/torch.utils.checkpoint.checkpoint.md) | +| 355 | [torch.utils.cpp_extension.CppExtension](https://pytorch.org/docs/stable/cpp_extension.html?highlight=torch+utils+cpp_extension+cppextension#torch.utils.cpp_extension.CppExtension) | [paddle.utils.cpp_extension.CppExtension](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/utils/cpp_extension/CppExtension_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/utils/torch.utils.cpp_extension.CppExtension.md) | +| 356 | [torch.utils.data.DataLoader](https://pytorch.org/docs/stable/data.html?highlight=dataloader#torch.utils.data.DataLoader) | [paddle.io.DataLoader](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/io/DataLoader_cn.html#dataloader) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/utils/torch.utils.data.DataLoader.md) | +| 357 | [torch.utils.data.distributed.DistributedSampler](https://docs.pytorch.org/docs/stable/data.html#torch.utils.data.distributed.DistributedSampler) | [paddle.io.DistributedBatchSampler](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/io/DistributedBatchSampler_cn.html#distributedbatchsampler) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/utils/torch.utils.data.distributed.DistributedSampler.md) | +| 358 | [torch.utils.cpp_extension.load](https://pytorch.org/docs/stable/cpp_extension.html?highlight=torch+utils+cpp_extension+load#torch.utils.cpp_extension.load) | [paddle.utils.cpp_extension.load](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/utils/cpp_extension/load_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/utils/torch.utils.cpp_extension.load.md) | +| 359 | [torch.signal.windows.general_cosine](https://pytorch.org/docs/stable/generated/torch.signal.windows.general_cosine.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/audio/functional/torch.signal.windows.general_cosine.md) | +| 360 | [torch.signal.windows.general_hamming](https://pytorch.org/docs/stable/generated/torch.signal.windows.general_hamming.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/audio/functional/torch.signal.windows.general_hamming.md) | +| 361 | [torch.signal.windows.hann](https://pytorch.org/docs/stable/generated/torch.signal.windows.hann.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/audio/functional/torch.signal.windows.hann.md) | +| 362 | [torch.signal.windows.exponential](https://pytorch.org/docs/stable/generated/torch.signal.windows.exponential.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/audio/functional/torch.signal.windows.exponential.md) | +| 363 | [torch.signal.windows.hamming](https://pytorch.org/docs/stable/generated/torch.signal.windows.hamming.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/audio/functional/torch.signal.windows.hamming.md) | +| 364 | [torch.signal.windows.gaussian](https://pytorch.org/docs/stable/generated/torch.signal.windows.gaussian.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/audio/functional/torch.signal.windows.gaussian.md) | +| 365 | [torch.signal.windows.blackman](https://pytorch.org/docs/stable/generated/torch.signal.windows.blackman.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/audio/functional/torch.signal.windows.blackman.md) | +| 366 | [torch.signal.windows.cosine](https://pytorch.org/docs/stable/generated/torch.signal.windows.cosine.html) | [paddle.audio.functional.get_window](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/audio/functional/get_window_cn.html#get-window) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/audio/functional/torch.signal.windows.cosine.md) | +| 367 | [torch.distributions.transforms.SigmoidTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.SigmoidTransform) | [paddle.distribution.SigmoidTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/SigmoidTransform_cn.html#sigmoidtransform) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.SigmoidTransform.md) | +| 368 | [torch.distributions.transformed_distribution.TransformedDistribution](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transformed_distribution.TransformedDistribution) | [paddle.distribution.TransformedDistribution](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/TransformedDistribution_cn.html#transformeddistribution) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transformed_distribution.TransformedDistribution.md) | +| 369 | [torch.distributions.gamma.Gamma](https://pytorch.org/docs/stable/distributions.html#gamma) | [paddle.distribution.Gamma](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Gamma_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.gamma.Gamma.md) | +| 370 | [torch.distributions.transforms.StackTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.StackTransform) | [paddle.distribution.StackTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/StackTransform_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.StackTransform.md) | +| 371 | [torch.distributions.transforms.PowerTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.SigmoidTransform) | [paddle.distribution.PowerTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/PowerTransform_cn.html#powertransform) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.PowerTransform.md) | +| 372 | [torch.distributions.beta.Beta](https://pytorch.org/docs/stable/distributions.html#torch.distributions.beta.Beta) | [paddle.distribution.Beta](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Beta_cn.html#beta) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.beta.Beta.md) | +| 373 | [torch.distributions.transforms.Transform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.Transform) | [paddle.distribution.Transform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Transform_cn.html#transform) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.Transform.md) | +| 374 | [torch.distributions.transforms.SoftmaxTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.SoftmaxTransform) | [paddle.distribution.SoftmaxTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/SoftmaxTransform_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.SoftmaxTransform.md) | +| 375 | [torch.distributions.log_normal.LogNormal](https://pytorch.org/docs/stable/distributions.html#torch.distributions.log_normal.LogNormal) | [paddle.distribution.LogNormal](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/LogNormal_cn.html#lognormal) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.log_normal.LogNormal.md) | +| 376 | [torch.distributions.bernoulli.Bernoulli](https://pytorch.org/docs/stable/distributions.html#torch.distributions.bernoulli.Bernoulli) | [paddle.distribution.Bernoulli](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Bernoulli_cn.html#bernoulli) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.bernoulli.Bernoulli.md) | +| 377 | [torch.distributions.binomial.Binomial](https://pytorch.org/docs/stable/distributions.html#torch.distributions.binomial.Binomial) | [paddle.distribution.Binomial](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/distribution/Binomial_cn.html#binomial) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.binomial.Binomial.md) | +| 378 | [torch.distributions.laplace.Laplace](https://pytorch.org/docs/stable/distributions.html#torch.distributions.laplace.Laplace) | [paddle.distribution.Laplace](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Laplace_cn.html#laplace) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.laplace.Laplace.md) | +| 379 | [torch.distributions.lkj_cholesky.LKJCholesky](https://pytorch.org/docs/stable/distributions.html#torch.distributions.lkj_cholesky.LKJCholesky) | [paddle.distribution.LKJCholesky](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/distribution/LKJCholesky_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.lkj_cholesky.LKJCholesky.md) | +| 380 | [torch.distributions.cauchy.Cauchy](https://pytorch.org/docs/stable/distributions.html#torch.distributions.cauchy.Cauchy) | [paddle.distribution.Cauchy](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Cauchy_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.cauchy.Cauchy.md) | +| 381 | [torch.distributions.studentT.StudentT](https://pytorch.org/docs/stable/distributions.html#studentt) | [paddle.distribution.StudentT](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/distribution/StudentT_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.studentT.StudentT.md) | +| 382 | [torch.distributions.continuous_bernoulli.ContinuousBernoulli](https://pytorch.org/docs/stable/distributions.html) | [paddle.distribution.ContinuousBernoulli](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/distribution/ContinuousBernoulli_cn.html#continuousbernoulli) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.continuous_bernoulli.ContinuousBernoulli.md) | +| 383 | [torch.distributions.multinomial.Multinomial](https://pytorch.org/docs/stable/distributions.html#torch.distributions.multinomial.Multinomial) | [paddle.distribution.Multinomial](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Multinomial_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.multinomial.Multinomial.md) | +| 384 | [torch.distributions.dirichlet.Dirichlet](https://pytorch.org/docs/stable/distributions.html#torch.distributions.dirichlet.Dirichlet) | [paddle.distribution.Dirichlet](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Dirichlet_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.dirichlet.Dirichlet.md) | +| 385 | [torch.distributions.exp_family.ExponentialFamily](https://pytorch.org/docs/stable/distributions.html#torch.distributions.exp_family.ExponentialFamily) | [paddle.distribution.ExponentialFamily](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/ExponentialFamily_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.exp_family.ExponentialFamily.md) | +| 386 | [torch.distributions.categorical.Categorical](https://pytorch.org/docs/stable/distributions.html#torch.distributions.categorical.Categorical) | [paddle.distribution.Categorical](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Categorical_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.categorical.Categorical.md) | +| 387 | [torch.distributions.transforms.ReshapeTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.ReshapeTransform) | [paddle.distribution.ReshapeTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/ReshapeTransform_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.ReshapeTransform.md) | +| 388 | [torch.distributions.gumbel.Gumbel](https://pytorch.org/docs/stable/distributions.html#torch.distributions.gumbel.Gumbel) | [paddle.distribution.Gumbel](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Gumbel_cn.html#gumbel) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.gumbel.Gumbel.md) | +| 389 | [torch.distributions.transforms.AbsTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.AbsTransform) | [paddle.distribution.AbsTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/AbsTransform_cn.html#paddle.distribution.AbsTransform) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.AbsTransform.md) | +| 390 | [torch.distributions.normal.Normal](https://pytorch.org/docs/stable/distributions.html#torch.distributions.normal.Normal) | [paddle.distribution.Normal](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Normal_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.normal.Normal.md) | +| 391 | [torch.distributions.transforms.ExpTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.ExpTransform) | [paddle.distribution.ExpTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/ExpTransform_cn.html#exptransform) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.ExpTransform.md) | +| 392 | [torch.distributions.chi2.Chi2](https://pytorch.org/docs/stable/distributions.html#chi2) | [paddle.distribution.Chi2](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Chi2_cn.html#prob-value) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.chi2.Chi2.md) | +| 393 | [torch.distributions.uniform.Uniform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.uniform.Uniform) | [paddle.distribution.Uniform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Uniform_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.uniform.Uniform.md) | +| 394 | [torch.distributions.transforms.StickBreakingTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.StickBreakingTransform) | [paddle.distribution.StickBreakingTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/StickBreakingTransform_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.StickBreakingTransform.md) | +| 395 | [torch.distributions.exponential.Exponential](https://pytorch.org/docs/stable/distributions.html#torch.distributions.exponential.Exponential.arg_constraints) | [paddle.distribution.Exponential](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/distribution/ExponentialFamily_cn.html#exponential) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.exponential.Exponential.md) | +| 396 | [torch.distributions.multivariate_normal.MultivariateNormal](https://pytorch.org/docs/stable/distributions.html#multivariatenormal) | [paddle.distribution.MultivariateNormal](https://www.paddlepaddle.org.cn/documentation/docs/zh/2.6/api/paddle/distribution/MultivariateNormal_cn.html#multivariatenormal) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.multivariate_normal.MultivariateNormal.md) | +| 397 | [torch.distributions.geometric.Geometric](https://pytorch.org/docs/stable/distributions.html#torch.distributions.geometric.Geometric) | [paddle.distribution.Geometric](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Geometric_cn.html#geometric) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.geometric.Geometric.md) | +| 398 | [torch.distributions.transforms.ComposeTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.ComposeTransform) | [paddle.distribution.ChainTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/ChainTransform_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.ComposeTransform.md) | +| 399 | [torch.distributions.transforms.AffineTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.AffineTransform) | [paddle.distribution.AffineTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/AffineTransform_cn.html#affinetransform) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.AffineTransform.md) | +| 400 | [torch.distributions.independent.Independent](https://pytorch.org/docs/stable/distributions.html#torch.distributions.independent.Independent) | [paddle.distribution.Independent](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Independent_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.independent.Independent.md) | +| 401 | [torch.distributions.poisson.Poisson](https://pytorch.org/docs/stable/distributions.html#poisson) | [paddle.distribution.Poisson](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/distribution/Poisson_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.poisson.Poisson.md) | +| 402 | [torch.distributions.transforms.IndependentTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.IndependentTransform) | [paddle.distribution.IndependentTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/IndependentTransform_cn.html#independenttransform) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.IndependentTransform.md) | +| 403 | [torch.distributions.distribution.Distribution](https://pytorch.org/docs/stable/distributions.html#torch.distributions.distribution.Distribution) | [paddle.distribution.Distribution](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/Distribution_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.distribution.Distribution.md) | +| 404 | [torch.distributions.transforms.TanhTransform](https://pytorch.org/docs/stable/distributions.html#torch.distributions.transforms.TanhTransform) | [paddle.distribution.TanhTransform](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/distribution/TanhTransform_cn.html#tanhtransform) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/distributions/torch.distributions.transforms.TanhTransform.md) | +| 405 | [flash_attn.flash_attn_interface.flash_attn_func](https://github.com/Dao-AILab/flash-attention/blob/72e27c6320555a37a83338178caa25a388e46121/flash_attn/flash_attn_interface.py#L808) | [paddle.nn.functional.flash_attention.flash_attention](https://github.com/PaddlePaddle/Paddle/blob/900d27c40ef4567d7ea6342f3f0eedd394885ecb/python/paddle/nn/functional/flash_attention.py#L248) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/flash_attn/flash_attn.flash_attn_interface.flash_attn_func.md) | +| 406 | [flash_attn.flash_attn_interface.flash_attn_unpadded_func](https://github.com/Dao-AILab/flash-attention/blob/d0787acc16c3667156b51ce5b01bdafc7594ed39/flash_attn/flash_attn_interface.py#L1050) | [paddle.nn.functional.flash_attention.flash_attn_unpadded](https://github.com/PaddlePaddle/Paddle/blob/b32b51b7c21ad62bf794512c849a603c8c0ece44/python/paddle/nn/functional/flash_attention.py#L664) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/flash_attn/flash_attn.flash_attn_interface.flash_attn_unpadded_func.md) | +| 407 | [torchvision.ops.RoIAlign](https://pytorch.org/vision/main/generated/torchvision.ops.RoIAlign.html) | [paddle.vision.ops.RoIAlign](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/ops/RoIAlign_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.ops.RoIAlign.md) | +| 408 | [torchvision.transforms.functional.normalize](https://pytorch.org/vision/stable/generated/torchvision.transforms.functional.normalize.html) | [paddle.vision.transforms.normalize](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/transforms/normalize_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.transforms.functional.normalize.md) | +| 409 | [torchvision.transforms.Normalize](https://pytorch.org/vision/main/generated/torchvision.transforms.Normalize.html) | [paddle.vision.transforms.Normalize](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/vision/transforms/Normalize__upper_cn.html#normalize) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.transforms.Normalize.md) | +| 410 | [torchvision.datasets.ImageFolder](https://pytorch.org/vision/main/generated/torchvision.datasets.ImageFolder.html) | [paddle.vision.datasets.ImageFolder](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/datasets/ImageFolder_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.datasets.ImageFolder.md) | +| 411 | [fairscale.nn.model_parallel.layers.RowParallelLinear](https://github.com/facebookresearch/fairscale/blob/164cc0f3170b4a3951dd84dda29c3e1504ac4d6e/fairscale/nn/model_parallel/layers.py#L299) | [paddle.distributed.fleet.meta_parallel.RowParallelLinear](https://github.com/PaddlePaddle/Paddle/blob/016766cc89fabc10181453ce70b701dd8ed019f6/python/paddle/distributed/fleet/layers/mpu/mp_layers.py#L291) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/fairscale/fairscale.nn.model_parallel.layers.RowParallelLinear.md) | +| 412 | [fairscale.nn.model_parallel.layers.ColumnParallelLinear](https://github.com/facebookresearch/fairscale/blob/164cc0f3170b4a3951dd84dda29c3e1504ac4d6e/fairscale/nn/model_parallel/layers.py#L218) | [paddle.distributed.fleet.meta_parallel.ColumnParallelLinear](https://github.com/PaddlePaddle/Paddle/blob/016766cc89fabc10181453ce70b701dd8ed019f6/python/paddle/distributed/fleet/layers/mpu/mp_layers.py#L153) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/fairscale/fairscale.nn.model_parallel.layers.ColumnParallelLinear.md) | +| 413 | [fairscale.nn.model_parallel.layers.ParallelEmbedding](https://github.com/facebookresearch/fairscale/blob/164cc0f3170b4a3951dd84dda29c3e1504ac4d6e/fairscale/nn/model_parallel/layers.py#L152) | [paddle.distributed.fleet.meta_parallel.VocabParallelEmbedding](https://github.com/PaddlePaddle/Paddle/blob/016766cc89fabc10181453ce70b701dd8ed019f6/python/paddle/distributed/fleet/layers/mpu/mp_layers.py#L37) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/fairscale/fairscale.nn.model_parallel.layers.ParallelEmbedding.md) | +| 414 | [transformers.GenerationConfig](https://hf-mirror.com/docs/transformers/v4.42.0/en/main_classes/text_generation#transformers.GenerationConfig) | [paddlenlp.generation.GenerationConfig](https://github.com/PaddlePaddle/PaddleNLP/blob/e336e78c338d2514ee6c937982ce5d8c960b85ff/paddlenlp/generation/configuration_utils.py#L62) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.GenerationConfig.md) | +| 415 | [transformers.AddedToken](https://github.com/huggingface/transformers/blob/d625294d79341662784495551abdf45e6cb9372f/src/transformers/tokenization_utils_base.py#L84) | [paddlenlp.transformers.AddedToken](https://github.com/PaddlePaddle/PaddleNLP/blob/e336e78c338d2514ee6c937982ce5d8c960b85ff/paddlenlp/transformers/tokenizer_utils_base.py#L48) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.AddedToken.md) | +| 416 | [transformers.PretrainedConfig](https://hf-mirror.com/docs/transformers/v4.42.0/en/main_classes/configuration#transformers.PretrainedConfig) | [paddlenlp.transformers.PretrainedConfig](https://github.com/PaddlePaddle/PaddleNLP/blob/57000fa12ce67024238f0b56a6fde63c592c54ce/paddlenlp/transformers/configuration_utils.py#L317) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.PretrainedConfig.md) | ## 7. 输入参数用法不一致 **分类简介** 此类 API 对输入参数的处理方式不同。 + + + | 序号 | Pytorch 最新 release | Paddle develop | 备注 | |------|-------------------|---------------|------| | 1 | [torch.nn.functional.batch_norm](https://pytorch.org/docs/stable/generated/torch.nn.functional.batch_norm.html#torch.nn.functional.batch_norm) | [paddle.nn.functional.batch_norm](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/functional/batch_norm_cn.html#batch-norm) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.batch_norm.md) | @@ -1494,12 +1504,14 @@ model = paddle.nn.Softplus(beta=0.5, threshold=15) | 68 | [torchvision.datasets.VOCDetection](https://pytorch.org/vision/main/generated/torchvision.datasets.VOCDetection.html) | [paddle.vision.datasets.VOC2012](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/datasets/VOC2012_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.datasets.VOCDetection.md) | | 69 | [torchvision.ops.roi_pool](https://pytorch.org/vision/main/generated/torchvision.ops.roi_pool.html) | [paddle.vision.ops.roi_pool](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/ops/roi_pool_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.ops.roi_pool.md) | | 70 | [torchvision.datasets.FashionMNIST](https://pytorch.org/vision/main/generated/torchvision.datasets.FashionMNIST.html) | [paddle.vision.datasets.FashionMNIST](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/datasets/FashionMNIST_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.datasets.FashionMNIST.md) | - ## 8. 输入参数类型不一致 **分类简介** 此类 API 要求的输入数据类型不同。 + + + | 序号 | Pytorch 最新 release | Paddle develop | 备注 | |------|-------------------|---------------|------| | 1 | [torch.Tensor.cuda](https://pytorch.org/docs/stable/generated/torch.Tensor.cuda.html#torch.Tensor.cuda) | [paddle.Tensor.cuda](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#cuda-device-id-none-blocking-false) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.cuda.md) | @@ -1589,12 +1601,14 @@ model = paddle.nn.Softplus(beta=0.5, threshold=15) | 85 | [torchvision.models.mobilenet_v3_large](https://pytorch.org/vision/main/models/generated/torchvision.models.mobilenet_v3_large.html) | [paddle.vision.models.mobilenet_v3_large](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/models/mobilenet_v3_large_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.models.mobilenet_v3_large.md) | | 86 | [torchvision.models.mobilenet_v2](https://pytorch.org/vision/stable/models/generated/torchvision.models.mobilenet_v2.html) | [paddle.vision.models.mobilenet_v2](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/models/mobilenet_v2_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.models.mobilenet_v2.md) | | 87 | [torchvision.models.densenet121](https://pytorch.org/vision/main/models/generated/torchvision.models.densenet121.html) | [paddle.vision.models.densenet121](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/models/densenet121_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.models.densenet121.md) | - ## 9. 返回参数类型不一致 **分类简介** ​此类 API 返回值的类型或结构不同。 + + + | 序号 | Pytorch 最新 release | Paddle develop | 备注 | |------|-------------------|---------------|------| | 1 | [torch.sparse.sum](https://pytorch.org/docs/stable/generated/torch.sparse.sum.html?highlight=sparse+sum#torch.sparse.sum) | [paddle.sparse.sum](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/sparse/sum_cn.html#sum) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/sparse/torch.sparse.sum.md) | @@ -1626,12 +1640,14 @@ model = paddle.nn.Softplus(beta=0.5, threshold=15) | 27 | [torch.utils.data.default_collate](https://pytorch.org/docs/stable/data.html?highlight=default_collate#torch.utils.data.default_collate) | paddle.io.dataloader.collate.default_collate_fn | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/utils/torch.utils.data.default_collate.md) | | 28 | [transformers.PreTrainedModel.generate](https://github.com/huggingface/transformers/blob/0fdea8607d7e01eb0e38a1ebeb7feee30a22f0cf/src/transformers/generation/utils.py#L1567) | [paddlenlp.transformers.PreTrainedModel.generate](https://github.com/PaddlePaddle/PaddleNLP/blob/88d4b19bc6865fb28c11d2ce83d07c3b4b8dc423/paddlenlp/generation/utils.py#L604) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.PreTrainedModel.generate.md) | | 29 | [transformers.PreTrainedTokenizer.encode](https://hf-mirror.com/docs/transformers/v4.42.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizer.encode) | [paddlenlp.transformers.PreTrainedTokenizer.encode](https://github.com/PaddlePaddle/PaddleNLP/blob/88d4b19bc6865fb28c11d2ce83d07c3b4b8dc423/paddlenlp/transformers/tokenizer_utils_base.py#L2369) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.PreTrainedTokenizer.encode.md) | - ## 10. 组合替代实现 **分类简介** 此类功能在 PaddlePaddle 中没有直接对应的单一 API,需要通过多个 PaddlePaddle API 组合来实现。 + + + | 序号 | Pytorch 最新 release | Paddle develop | 备注 | |------|-------------------|---------------|------| | 1 | [torch.nn.functional.softmin](https://pytorch.org/docs/stable/generated/torch.nn.functional.softmin.html#torch.nn.functional.softmin) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.softmin.md) | @@ -1696,94 +1712,94 @@ model = paddle.nn.Softplus(beta=0.5, threshold=15) | 60 | [torch.optim.lr_scheduler.ExponentialLR](https://pytorch.org/docs/stable/generated/torch.optim.lr_scheduler.ExponentialLR.html) | [paddle.optimizer.lr.ExponentialDecay](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/lr/ExponentialDecay_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.lr_scheduler.ExponentialLR.md) | | 61 | [torch.optim.lr_scheduler.OneCycleLR](https://pytorch.org/docs/stable/generated/torch.optim.lr_scheduler.OneCycleLR.html) | [paddle.optimizer.lr.OneCycleLR](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/lr/OneCycleLR_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.lr_scheduler.OneCycleLR.md) | | 62 | [torch.optim.lr_scheduler.LinearLR](https://pytorch.org/docs/stable/generated/torch.optim.lr_scheduler.LinearLR.html) | [paddle.optimizer.lr.LinearLR](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/lr/LinearLR_cn.html#linearlr) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/optimizer/torch.optim.lr_scheduler.LinearLR.md) | -| 63 | torch.\_foreach_round_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_round_.md) | +| 63 | [torch._foreach_round_](https://pytorch.org/docs/stable/generated/torch._foreach_round_.html#torch-foreach-round) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_round_.md) | | 64 | [torch.Tensor.is_pinned](https://pytorch.org/docs/stable/generated/torch.Tensor.is_pinned.html?highlight=is_pinned#torch.Tensor.is_pinned) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.is_pinned.md) | | 65 | [torch.aminmax](https://pytorch.org/docs/stable/generated/torch.aminmax.html#torch.aminmax) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.aminmax.md) | | 66 | [torch.seed](https://pytorch.org/docs/stable/generated/torch.seed.html#torch.seed) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.seed.md) | -| 67 | torch.\_foreach_ceil_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_ceil_.md) | -| 68 | torch.\_foreach_frac_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_frac_.md) | -| 69 | torch.\_foreach_floor | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_floor.md) | +| 67 | [torch._foreach_ceil_](https://pytorch.org/docs/stable/generated/torch._foreach_ceil_.html#torch-foreach-ceil) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_ceil_.md) | +| 68 | [torch._foreach_frac_](https://pytorch.org/docs/stable/generated/torch._foreach_frac_.html#torch-foreach-frac) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_frac_.md) | +| 69 | [torch._foreach_floor](https://pytorch.org/docs/stable/generated/torch._foreach_floor.html) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_floor.md) | | 70 | [torch.set_num_interop_threads](https://pytorch.org/docs/stable/generated/torch.set_num_interop_threads.html) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.set_num_interop_threads.md) | | 71 | [torch.logdet](https://pytorch.org/docs/stable/generated/torch.logdet.html#torch.logdet) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.logdet.md) | -| 72 | torch.\_foreach_tan | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_tan.md) | -| 73 | torch.\_foreach_ceil | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_ceil.md) | -| 74 | torch.\_foreach_atan_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_atan_.md) | +| 72 | [torch._foreach_tan](https://pytorch.org/docs/stable/generated/torch._foreach_tan.html#torch-foreach-tan) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_tan.md) | +| 73 | [torch._foreach_ceil](https://pytorch.org/docs/stable/generated/torch._foreach_ceil.html#torch-foreach-ceil) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_ceil.md) | +| 74 | [torch._foreach_atan_](https://pytorch.org/docs/stable/generated/torch._foreach_atan_.html#torch-foreach-atan) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_atan_.md) | | 75 | [torch.narrow_copy](https://pytorch.org/docs/stable/generated/torch.narrow_copy.html#torch.narrow_copy) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.narrow_copy.md) | -| 76 | torch.\_foreach_log | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_log.md) | -| 77 | torch.\_foreach_sin | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_sin.md) | +| 76 | [torch._foreach_log](https://pytorch.org/docs/stable/generated/torch._foreach_log.html#torch-foreach-log) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_log.md) | +| 77 | [torch._foreach_sin](https://docs.pytorch.org/docs/stable/generated/torch._foreach_sin.html#torch-foreach-sin) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_sin.md) | | 78 | [torch.frombuffer](https://pytorch.org/docs/stable/generated/torch.frombuffer.html) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.frombuffer.md) | | 79 | [torch.histogram](https://pytorch.org/docs/stable/generated/torch.histogram.html#torch.histogram) | [paddle.histogram](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/histogram_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.histogram.md) | -| 80 | torch.\_foreach_log10 | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_log10.md) | -| 81 | torch.\_foreach_cos | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_cos.md) | +| 80 | [torch._foreach_log10](https://pytorch.org/docs/stable/generated/torch._foreach_log10.html#torch-foreach-log10) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_log10.md) | +| 81 | [torch._foreach_cos](https://pytorch.org/docs/stable/generated/torch._foreach_cos.html#torch-foreach-cos) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_cos.md) | | 82 | [torch.addcdiv](https://pytorch.org/docs/stable/generated/torch.addcdiv.html#torch.addcdiv) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.addcdiv.md) | -| 83 | torch.\_foreach_erf_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_erf_.md) | +| 83 | [torch._foreach_erf_](https://pytorch.org/docs/stable/generated/torch._foreach_erf_.html#torch-foreach-erf) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_erf_.md) | | 84 | [torch.var_mean](https://pytorch.org/docs/stable/generated/torch.var_mean.html?highlight=var_mean#torch.var_mean) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.var_mean.md) | | 85 | [torch.multiprocessing.cpu_count](https://github.com/pytorch/pytorch/blob/main/torch/multiprocessing/__init__.py) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.multiprocessing.cpu_count.md) | -| 86 | torch.\_foreach_sinh_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_sinh_.md) | +| 86 | [torch._foreach_sinh_](https://pytorch.org/docs/stable/generated/torch._foreach_sinh_.html#torch-foreach-sinh) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_sinh_.md) | | 87 | [torch.chain_matmul](https://pytorch.org/docs/stable/generated/torch.chain_matmul.html?highlight=chain_matmul#torch.chain_matmul) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.chain_matmul.md) | | 88 | [torch.get_num_threads](https://pytorch.org/docs/stable/generated/torch.get_num_threads.html) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.get_num_threads.md) | | 89 | [torch.set_num_threads](https://pytorch.org/docs/stable/generated/torch.set_num_threads.html) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.set_num_threads.md) | | 90 | [torch.adjoint](https://pytorch.org/docs/stable/generated/torch.adjoint.html#torch.adjoint) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.adjoint.md) | -| 91 | torch.\_foreach_expm1_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_expm1_.md) | +| 91 | [torch._foreach_expm1_](https://pytorch.org/docs/stable/generated/torch._foreach_expm1_.html) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_expm1_.md) | | 92 | [torch.std_mean](https://pytorch.org/docs/stable/generated/torch.std_mean.html?highlight=std_mean#torch.std_mean) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.std_mean.md) | | 93 | [torch.addcmul](https://pytorch.org/docs/stable/generated/torch.addcmul.html#torch.addcmul) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.addcmul.md) | -| 94 | torch.\_foreach_acos_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_acos_.md) | -| 95 | torch.\_foreach_reciprocal | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_reciprocal.md) | +| 94 | [torch._foreach_acos_](https://pytorch.org/docs/stable/generated/torch._foreach_acos_.html#torch-foreach-acos) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_acos_.md) | +| 95 | [torch._foreach_reciprocal](https://pytorch.org/docs/stable/generated/torch._foreach_reciprocal.html#torch-foreach-reciprocal) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_reciprocal.md) | | 96 | [torch.addmv](https://pytorch.org/docs/stable/generated/torch.addmv.html?highlight=addmv#torch.addmv) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.addmv.md) | -| 97 | torch.\_foreach_sigmoid | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_sigmoid.md) | -| 98 | torch.\_foreach_exp | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_exp.md) | +| 97 | [torch._foreach_sigmoid](https://pytorch.org/docs/stable/generated/torch._foreach_sigmoid.html#torch-foreach-sigmoid) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_sigmoid.md) | +| 98 | [torch._foreach_exp](https://pytorch.org/docs/stable/generated/torch._foreach_exp.html#torch-foreach-exp) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_exp.md) | | 99 | [torch.Generator](https://pytorch.org/docs/stable/generated/torch.Generator.html#generator) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.Generator.md) | | 100 | [torch.inference_mode](https://pytorch.org/docs/stable/generated/torch.inference_mode.html#torch.inference_mode) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.inference_mode.md) | | 101 | [torch._assert](https://pytorch.org/docs/stable/generated/torch._assert.html) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._assert.md) | -| 102 | torch.\_foreach_cosh | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_cosh.md) | -| 103 | torch.\_foreach_log2 | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_log2.md) | -| 104 | torch.\_foreach_asin | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_asin.md) | +| 102 | [torch._foreach_cosh](https://pytorch.org/docs/stable/generated/torch._foreach_cosh.html#torch-foreach-cosh) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_cosh.md) | +| 103 | [torch._foreach_log2](https://pytorch.org/docs/stable/generated/torch._foreach_log2.html#torch-foreach-log2) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_log2.md) | +| 104 | [torch._foreach_asin](https://pytorch.org/docs/stable/generated/torch._foreach_asin.html#torch-foreach-asin) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_asin.md) | | 105 | [torch.autograd.Variable](https://pytorch.org/docs/stable/autograd.html#variable-deprecated) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.autograd.Variable.md) | | 106 | [torch.device](https://pytorch.org/docs/stable/tensor_attributes.html#torch-device) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.device.md) | -| 107 | torch.\_foreach_erf | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_erf.md) | -| 108 | torch.\_foreach_cosh_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_cosh_.md) | -| 109 | torch.\_foreach_log1p_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_log1p_.md) | -| 110 | torch.\_foreach_sqrt | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_sqrt.md) | +| 107 | [torch._foreach_erf](https://pytorch.org/docs/stable/generated/torch._foreach_erf.html#torch-foreach-erf) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_erf.md) | +| 108 | [torch._foreach_cosh_](https://pytorch.org/docs/stable/generated/torch._foreach_cosh_.html#torch-foreach-cosh) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_cosh_.md) | +| 109 | [torch._foreach_log1p_](https://pytorch.org/docs/stable/generated/torch._foreach_log1p_.html#torch-foreach-log1p) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_log1p_.md) | +| 110 | [torch._foreach_sqrt](https://pytorch.org/docs/stable/generated/torch._foreach_sqrt.html#torch-foreach-sqrt) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_sqrt.md) | | 111 | [torch.detach](https://pytorch.org/docs/stable/autograd.html#variable-deprecated) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.detach.md) | -| 112 | torch.\_foreach_acos | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_acos.md) | +| 112 | [torch._foreach_acos](https://pytorch.org/docs/stable/generated/torch._foreach_acos.html#torch-foreach-acos) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_acos.md) | | 113 | [torch.index_copy](https://pytorch.org/docs/stable/generated/torch.index_copy.html#torch.index_copy) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.index_copy.md) | -| 114 | torch.\_foreach_lgamma_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_lgamma_.md) | -| 115 | torch.\_foreach_floor_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_floor_.md) | -| 116 | torch.\_foreach_sqrt_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_sqrt_.md) | -| 117 | torch.\_foreach_zero_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_zero_.md) | -| 118 | torch.\_foreach_erfc | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_erfc.md) | -| 119 | torch.\_foreach_abs | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_abs.md) | -| 120 | torch.\_foreach_cos_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_cos_.md) | +| 114 | [torch._foreach_lgamma_](https://pytorch.org/docs/stable/generated/torch._foreach_lgamma_.html#torch-foreach-lgamma) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_lgamma_.md) | +| 115 | [torch._foreach_floor_](https://pytorch.org/docs/stable/generated/torch._foreach_floor_.html#torch-foreach-floor) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_floor_.md) | +| 116 | [torch._foreach_sqrt_](https://docs.pytorch.org/docs/stable/generated/torch._foreach_sqrt_.html#torch-foreach-sqrt) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_sqrt_.md) | +| 117 | [torch._foreach_zero_](https://pytorch.org/docs/stable/generated/torch._foreach_zero_.html#torch-foreach-zero) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_zero_.md) | +| 118 | [torch._foreach_erfc](https://pytorch.org/docs/stable/generated/torch._foreach_erfc.html#torch-foreach-erfc) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_erfc.md) | +| 119 | [torch._foreach_abs](https://pytorch.org/docs/stable/generated/torch._foreach_abs.html#torch-foreach-abs) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_abs.md) | +| 120 | [torch._foreach_cos_](https://pytorch.org/docs/stable/generated/torch._foreach_cos_.html#torch-foreach-cos) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_cos_.md) | | 121 | [torch.addr](https://pytorch.org/docs/stable/generated/torch.addr.html?highlight=addr#torch.addr) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.addr.md) | -| 122 | torch.\_foreach_sin_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_sin_.md) | +| 122 | [torch._foreach_sin_](https://pytorch.org/docs/stable/generated/torch._foreach_sin_.html#torch-foreach-sin) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_sin_.md) | | 123 | [torch.addbmm](https://pytorch.org/docs/stable/generated/torch.addbmm.html#torch.addbmm) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.addbmm.md) | -| 124 | torch.\_foreach_exp_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_exp_.md) | +| 124 | [torch._foreach_exp_](https://pytorch.org/docs/stable/generated/torch._foreach_exp_.html#torch._foreach_exp_) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_exp_.md) | | 125 | [torch.initial_seed](https://pytorch.org/docs/stable/generated/torch.initial_seed.html?highlight=initial_seed) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.initial_seed.md) | -| 126 | torch.\_foreach_neg_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_neg_.md) | +| 126 | [torch._foreach_neg_](https://pytorch.org/docs/stable/generated/torch._foreach_neg_.html#torch-foreach-neg) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_neg_.md) | | 127 | [torch.can_cast](https://pytorch.org/docs/stable/generated/torch.can_cast.html#torch-can-cast) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.can_cast.md) | -| 128 | torch.\_foreach_asin_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_asin_.md) | -| 129 | torch.\_foreach_abs_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_abs_.md) | -| 130 | torch.\_foreach_atan | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_atan.md) | -| 131 | torch.\_foreach_trunc | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_trunc.md) | -| 132 | torch.\_foreach_sinh | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_sinh.md) | -| 133 | torch.\_foreach_sigmoid_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_sigmoid_.md) | -| 134 | torch.\_foreach_frac | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_frac.md) | -| 135 | torch.\_foreach_lgamma | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_lgamma.md) | -| 136 | torch.\_foreach_log2_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_log2_.md) | -| 137 | torch.\_foreach_neg | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_neg.md) | +| 128 | [torch._foreach_asin_](https://pytorch.org/docs/stable/generated/torch._foreach_asin_.html#torch-foreach-asin) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_asin_.md) | +| 129 | [torch._foreach_abs_](https://pytorch.org/docs/stable/generated/torch._foreach_abs_.html#torch-foreach-abs) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_abs_.md) | +| 130 | [torch._foreach_atan](https://pytorch.org/docs/stable/generated/torch._foreach_atan.html#torch-foreach-atan) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_atan.md) | +| 131 | [torch._foreach_trunc](https://pytorch.org/docs/stable/generated/torch._foreach_trunc.html#torch-foreach-trunc) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_trunc.md) | +| 132 | [torch._foreach_sinh](https://pytorch.org/docs/stable/generated/torch._foreach_sinh.html#torch-foreach-sinh) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_sinh.md) | +| 133 | [torch._foreach_sigmoid_](https://pytorch.org/docs/stable/generated/torch._foreach_sigmoid_.html#torch-foreach-sigmoid) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_sigmoid_.md) | +| 134 | [torch._foreach_frac](https://pytorch.org/docs/stable/generated/torch._foreach_frac.html#torch-foreach-frac) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_frac.md) | +| 135 | [torch._foreach_lgamma](https://pytorch.org/docs/stable/generated/torch._foreach_lgamma.html#torch-foreach-lgamma) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_lgamma.md) | +| 136 | [torch._foreach_log2_](https://pytorch.org/docs/stable/generated/torch._foreach_log2_.html#torch-foreach-log2) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_log2_.md) | +| 137 | [torch._foreach_neg](https://pytorch.org/docs/stable/generated/torch._foreach_neg.html#torch-foreach-neg) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_neg.md) | | 138 | [torch.select](https://pytorch.org/docs/stable/generated/torch.select.html#torch.select) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.select.md) | | 139 | [torch.logaddexp2](https://pytorch.org/docs/stable/generated/torch.logaddexp2.html#torch.logaddexp2) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.logaddexp2.md) | -| 140 | torch.\_foreach_log1p | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_log1p.md) | +| 140 | [torch._foreach_log1p](https://pytorch.org/docs/stable/generated/torch._foreach_log1p.html#torch-foreach-log1p) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_log1p.md) | | 141 | [torch.is_nonzero](https://pytorch.org/docs/stable/generated/torch.is_nonzero.html#torch.is_nonzero) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.is_nonzero.md) | -| 142 | torch.\_foreach_tan_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_tan_.md) | -| 143 | torch.\_foreach_log10_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_log10_.md) | -| 144 | torch.\_foreach_trunc_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_trunc_.md) | +| 142 | [torch._foreach_tan_](https://pytorch.org/docs/stable/generated/torch._foreach_tan_.html#torch-foreach-tan) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_tan_.md) | +| 143 | [torch._foreach_log10_](https://pytorch.org/docs/stable/generated/torch._foreach_log10_.html#torch-foreach-log10) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_log10_.md) | +| 144 | [torch._foreach_trunc_](https://pytorch.org/docs/stable/generated/torch._foreach_trunc_.html#torch-foreach-trunc) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_trunc_.md) | | 145 | [torch.get_num_interop_threads](https://pytorch.org/docs/stable/generated/torch.get_num_interop_threads.html) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.get_num_interop_threads.md) | -| 146 | torch.\_foreach_log_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_log_.md) | -| 147 | torch.\_foreach_erfc_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_erfc_.md) | -| 148 | torch.\_foreach_expm1 | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_expm1.md) | -| 149 | torch.\_foreach_round | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_round.md) | -| 150 | torch.\_foreach_reciprocal_ | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_reciprocal_.md) | +| 146 | [torch._foreach_log_](https://pytorch.org/docs/stable/generated/torch._foreach_log_.html#torch-foreach-log) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_log_.md) | +| 147 | [torch._foreach_erfc_](https://pytorch.org/docs/stable/generated/torch._foreach_erfc_.html#torch-foreach-erfc) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_erfc_.md) | +| 148 | [torch._foreach_expm1](https://pytorch.org/docs/stable/generated/torch._foreach_expm1.html#torch-foreach-expm1) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_expm1.md) | +| 149 | [torch._foreach_round](https://pytorch.org/docs/stable/generated/torch._foreach_round.html#torch-foreach-round) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_round.md) | +| 150 | [torch._foreach_reciprocal_](https://pytorch.org/docs/stable/generated/torch._foreach_reciprocal_.html#torch-foreach-reciprocal) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch._foreach_reciprocal_.md) | | 151 | [torch.float_power](https://pytorch.org/docs/stable/generated/torch.float_power.html#torch-float-power) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.float_power.md) | | 152 | [torch.cuda.set_per_process_memory_fraction](https://pytorch.org/docs/stable/generated/torch.cuda.set_per_process_memory_fraction.html) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/cuda/torch.cuda.set_per_process_memory_fraction.md) | | 153 | [torch.cuda.initial_seed](https://pytorch.org/docs/stable/generated/torch.cuda.initial_seed.html?highlight=torch+cuda+initial_seed#torch.cuda.initial_seed) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/cuda/torch.cuda.initial_seed.md) | @@ -1806,7 +1822,6 @@ model = paddle.nn.Softplus(beta=0.5, threshold=15) | 170 | [transformers.PreTrainedModel](https://hf-mirror.com/docs/transformers/v4.42.0/en/main_classes/model#transformers.PreTrainedModel) | [paddlenlp.transformers.PreTrainedModel](https://github.com/PaddlePaddle/PaddleNLP/blob/e336e78c338d2514ee6c937982ce5d8c960b85ff/paddlenlp/transformers/model_utils.py#L843) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.PreTrainedModel.md) | | 171 | [transformers.logging.get_logger](https://github.com/huggingface/transformers/blob/d625294d79341662784495551abdf45e6cb9372f/src/transformers/utils/logging.py#L147) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.logging.get_logger.md) | | 172 | [transformers.PreTrainedModel.post_init](https://hf-mirror.com/docs/transformers/v4.42.0/en/main_classes/model#transformers.PreTrainedModel.post_init) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.PreTrainedModel.post_init.md) | - ## 11. 可删除 **分类简介** @@ -1821,6 +1836,9 @@ model = paddle.nn.Softplus(beta=0.5, threshold=15) 此类 PyTorch API 的功能在 PaddlePaddle 中暂时没有等效实现。 + + + | 序号 | Pytorch 最新 release | Paddle develop | 备注 | |------|-------------------|---------------|------| | 1 | [torch.Tensor.int_repr](https://pytorch.org/docs/stable/generated/torch.Tensor.int_repr.html#torch.Tensor.int_repr) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.int_repr.md) | diff --git a/docs/guides/model_convert/convert_from_pytorch/tools/.gitignore b/docs/guides/model_convert/convert_from_pytorch/tools/.gitignore index 446cce8f6f5..115f65ed16e 100644 --- a/docs/guides/model_convert/convert_from_pytorch/tools/.gitignore +++ b/docs/guides/model_convert/convert_from_pytorch/tools/.gitignore @@ -1,6 +1,7 @@ # temp files used locally alias_macro_lines.tmp.md generated.tmp.md +tmp_check.md # files will be used in PaConvert docs_mappings.json @@ -10,3 +11,12 @@ api_alias_mapping.json # log files alias_refer_failed.log + +# from paconvert +api_mapping.json +no_need_convert.txt + +# validate warning info +toc_warnings.txt +unique_warnings.txt +link_warnings.txt diff --git a/docs/guides/model_convert/convert_from_pytorch/tools/generate_mapping_files.py b/docs/guides/model_convert/convert_from_pytorch/tools/generate_mapping_files.py new file mode 100644 index 00000000000..dc57afc29d4 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/tools/generate_mapping_files.py @@ -0,0 +1,583 @@ +import argparse +import json +import os +import re +from collections import defaultdict + + +def get_base_dir(): + """ + 动态获取基础目录路径,确保代码可在任意位置执行 + """ + current_script_path = os.path.abspath(__file__) + tools_dir = os.path.dirname(current_script_path) + base_dir = os.path.dirname(tools_dir) # 上一级目录 + return base_dir + + +def parse_md_files(directories): + """ + 递归扫描目录中的所有.md文件,解析第一行获取类别和API名称 + 忽略标题中的序号(如"1. "),只提取纯类别名称 + """ + category_api_map = defaultdict(list) + + for directory in directories: + for root, _, files in os.walk(directory): + for file in files: + if file.endswith(".md"): + md_path = os.path.join(root, file) + try: + with open(md_path, "r", encoding="utf-8") as f: + first_line = f.readline().strip() + + # 解析第一行格式:## [类别]API名称,忽略可能存在的序号 + match = re.match( + r"##\s*\d*\.?\s*\[(.*?)\](.*)", first_line + ) + if match: + category = match.group(1).strip() + api_name = match.group(2).strip() + # 只处理3-12类,前两类从主文档表格中提取 + if category not in [ + "API 完全一致", + "仅 API 调用方式不一致", + ]: + category_api_map[category].append( + { + "api_name": api_name.replace( + r"\_", "_" + ), + "file_path": md_path, + } + ) + else: + print( + f"警告: 无法解析文件 {md_path} 的第一行: {first_line}" + ) + except Exception as e: + print(f"错误: 读取文件 {md_path} 时出错: {e!s}") + + return category_api_map + + +def load_mapping_json(json_path): + """ + 加载docs_mapping.json文件 + """ + try: + with open(json_path, "r", encoding="utf-8") as f: + return json.load(f) + except Exception as e: + print(f"错误: 读取JSON文件 {json_path} 时出错: {e!s}") + return [] + + +def convert_to_github_url(local_path, base_dir): + """ + 将本地文件路径转换为GitHub URL + """ + # 查找convert_from_pytorch在路径中的位置 + pattern = r".*(docs/guides/model_convert/convert_from_pytorch/.*)" + match = re.search(pattern, local_path) + if match: + relative_path = match.group(1) + return ( + f"https://github.com/PaddlePaddle/docs/tree/develop/{relative_path}" + ) + + # 如果正则匹配失败,尝试基于基础目录构建相对路径 + try: + relative_path = os.path.relpath(local_path, base_dir) + return f"https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/{relative_path}" + except: + return "" + + +def get_mapping_doc_url(torch_api, base_dir): + """ + 根据torch_api名称,递归查找对应的差异对比文档,并返回Markdown格式的超链接字符串。 + """ + mapping_url_head = "https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/" + + # 定义两个可能的文档目录路径 + api_difference_dirs = [ + os.path.join(base_dir, "api_difference"), + os.path.join(base_dir, "api_difference_third_party"), + ] + + # 将torch_api中的特殊字符转换为下划线,并添加.md后缀,构成文件名 + expected_filename = f"{torch_api}.md" + + for search_dir in api_difference_dirs: + for root, dirs, files in os.walk(search_dir): + if expected_filename in files: + relative_path = os.path.relpath( + os.path.join(root, expected_filename), base_dir + ) + full_url = mapping_url_head + relative_path.replace(os.sep, "/") + return f"[差异对比]({full_url})" + + return "-" + + +def parse_special_category_apis(md_content, category): + """ + 从主MD文档中解析特殊类别(API完全一致、仅API调用方式不一致)的API + 返回该类别中所有Torch API的集合 + """ + apis = set() + lines = md_content.split("\n") + in_target_section = False + in_table = False + + for line in lines: + # 检查是否进入目标类别部分 + if re.match(rf"## \d*\.?\s*{re.escape(category)}", line): + in_target_section = True + continue + + # 如果已在目标部分,检查是否进入表格 + if in_target_section: + if re.match(r"\| 序号 \|", line): + in_table = True + continue + + # 检查是否离开目标部分 + if re.match(r"## \d*\.?\s*", line) and not re.match( + rf"## \d*\.?\s*{re.escape(category)}", line + ): + break + + # 处理表格行 + if in_table and re.match(r"\| \d+ \|", line): + parts = line.split("|") + if len(parts) >= 3: + api_cell = parts[2].strip() # 第三列是Torch API + # 提取API名称(处理超链接) + api_match = re.match(r"\[(.*?)\]\(.*?\)", api_cell) + api_name = api_match.group(1) if api_match else api_cell + if api_name: + apis.add(api_name) + + return apis + + +def generate_category1_table( + docs_mapping, no_need_convert_file_path, base_dir, existing_apis +): + """ + 生成类别1(API完全一致)的Markdown表格 + """ + white_list = [ + "torch.Tensor.imag", + "torch.Tensor.is_coalesced", + "torch.Tensor.is_sparse", + "torch.Tensor.is_sparse_csr", + "torch.Tensor.logical_not_", + "torch.Tensor.real", + "torch.iinfo", + "torch.nn.utils.clip_grad_norm_", + "torch.nn.utils.clip_grad_value_", + ] + + # 读取no_need_convert.txt文件,获取无需转换的API列表 + with open(no_need_convert_file_path, "r", encoding="utf-8") as f: + no_need_convert_list = [line.strip() for line in f if line.strip()] + + rows = [] # 存储表格行数据的列表 + used_apis = set() # 用于记录已处理的API,避免重复 + + # 处理no_need_convert_list中的每个Torch API + for torch_api in no_need_convert_list: + if "__" in torch_api: + torch_api = torch_api.replace("_", r"\_") + if torch_api in used_apis: + continue + paddle_api = torch_api.replace("torch", "paddle") + used_apis.add(torch_api) # 标记该API已处理 + existing_apis.add(torch_api) + + # 在docs_mapping中查找当前torch_api对应的信息 + mapping_info = docs_mapping.get(torch_api, {}) + src_url = mapping_info.get("src_api_url") if mapping_info else None + + # 查找对应的paddle_api映射信息(可能需要遍历所有值) + dst_url = None + for item in docs_mapping.values(): + if item.get("dst_api") == paddle_api: + dst_url = item.get("dst_api_url") + break + + # 构建第二列和第三列的字符串内容,包含URL(如果存在) + col2 = f"[{torch_api}]({src_url})" if src_url else torch_api + col3 = f"[{paddle_api}]({dst_url})" if dst_url else paddle_api + rows.append((torch_api, col2, col3, "-")) + + # 遍历docs_mapping,查找满足条件的额外API对 + for src_api, item in docs_mapping.items(): + mapping_type = item.get("mapping_type", "") + dst_api = item.get("dst_api", "") + + # 检查条件:mapping_type为"无参数"或"参数完全一致",且src_api以"torch"开头,替换后与dst_api相同,且不在no_need_convert_list中 + if (mapping_type in ["无参数", "参数完全一致"]) and src_api.startswith( + "torch" + ): + expected_paddle_api = src_api.replace("torch", "paddle") + if "__" in src_api: + src_api = src_api.replace("_", r"\_") + dst_api = dst_api.replace("_", r"\_") + if ( + expected_paddle_api == dst_api + and src_api not in used_apis + and src_api not in white_list + ): + used_apis.add(src_api) # 标记该API已处理 + existing_apis.add(src_api) + + src_url = item.get("src_api_url") + dst_url = item.get("dst_api_url") + + col2 = f"[{src_api}]({src_url})" if src_url else src_api + col3 = f"[{dst_api}]({dst_url})" if dst_url else dst_api + rows.append((src_api, col2, col3, "-")) + + # 生成Markdown表格字符串 + table_lines = [ + "| 序号 | Pytorch 最新 release | Paddle develop | 备注 |", + "|------|-------------------|---------------|------|", + ] + + for idx, (_, col2, col3, remark) in enumerate(rows, start=1): + table_lines.append(f"| {idx} | {col2} | {col3} | {remark} |") + + return "\n".join(table_lines) + + +def generate_category2_table( + docs_mapping, + api_mapping_file_path, + no_need_convert_file_path, + base_dir, + existing_apis, +): + """ + 生成类别2(仅API调用方式不一致)的Markdown表格 + """ + whitelist_skip = [ + "torch.Tensor.numel", + "torch.Tensor.nelement", + "torch.Tensor.is_inference", + "torch.numel", + "torch.is_inference", + "torch.ge", + "torch.utils.data.WeightedRandomSampler", + "torch.utils.data.RandomSampler", + ] + + # 读取no_need_convert.txt文件,获取无需转换的API列表 + with open(no_need_convert_file_path, "r", encoding="utf-8") as f: + no_need_convert_list = [line.strip() for line in f if line.strip()] + + # 加载api_mapping.json文件 + with open(api_mapping_file_path, "r", encoding="utf-8") as f: + api_mapping_data = json.load(f) + + rows = [] # 存储表格行数据的列表 + used_apis = set() # 用于记录已处理的API,避免重复 + + # 处理api_mapping中Matcher为"UnchangeMatcher"且不在no_need_convert_list中的API + for src_api, mapping_info in api_mapping_data.items(): + if src_api in whitelist_skip or src_api in no_need_convert_list: + continue + matcher = mapping_info.get("Matcher", "") + if matcher == "UnchangeMatcher": + # 在docs_mapping中查找当前src_api对应的信息 + docs_mapping_info = docs_mapping.get(src_api, {}) + src_url = docs_mapping_info.get("src_api_url") + + # 获取paddle_api,可能来自api_mapping或docs_mapping + paddle_api = mapping_info.get("paddle_api") + if not paddle_api: + paddle_api = docs_mapping_info.get("dst_api", "") + + # 查找paddle_api对应的dst_api_url(可能需要遍历docs_mapping的值) + dst_url = None + for item in docs_mapping.values(): + if item.get("dst_api") == paddle_api: + dst_url = item.get("dst_api_url") + break + + # 构建第二列和第三列的字符串内容,包含URL(如果存在) + col2 = f"[{src_api}]({src_url})" if src_url else src_api + col3 = f"[{paddle_api}]({dst_url})" if dst_url else paddle_api + + # 生成备注列的超链接 + remark_link = get_mapping_doc_url(src_api, base_dir) + rows.append((src_api, col2, col3, remark_link)) + used_apis.add(src_api) # 标记该API已处理 + existing_apis.add(src_api) + + # 遍历docs_mapping,查找mapping_type为"无参数"或"参数完全一致",且src_api替换后与dst_api不等的API + for src_api, item in docs_mapping.items(): + mapping_type = item.get("mapping_type", "") + dst_api = item.get("dst_api", "") + if ( + src_api in whitelist_skip + or src_api in no_need_convert_list + or src_api in used_apis + ): + continue + # 检查条件:mapping_type为"无参数"或"参数完全一致",src_api包含"torch",替换后与dst_api不等 + if (mapping_type in ["无参数", "参数完全一致"]) and "torch" in src_api: + expected_paddle_api = src_api.replace("torch", "paddle") + if expected_paddle_api != dst_api: + used_apis.add(src_api) # 标记该API已处理 + existing_apis.add(src_api) + + src_url = item.get("src_api_url") + dst_url = item.get("dst_api_url") + + col2 = f"[{src_api}]({src_url})" if src_url else src_api + col3 = f"[{dst_api}]({dst_url})" if dst_url else dst_api + + # 生成备注列的超链接 + remark_link = get_mapping_doc_url(src_api, base_dir) + rows.append((src_api, col2, col3, remark_link)) + + # 生成Markdown表格字符串 + table_lines = [ + "| 序号 | Pytorch 最新 release | Paddle develop | 备注 |", + "|------|-------------------|---------------|------|", + ] + + for idx, (_, col2, col3, remark) in enumerate(rows, start=1): + table_lines.append(f"| {idx} | {col2} | {col3} | {remark} |") + + return "\n".join(table_lines) + + +def update_mapping_table( + md_content, category, api_list, mapping_data, existing_apis, base_dir +): + """ + 更新指定类别的映射表格,过滤掉未找到对应Paddle API的条目和重复API。 + """ + # 构建API名称到映射数据的字典 + api_mapping_dict = {} + for item in mapping_data: + src_api = item.get("src_api", "") + api_mapping_dict[src_api] = { + "dst_api": item.get("dst_api", ""), + "src_api_url": item.get("src_api_url", ""), + "dst_api_url": item.get("dst_api_url", ""), + "source_file": item.get("source_file", ""), + } + + # 生成表格行:仅处理能找到对应Paddle API且未重复的条目 + table_rows = [] + valid_idx = 1 # 有效序号计数器 + for api_info in api_list: + api_name = api_info["api_name"] + api_md = api_info["file_path"] + + # 检查API是否已在前两个特殊类别中存在 + if api_name in existing_apis: + continue + + mapping_info = api_mapping_dict.get(api_name, {}) + dst_api = mapping_info.get("dst_api", "-") + + if dst_api == "暂无" or not dst_api: + dst_api = "-" + + # 获取URL信息 + src_api_url = mapping_info.get("src_api_url", "") + dst_api_url = mapping_info.get("dst_api_url", "") + github_url = convert_to_github_url(api_md, base_dir) + + # 创建Torch API超链接 + torch_display = ( + f"[{api_name}]({src_api_url})" if src_api_url else api_name + ) + + # 创建Paddle API超链接 + paddle_display = ( + f"[{dst_api}]({dst_api_url})" if dst_api_url else dst_api + ) + + # 创建备注列内容 + remark = f"[差异对比]({github_url})" if github_url else "-" + + # 添加表格行,并使用有效序号 + table_rows.append( + f"| {valid_idx} | {torch_display} | {paddle_display} | {remark} |" + ) + valid_idx += 1 # 序号递增 + + # 构建完整的表格内容 + if table_rows: # 如果存在有效行 + table_content = [ + "| 序号 | Pytorch 最新 release | Paddle develop | 备注 |", + "|------|-------------------|---------------|------|", + *table_rows, + ] + else: + table_content = [ + "| 序号 | Pytorch 最新 release | Paddle develop | 备注 |", + "|------|-------------------|---------------|------|", + "\n新增中......", + ] + + table_content_str = "\n".join(table_content) + + # 替换原内容中的表格(考虑可能有序号的标题) + # 添加额外的换行符确保格式正确 + pattern = rf"(## \d*\.?\s*{re.escape(category)}[\s\S]*?)(\| 序号 \| Pytorch 最新 release \| Paddle develop \| 备注 \|\n\|[-\| ]+\|\n)[\s\S]*?(?=## \d*\.?\s*|\Z)" + replacement = rf"\1{table_content_str}\n" + return re.sub(pattern, replacement, md_content, flags=re.MULTILINE) + + +def add_category_numbers(md_content, all_categories): + """ + 为所有类别标题添加序号(1~12) + 如果标题已有序号,会先移除旧序号再添加新序号 + """ + updated_content = md_content + for idx, category in enumerate(all_categories, 1): + # 先移除可能存在的旧序号 + pattern = rf"## \d*\.?\s*{re.escape(category)}" + replacement = f"## {idx}. {category}" + updated_content = re.sub(pattern, replacement, updated_content) + return updated_content + + +def update_special_category_table(md_content, category, table_content): + """ + 更新特殊类别(1和2)的表格内容 + """ + # 更精确的正则表达式,确保只匹配特定类别的表格 + pattern = rf"(## \d*\.?\s*{re.escape(category)}[\s\S]*?)(\| 序号 \| Pytorch 最新 release \| Paddle develop \| 备注 \|\n\|[-\| ]+\|\n)[\s\S]*?(?=## \d*\.?\s*|\Z)" + # 替换为:标题 + 新表格内容 + replacement = rf"\1\n{table_content}\n" + return re.sub(pattern, replacement, md_content, flags=re.MULTILINE) + + +def main(): + parser = argparse.ArgumentParser( + description="更新PyTorch到PaddlePaddle API映射文档" + ) + parser.add_argument( + "--check", action="store_true", help="检查模式,输出到临时文件" + ) + args = parser.parse_args() + + # 获取基础目录 + base_dir = get_base_dir() + + # 定义路径 + md_file_path = os.path.join(base_dir, "pytorch_api_mapping_cn.md") + json_file_path = os.path.join( + os.path.dirname(__file__), "docs_mappings.json" + ) + no_need_convert_path = os.path.join( + os.path.dirname(__file__), "no_need_convert.txt" + ) + api_mapping_path = os.path.join( + os.path.dirname(__file__), "api_mapping.json" + ) + + api_dirs = [ + os.path.join(base_dir, "api_difference"), + os.path.join(base_dir, "api_difference_third_party"), + ] + + # 读取原始MD文件 + try: + with open(md_file_path, "r", encoding="utf-8") as f: + original_content = f.read() + except Exception as e: + print(f"错误: 读取Markdown文件 {md_file_path} 时出错: {e!s}") + return + + # 加载映射JSON数据 + mapping_data = load_mapping_json(json_file_path) + docs_mapping = ( + {item["src_api"]: item for item in mapping_data} if mapping_data else {} + ) + + # 定义所有可能的类别(12个类别) + all_categories = [ + "API 完全一致", # 序号1 + "仅 API 调用方式不一致", # 序号2 + "仅参数名不一致", # 序号3 + "paddle 参数更多", # 序号4 + "参数默认值不一致", # 序号5 + "torch 参数更多", # 序号6 + "输入参数用法不一致", # 序号7 + "输入参数类型不一致", # 序号8 + "返回参数类型不一致", # 序号9 + "组合替代实现", # 序号10 + "可删除", # 序号11 + "功能缺失", # 序号12 + ] + + # 为所有类别标题添加序号(1~12) + updated_content = add_category_numbers(original_content, all_categories) + + # 生成类别1和类别2的表格 + existing_apis = set() + category1_table = generate_category1_table( + docs_mapping, no_need_convert_path, base_dir, existing_apis + ) + category2_table = generate_category2_table( + docs_mapping, + api_mapping_path, + no_need_convert_path, + base_dir, + existing_apis, + ) + + updated_content = update_special_category_table( + updated_content, "API 完全一致", category1_table + ) + updated_content = update_special_category_table( + updated_content, "仅 API 调用方式不一致", category2_table + ) + + print( + f"信息: 从前两个特殊类别中总共解析出 {len(existing_apis)} 个API用于重复检查" + ) + + # 解析MD文件获取类别和API信息(3-12类) + category_api_map = parse_md_files(api_dirs) + + # 更新内容(只处理3-12类) + for idx, category in enumerate(all_categories, 1): + if idx >= 3 and category in category_api_map: # 只处理3-12类 + updated_content = update_mapping_table( + updated_content, + category, + category_api_map[category], + mapping_data, + existing_apis, + base_dir, + ) + + # 确定输出文件 + if args.check: + output_file = os.path.join(os.path.dirname(__file__), "tmp_check.md") + else: + output_file = md_file_path + + # 写入更新后的内容 + try: + with open(output_file, "w", encoding="utf-8") as f: + f.write(updated_content) + print(f"成功: 文档已更新到 {output_file}") + except Exception as e: + print(f"错误: 写入文件 {output_file} 时出错: {e!s}") + + +if __name__ == "__main__": + main() diff --git a/docs/guides/model_convert/convert_from_pytorch/tools/get_docs_mappings.py b/docs/guides/model_convert/convert_from_pytorch/tools/get_docs_mappings.py new file mode 100644 index 00000000000..f57bfafe6b9 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/tools/get_docs_mappings.py @@ -0,0 +1,780 @@ +from __future__ import annotations + +import collections +import json +import os +import re +import sys +import traceback +import urllib +import urllib.parse +from enum import IntEnum +from typing import TypedDict + +PADDLE_DOCS_BASE_URL = "https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/" + +validate_whitelist = [] + +mapping_type_levels = [ + # type 0 + ["UNDEFINED_MAPPING_TYPE_0"], + # type 1 + [ + "无参数", + "参数完全一致", + "仅参数名不一致", + "paddle 参数更多", + "参数默认值不一致", + ], + # type 2 + [ + "torch 参数更多", + ], + # type 3 + [ + "返回参数类型不一致", + "输入参数类型不一致", + "输入参数用法不一致", + ], + # type 4 + [ + "组合替代实现", + ], + # type 5 + [ + "涉及上下文修改", + ], + # type 6 + [ + "对应 API 不在主框架", + ], + # type 7 + [ + "功能缺失", + ], + # delete + [ + "可删除", + ], +] + +mapping_type_set = {t for ts in mapping_type_levels for t in ts} +mapping_type_to_level = { + t: level for level, ts in enumerate(mapping_type_levels) for t in ts +} + + +class DiffMeta(TypedDict): + src_api: str + src_api_url: str | None + src_signature: str | None + dst_api: str | None + dst_api_url: str | None + dst_signature: str | None + args_mapping: list[dict[str, str]] | None + mapping_type: str + source_file: str + + +class IndexParserState(IntEnum): + error = -1 + normal = 0 + table_sep = 1 + table_row = 2 + table_sep_ignore = 3 + table_row_ignore = 4 + + +class ParserState(IntEnum): + wait_for_title = 0 + + wait_for_src_api = 1 + wait_for_src_signature_begin = 2 + wait_for_src_signature = 3 + wait_for_src_signature_end = 4 + + wait_for_dst_api = 5 + wait_for_dst_signature_begin = 6 + wait_for_dst_signature = 7 + wait_for_dst_signature_end = 8 + + wait_for_args = 9 + wait_for_args_table_title = 10 + wait_for_args_table_sep = 11 + wait_for_args_table_end = 12 + + end = 13 + + +def unescape_api(api): + return api.replace(r"\_", "_") + + +def split_args(args_str): + """ + 按逗号分割参数字符串,忽略括号内的逗号 + """ + args = [] + current = [] + stack = [] + brackets = {"(": ")", "[": "]", "{": "}"} + closing = {v: k for k, v in brackets.items()} + + for char in args_str: + if char in brackets: + stack.append(brackets[char]) + elif char in closing: + if stack and stack[-1] == char: + stack.pop() + else: + raise ValueError(f"Unmatched closing bracket: {char}") + elif char == "," and not stack: + arg = "".join(current).strip() + if arg: + args.append(arg) + current = [] + continue + current.append(char) + + arg = "".join(current).strip() + if arg: + args.append(arg) + return args + + +def split_signatures(buffer): + """ + 分割包含多个函数签名的字符串 + """ + signatures = [] + current = [] + stack = [] + brackets = {"(": ")", "[": "]", "{": "}"} + closing = {v: k for k, v in brackets.items()} + + for char in buffer: + if char in brackets: + stack.append(brackets[char]) + elif char in closing: + if stack and stack[-1] == char: + stack.pop() + else: + raise ValueError(f"Unmatched closing bracket: {char}") + current.append(char) + if char == ")" and not stack: + # End of a function signature + signature = "".join(current).strip() + signatures.append(signature) + current = [] + + if current: + signatures.append("".join(current).strip()) + + return signatures + + +def reformat_signature(code): + """ + 从函数签名代码中解析出函数名和参数列表 + - code: 函数签名代码,可能包含多个函数声明 + - 返回值: 包含所有函数名和参数列表的列表 + """ + lines = [l for l in code.split("\n") if len(l.strip()) > 0] + assert len(lines) > 0, "code have no lines." + buffer = "".join([l.strip() for l in lines]) + + signatures = split_signatures(buffer) + + parsed_signatures = [] + + arg_pattern = re.compile( + r"^(?P[^\=\:]+)" # 参数名 + r"(?:\s*\:\s*(?P[^=]+))?" # 可选的类型注解 + r"(?:\s*\=\s*(?P.+))?$" # 可选的默认值 + ) + + for sig in signatures: + first_par_pos = sig.find("(") + m = re.match(r"^\s*(?P[^\( ]+)(.*?)$", sig) + assert m is not None, f'code first line "{sig}" not match api pattern.' + api_name = m.group("api_name") + + if first_par_pos < 0: + # 要是没括号,可能是特殊情况,比如 property + parsed_signatures.append({"api_name": api_name}) + continue + + last_par_pos = sig.rfind(")") + assert last_par_pos > first_par_pos, ( + f'code first line "{sig}" not match api pattern.' + ) + args_buffer = sig[first_par_pos + 1 : last_par_pos] + + args = [] + args_buffer = args_buffer.strip() + + arg_buffer_list = split_args(args_buffer) + + for arg_buffer in arg_buffer_list: + m = arg_pattern.match(arg_buffer) + assert m is not None, ( + f'code arg "{arg_buffer}" not match arg pattern.' + ) + arg_name = m.group("arg_name").strip() + arg_type = ( + m.group("arg_type").strip() if m.group("arg_type") else None + ) + arg_default = ( + m.group("arg_default").strip() + if m.group("arg_default") + else None + ) + + if ( + arg_name.startswith("*") + or arg_name.startswith("**") + or arg_name[0].isalpha() + or arg_name[0] == "_" + ): + # if is a valid arg name + args.append( + { + "arg_name": arg_name, + "arg_type": arg_type, + "arg_default": arg_default, + } + ) + else: + if args: + if args[-1]["arg_default"] is not None: + args[-1]["arg_default"] += f", {arg_name}" + else: + args[-1]["arg_default"] = arg_name + else: + raise ValueError(f"Invalid argument format: {arg_buffer}") + + parsed_signatures.append({"api_name": api_name, "args": args}) + + return parsed_signatures + + +def get_meta_from_diff_file( + filepath, + src_prefix="torch.", + dst_prefix="paddle.", + src_argmap_title="PyTorch", + dst_argmap_title="PaddlePaddle", +): + """ + 该函数从指定的映射文件中解析出元数据信息 + - filepath: 映射文件路径 + - src_prefix: 需要映射的 API 前缀 + - dst_prefix: 映射目标 API 前缀 + - 返回值: DiffMeta 类型的元数据信息 + """ + meta_data: DiffMeta = {"source_file": filepath} + state = ParserState.wait_for_title + title_pattern = re.compile(r"^## +\[(?P[^\]]+)\] *(?P.+)$") + torch_pattern = re.compile( + rf"^### +\[ *(?P{re.escape(src_prefix)}[^\]]+)\](?P\([^\)]*\))?$" + ) + paddle_pattern = re.compile( + rf"^### +\[ *(?P{re.escape(dst_prefix)}[^\]]+)\](\((?P[^\)]*)\))?$" + ) + code_begin_pattern = re.compile(r"^```python$") + code_pattern = re.compile(r"^(?P[^#][^\( ]+)(.*?)$") + code_end_pattern = re.compile(r"^```$") + + args_pattern = re.compile(r"^### 参数映射$") + ARGS_EXPECT_HEADERS = [src_argmap_title, dst_argmap_title, "备注"] + + mapping_type = "" + signature_cache = None + + with open(filepath, "r", encoding="utf-8") as f: + for line in f: + # 现在需要考虑内容信息了 + # if not line.startswith("##"): + # continue + + if state == ParserState.wait_for_title: + title_match = title_pattern.match(line) + if title_match: + mapping_type = title_match["type"].strip() + src_api = unescape_api(title_match["src_api"].strip()) + meta_data["src_api"] = unescape_api(src_api) + meta_data["mapping_type"] = mapping_type + + if mapping_type not in mapping_type_set: + raise ValueError( + f"Unexpected mapping type: {mapping_type} in {filepath}" + ) + + state = ParserState.wait_for_src_api + else: + raise Exception(f"Cannot parse title: {line} in {filepath}") + elif state == ParserState.wait_for_src_api: + torch_match = torch_pattern.match(line) + + if torch_match: + src_api = torch_match["src_api"].strip() + torch_url = torch_match["url"] if torch_match["url"] else "" + real_url = torch_url.lstrip("(").rstrip(")") + if meta_data["src_api"] != unescape_api(src_api): + raise Exception( + f"torch api not match: {line} != {meta_data['src_api']} in {filepath}" + ) + meta_data["src_api_url"] = real_url + state = ParserState.wait_for_src_signature_begin + elif state == ParserState.wait_for_dst_api: + paddle_pattern = re.compile( + rf"^### +\[ *(?P{re.escape(dst_prefix)}[^\]]+)\](\((?P[^\)]*)\))?$" + ) + paddle_match = paddle_pattern.match(line) + + if paddle_match: + dst_api = paddle_match["dst_api"].strip() + paddle_url = paddle_match["url"].strip() + meta_data["dst_api"] = unescape_api(dst_api) + meta_data["dst_api_url"] = paddle_url + state = ParserState.wait_for_dst_signature_begin + elif state in [ + ParserState.wait_for_src_signature_begin, + ParserState.wait_for_dst_signature_begin, + ]: + cb_match = code_begin_pattern.match(line) + + if cb_match: + if state == ParserState.wait_for_src_signature_begin: + state = ParserState.wait_for_src_signature + elif state == ParserState.wait_for_dst_signature_begin: + state = ParserState.wait_for_dst_signature + else: + raise ValueError( + f"Unexpected state {state} when process {filepath} line: {line}" + ) + elif state in [ + ParserState.wait_for_src_signature, + ParserState.wait_for_dst_signature, + ]: + code_match = code_pattern.match(line) + + if code_match: + api_name = code_match["api_name"].strip() + if state == ParserState.wait_for_src_signature: + if api_name != meta_data["src_api"]: + raise ValueError( + f"Unexpected api code {api_name} != {meta_data['src_api']} when process {filepath} line: {line}" + ) + else: + state = ParserState.wait_for_src_signature_end + signature_cache = line + elif state == ParserState.wait_for_dst_signature: + if api_name != meta_data["dst_api"]: + raise ValueError( + f"Unexpected api code {api_name} != {meta_data['dst_api']} when process {filepath} line: {line}" + ) + else: + state = ParserState.wait_for_dst_signature_end + signature_cache = line + else: + # 如果写注释,就先不管了 + if line[0] != "#": + raise ValueError( + f"Api code must appear after ```, but not found correct signature when process {filepath} line: {line}." + ) + elif state in [ + ParserState.wait_for_src_signature_end, + ParserState.wait_for_dst_signature_end, + ]: + ce_match = code_end_pattern.match(line) + + if ce_match: + try: + signature_info = reformat_signature(signature_cache) + signature_cache = None + except AssertionError as e: + raise Exception( + f"Cannot parse signature code in {filepath}" + ) from e + + if state == ParserState.wait_for_src_signature_end: + meta_data["src_signature"] = signature_info + state = ParserState.wait_for_dst_api + elif state == ParserState.wait_for_dst_signature_end: + meta_data["dst_signature"] = signature_info + state = ParserState.wait_for_args + else: + raise ValueError( + f"Unexpected state {state} when process {filepath} line: {line}" + ) + else: + # not match, append line to cache + if state == ParserState.wait_for_src_signature_end: + signature_cache += line + elif state == ParserState.wait_for_dst_signature_end: + signature_cache += line + else: + raise ValueError( + f"Unexpected state {state} when process {filepath} line: {line}" + ) + elif state == ParserState.wait_for_args: + args_match = args_pattern.match(line) + if args_match: + state = ParserState.wait_for_args_table_title + elif state == ParserState.wait_for_args_table_title: + if line.startswith("|"): + args_table_headers = [ + c.strip() for c in line.split("|") if len(c.strip()) > 0 + ] + if args_table_headers != ARGS_EXPECT_HEADERS: + raise Exception( + f"args mapping table headers mismatch, expect {ARGS_EXPECT_HEADERS}, but got {args_table_headers} in {filepath} ." + ) + else: + state = ParserState.wait_for_args_table_sep + meta_data["args_mapping"] = [] + elif state == ParserState.wait_for_args_table_sep: + if line.startswith("|"): + args_table_seps = [ + c.strip() for c in line.split("|") if len(c.strip()) > 0 + ] + if len(args_table_seps) == len(ARGS_EXPECT_HEADERS): + state = ParserState.wait_for_args_table_end + else: + raise Exception( + f"Unexpected args table seps: {args_table_seps} in {filepath}" + ) + else: + raise Exception( + f"Unexpected args table sep: {line} in {filepath}" + ) + elif state == ParserState.wait_for_args_table_end: + if line.startswith("|"): + args_table_content = [c.strip() for c in line.split("|")][ + 1:-1 + ] + if len(args_table_content) == len(ARGS_EXPECT_HEADERS): + torch_arg, paddle_arg, note = args_table_content + meta_data["args_mapping"].append( + { + "src_arg": torch_arg, + "dst_arg": paddle_arg, + "note": note, + } + ) + else: + raise Exception( + f"Unexpected args table end: {args_table_content} in {filepath}" + ) + else: + state = ParserState.end + elif state == ParserState.end: + break + else: + raise ValueError( + f"Unexpected state {state} when process {filepath} line: {line}" + ) + + # 允许没有参数映射列表 + if mapping_type in ["无参数", "组合替代实现"]: + if state == ParserState.wait_for_args: + state = ParserState.end + # 必须有参数映射列表,但是可以随时停止 + else: + if state == ParserState.wait_for_args_table_end: + state = ParserState.end + + if not mapping_type: + raise Exception( + f"Cannot get mapping_type in parsing file: {filepath}, current meta: {meta_data}" + ) + + # 允许的终止状态,解析完了 dst_api 或者只有 src_api + # 映射类型前三个级别必须要有对应的 dst_api + if mapping_type_to_level[mapping_type] <= 3: + if state != ParserState.end: + print(state) + raise Exception( + f"Unexpected End State at {state} in parsing file: {filepath}, current meta: {meta_data}" + ) + else: + if state not in [ParserState.end, ParserState.wait_for_dst_api]: + raise Exception( + f"Unexpected End State at {state} in parsing file: {filepath}, current meta: {meta_data}" + ) + + return meta_data + + +def process_mapping_index(index_path, item_processer, context={}): + """ + 线性处理 `pytorch_api_mapping_cn.md` 文件 + - index_path: 该 md 文件路径 + - item_processer: 对文件每行的处理方式,输入参数 (line, line_idx, state, output, context)。 + 如果处理出错则返回 False,否则返回 True。 + - context: 用于存储处理过程中的上下文信息 + - output: 使用 context["output"] 初始化,如果不调用 item_processer,直接加入原文件对应行,否则 item_processer 处理 output 逻辑。 + - 返回值:是否成功处理,成功返回 0。 + """ + if not os.path.exists(index_path): + raise Exception(f"Cannot find pytorch_api_mapping_cn.md: {index_path}") + + with open(index_path, "r", encoding="utf-8") as f: + lines = f.readlines() + + state = IndexParserState.normal + + column_names = [] + column_count = -1 + table_seperator_pattern = re.compile(r"^ *\|(?P *-+ *\|)+ *$") + + expect_column_names = [ + "序号", + "Pytorch 最新 release", + "Paddle develop", + "映射关系分类", + "备注", + ] + + context["table_row_idx"] = context.get("table_row_idx", -1) + output = context.get("output", []) + + for i, line in enumerate(lines): + if state == IndexParserState.error: + break + + content = line.strip() + if not content.startswith("|"): + output.append(line) + state = IndexParserState.normal + continue + + columns = [c.strip() for c in content.split("|")] + columns = [c for c in columns if len(c) > 0] + + if state == IndexParserState.normal: + column_names.clear() + column_names.extend([c.strip() for c in columns]) + column_count = len(column_names) + + if not item_processer(line, i, state, output, context): + break + + if column_names == expect_column_names: + state = IndexParserState.table_sep + context["table_row_idx"] = 1 + # print(f'process mapping table at line {i+1}.') + else: + state = IndexParserState.table_sep_ignore + print(f"ignore table with {column_names} at line {i + 1}.") + + elif state == IndexParserState.table_sep_ignore: + if ( + not table_seperator_pattern.match(line) + or len(columns) != column_count + ): + raise Exception( + f"Table seperator not match at line {i + 1}: {line}" + ) + if not item_processer(line, i, state, output, context): + break + state = IndexParserState.table_row_ignore + elif state == IndexParserState.table_sep: + if ( + not table_seperator_pattern.match(line) + or len(columns) != column_count + ): + raise Exception( + f"Table seperator not match at line {i + 1}: {line}" + ) + if not item_processer(line, i, state, output, context): + break + state = IndexParserState.table_row + elif state == IndexParserState.table_row_ignore: + if not item_processer(line, i, state, output, context): + break + elif state == IndexParserState.table_row: + try: + context["columns"] = columns + if not item_processer(line, i, state, output, context): + break + context["table_row_idx"] += 1 + except Exception as e: + print(e) + print(f"Error at line {i + 1}: {line}") + traceback.print_exc() + ret_code = 1 + sys.exit(-IndexParserState.table_row) + else: + ret_code = 2 + raise Exception( + f"Unexpected State at {state} in processing file: {index_path}" + ) + + if state in [IndexParserState.table_row, IndexParserState.table_row_ignore]: + state = IndexParserState.normal + + if state != IndexParserState.normal: + raise Exception( + f"Unexpected End State at {state} in parsing file: {index_path}" + ) + + ret_code = context.get("ret_code", 0xCC) + if ret_code != 0: + return ret_code + + context["output"] = output + + return 0 + + +def get_doc_url_from_meta(basedir, meta): + relpath = os.path.relpath(meta["source_file"], basedir).replace("\\", "/") + diffurl = urllib.parse.urljoin(PADDLE_DOCS_BASE_URL, relpath) + return diffurl + + +def generate_alias_lines_from_paconvert(basedir, meta_dict) -> None: + alias_filename = "api_alias_mapping.json" + alias_filepath = os.path.join(basedir, alias_filename) + if not os.path.exists(alias_filepath) or not os.path.isfile(alias_filepath): + return + + alias_refer_failed_list = [] + alias_output = {} + with open(alias_filepath, "r", encoding="utf-8") as f: + api_alias = json.load(f) + for alias_name, api_name in api_alias.items(): + if api_name in meta_dict: + pass + elif alias_name in meta_dict: + # 如果反着有,就交换 + api_name, alias_name = alias_name, api_name + else: + # 都没有就抛出警告 + alias_refer_failed_list.append((alias_name, api_name)) + continue + + meta_data = meta_dict[api_name] + + dst_api = meta_data.get("dst_api", "-") + mapping_type = meta_data["mapping_type"] + url = get_doc_url_from_meta(basedir, meta_data) + + alias_col = f"`{alias_name}`" + paddle_col = f"`{dst_api}`" + if "src_api_url" in meta_data: + alias_col = f"[{alias_col}]({meta_data['src_api_url']})" + if "dst_api_url" in meta_data: + paddle_col = f"[{paddle_col}]({meta_data['dst_api_url']})" + + macro_line = f"ALIAS-REFERENCE-ITEM(`{alias_name}`, `{api_name}`)" + alias_output[alias_name] = macro_line + + output_path = os.path.join(basedir, "alias_macro_lines.tmp.md") + with open(output_path, "w", encoding="utf-8") as f: + od_apis = collections.OrderedDict(sorted(alias_output.items())) + f.writelines(f"| {ref} |\n" for api, ref in od_apis.items()) + + print(f'generated alias temp file: "{output_path}"') + + if len(alias_refer_failed_list) > 0: + fail_log_path = os.path.join(basedir, "alias_refer_failed.log") + with open(fail_log_path, "w", encoding="utf-8") as f: + for alias_name, api_name in alias_refer_failed_list: + f.write( + f"api `{api_name}` have no mapping doc, failed to reference from alias `{alias_name}`\n" + ) + + print( + f'{len(alias_refer_failed_list)} alias reference failed, see log file: "{fail_log_path}"' + ) + + +def discover_markdown_files(base_dir, prefix="torch."): + pattern = re.compile(f"^{re.escape(prefix)}.*{re.escape('.md')}$") + markdown_files = [] + for path, _, file_list in os.walk(base_dir): + for filename in file_list: + if pattern.match(filename): + markdown_files.append(os.path.join(path, filename)) + return markdown_files + + +ARG_MAPPING_TABLE_HEADERS = {"torch.": "PyTorch"} + + +def get_table_header_by_prefix(prefix): + if prefix in ARG_MAPPING_TABLE_HEADERS: + return ARG_MAPPING_TABLE_HEADERS[prefix] + assert prefix.endswith("."), f"prefix must end with '.' but got {prefix}" + return prefix.rstrip(".") + + +def discover_all_metas(cfp_basedir): + # 获取 api_difference/ 下的 api 映射文档 + diff_3rd_basedir = os.path.join(cfp_basedir, "api_difference_third_party") + + diff_srcs = [("api_difference", "torch.", "paddle.")] + diff_srcs.extend( + [ + (os.path.join(diff_3rd_basedir, subdir), f"{subdir}.", "") + for subdir in os.listdir(diff_3rd_basedir) + ] + ) + + diff_files = [] + for diff_src, api_prefix, dst_prefix in diff_srcs: + basedir = os.path.join(cfp_basedir, diff_src) + files = discover_markdown_files(basedir, api_prefix) + diff_files.append(((api_prefix, dst_prefix), files)) + + print( + f"{len(files)} mapping documents found in {os.path.relpath(basedir, cfp_basedir)}." + ) + + metas = [] + for prefixs, files in diff_files: + s, d = prefixs + sh = get_table_header_by_prefix(s) + for f in files: + if os.path.basename(f) in validate_whitelist: + continue + metas.append(get_meta_from_diff_file(f, s, d, src_argmap_title=sh)) + + metas.sort(key=lambda x: x["src_api"]) + print(f"extracted {len(metas)} mapping metas data.") + return metas + + +if __name__ == "__main__": + # convert from pytorch basedir + tools_dir = os.path.dirname(__file__) + cfp_basedir = os.path.join(tools_dir, "..") + # pysrc_api_mapping_cn + mapping_index_file = os.path.join( + cfp_basedir, "deprecated/pytorch_api_mapping_cn_deprecated.md" + ) + + if not os.path.exists(mapping_index_file): + raise Exception(f"Cannot find mapping index file: {mapping_index_file}") + + metas = discover_all_metas(cfp_basedir) + + for m in metas: + if m["mapping_type"] not in mapping_type_set: + print(m) + raise Exception( + f"Unknown mapping type: {m['mapping_type']} in {m['source_file']}" + ) + + meta_dict = {m["src_api"].replace(r"\_", "_"): m for m in metas} + + # 该文件用于 PaConvert 的文档对齐工作 + api_diff_output_path = os.path.join(tools_dir, "docs_mappings.json") + + with open(api_diff_output_path, "w", encoding="utf-8") as f: + json.dump(metas, f, ensure_ascii=False, indent=4) + + generate_alias_lines_from_paconvert(tools_dir, meta_dict) diff --git a/docs/guides/model_convert/convert_from_pytorch/tools/validate_mapping_files.py b/docs/guides/model_convert/convert_from_pytorch/tools/validate_mapping_files.py index f57bfafe6b9..af2fcf112a9 100644 --- a/docs/guides/model_convert/convert_from_pytorch/tools/validate_mapping_files.py +++ b/docs/guides/model_convert/convert_from_pytorch/tools/validate_mapping_files.py @@ -1,780 +1,337 @@ -from __future__ import annotations - -import collections -import json +import argparse import os import re -import sys -import traceback -import urllib -import urllib.parse -from enum import IntEnum -from typing import TypedDict - -PADDLE_DOCS_BASE_URL = "https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/" - -validate_whitelist = [] - -mapping_type_levels = [ - # type 0 - ["UNDEFINED_MAPPING_TYPE_0"], - # type 1 - [ - "无参数", - "参数完全一致", - "仅参数名不一致", - "paddle 参数更多", - "参数默认值不一致", - ], - # type 2 - [ - "torch 参数更多", - ], - # type 3 - [ - "返回参数类型不一致", - "输入参数类型不一致", - "输入参数用法不一致", - ], - # type 4 - [ - "组合替代实现", - ], - # type 5 - [ - "涉及上下文修改", - ], - # type 6 - [ - "对应 API 不在主框架", - ], - # type 7 - [ - "功能缺失", - ], - # delete - [ - "可删除", - ], -] - -mapping_type_set = {t for ts in mapping_type_levels for t in ts} -mapping_type_to_level = { - t: level for level, ts in enumerate(mapping_type_levels) for t in ts -} - - -class DiffMeta(TypedDict): - src_api: str - src_api_url: str | None - src_signature: str | None - dst_api: str | None - dst_api_url: str | None - dst_signature: str | None - args_mapping: list[dict[str, str]] | None - mapping_type: str - source_file: str - - -class IndexParserState(IntEnum): - error = -1 - normal = 0 - table_sep = 1 - table_row = 2 - table_sep_ignore = 3 - table_row_ignore = 4 - - -class ParserState(IntEnum): - wait_for_title = 0 - - wait_for_src_api = 1 - wait_for_src_signature_begin = 2 - wait_for_src_signature = 3 - wait_for_src_signature_end = 4 - - wait_for_dst_api = 5 - wait_for_dst_signature_begin = 6 - wait_for_dst_signature = 7 - wait_for_dst_signature_end = 8 - - wait_for_args = 9 - wait_for_args_table_title = 10 - wait_for_args_table_sep = 11 - wait_for_args_table_end = 12 - - end = 13 - - -def unescape_api(api): - return api.replace(r"\_", "_") - - -def split_args(args_str): - """ - 按逗号分割参数字符串,忽略括号内的逗号 - """ - args = [] - current = [] - stack = [] - brackets = {"(": ")", "[": "]", "{": "}"} - closing = {v: k for k, v in brackets.items()} - - for char in args_str: - if char in brackets: - stack.append(brackets[char]) - elif char in closing: - if stack and stack[-1] == char: - stack.pop() - else: - raise ValueError(f"Unmatched closing bracket: {char}") - elif char == "," and not stack: - arg = "".join(current).strip() - if arg: - args.append(arg) - current = [] - continue - current.append(char) +from collections import defaultdict - arg = "".join(current).strip() - if arg: - args.append(arg) - return args +# 默认文件路径 +DEFAULT_FILE_PATH = "/workspace/paddleDocs/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md" -def split_signatures(buffer): +def parse_toc(lines): """ - 分割包含多个函数签名的字符串 + 解析目录表格,返回目录条目列表和结束行号 """ - signatures = [] - current = [] - stack = [] - brackets = {"(": ")", "[": "]", "{": "}"} - closing = {v: k for k, v in brackets.items()} - - for char in buffer: - if char in brackets: - stack.append(brackets[char]) - elif char in closing: - if stack and stack[-1] == char: - stack.pop() - else: - raise ValueError(f"Unmatched closing bracket: {char}") - current.append(char) - if char == ")" and not stack: - # End of a function signature - signature = "".join(current).strip() - signatures.append(signature) - current = [] + toc = [] + toc_end_line = -1 + in_toc = False + found_header = False - if current: - signatures.append("".join(current).strip()) + for i, line in enumerate(lines): + line = line.strip() - return signatures + if line == "## API 映射表目录": + in_toc = True + continue + if in_toc: + if line.startswith("|") and "序号" in line and "类别" in line: + found_header = True + continue -def reformat_signature(code): - """ - 从函数签名代码中解析出函数名和参数列表 - - code: 函数签名代码,可能包含多个函数声明 - - 返回值: 包含所有函数名和参数列表的列表 - """ - lines = [l for l in code.split("\n") if len(l.strip()) > 0] - assert len(lines) > 0, "code have no lines." - buffer = "".join([l.strip() for l in lines]) + if ( + found_header + and line.startswith("|") + and re.match(r"^\|?[-:\s|]+\|?$", line) + ): + continue # 跳过分隔行 - signatures = split_signatures(buffer) + if found_header and line.startswith("|"): + # 解析数据行 + columns = [col.strip() for col in line.split("|")[1:-1]] + if len(columns) >= 2: + toc.append((columns[0], columns[1])) # (序号, 类别名称) + else: + # 表格结束 + if found_header: + toc_end_line = i + break - parsed_signatures = [] + return toc, toc_end_line - arg_pattern = re.compile( - r"^(?P[^\=\:]+)" # 参数名 - r"(?:\s*\:\s*(?P[^=]+))?" # 可选的类型注解 - r"(?:\s*\=\s*(?P.+))?$" # 可选的默认值 - ) - for sig in signatures: - first_par_pos = sig.find("(") - m = re.match(r"^\s*(?P[^\( ]+)(.*?)$", sig) - assert m is not None, f'code first line "{sig}" not match api pattern.' - api_name = m.group("api_name") +def parse_categories(lines): + """ + 解析类别部分,提取所有类别及其表格数据 + """ + categories = [] + current_category = None + current_table = [] + in_table = False + + for line in lines: + line = line.strip() + + # 检测类别标题 (## X. 类别名称) + category_match = re.match(r"^## (\d+)\. (.+)$", line) + if category_match: + # 保存前一个类别和表格 + if current_category is not None: + categories.append( + { + "id": current_category["id"], + "name": current_category["name"], + "table": current_table, + } + ) - if first_par_pos < 0: - # 要是没括号,可能是特殊情况,比如 property - parsed_signatures.append({"api_name": api_name}) + # 开始新类别 + current_category = { + "id": int(category_match.group(1)), + "name": category_match.group(2), + } + current_table = [] + in_table = False continue - last_par_pos = sig.rfind(")") - assert last_par_pos > first_par_pos, ( - f'code first line "{sig}" not match api pattern.' - ) - args_buffer = sig[first_par_pos + 1 : last_par_pos] - - args = [] - args_buffer = args_buffer.strip() - - arg_buffer_list = split_args(args_buffer) + # 检测表格开始 + if line.startswith("|") and "Pytorch" in line and "Paddle" in line: + in_table = True + continue - for arg_buffer in arg_buffer_list: - m = arg_pattern.match(arg_buffer) - assert m is not None, ( - f'code arg "{arg_buffer}" not match arg pattern.' - ) - arg_name = m.group("arg_name").strip() - arg_type = ( - m.group("arg_type").strip() if m.group("arg_type") else None - ) - arg_default = ( - m.group("arg_default").strip() - if m.group("arg_default") - else None - ) + # 检测表格行 + if in_table and line.startswith("|"): + # 跳过表头分隔行 + if re.match(r"^\|?[-:\s|]+\|?$", line): + continue - if ( - arg_name.startswith("*") - or arg_name.startswith("**") - or arg_name[0].isalpha() - or arg_name[0] == "_" - ): - # if is a valid arg name - args.append( + # 解析表格行 + columns = [col.strip() for col in line.split("|")[1:-1]] + if len(columns) >= 4: + current_table.append( { - "arg_name": arg_name, - "arg_type": arg_type, - "arg_default": arg_default, + "index": columns[0], + "pytorch": columns[1], + "paddle": columns[2], + "note": columns[3] if len(columns) > 3 else "", } ) - else: - if args: - if args[-1]["arg_default"] is not None: - args[-1]["arg_default"] += f", {arg_name}" - else: - args[-1]["arg_default"] = arg_name - else: - raise ValueError(f"Invalid argument format: {arg_buffer}") - - parsed_signatures.append({"api_name": api_name, "args": args}) - - return parsed_signatures - - -def get_meta_from_diff_file( - filepath, - src_prefix="torch.", - dst_prefix="paddle.", - src_argmap_title="PyTorch", - dst_argmap_title="PaddlePaddle", -): - """ - 该函数从指定的映射文件中解析出元数据信息 - - filepath: 映射文件路径 - - src_prefix: 需要映射的 API 前缀 - - dst_prefix: 映射目标 API 前缀 - - 返回值: DiffMeta 类型的元数据信息 - """ - meta_data: DiffMeta = {"source_file": filepath} - state = ParserState.wait_for_title - title_pattern = re.compile(r"^## +\[(?P[^\]]+)\] *(?P.+)$") - torch_pattern = re.compile( - rf"^### +\[ *(?P{re.escape(src_prefix)}[^\]]+)\](?P\([^\)]*\))?$" - ) - paddle_pattern = re.compile( - rf"^### +\[ *(?P{re.escape(dst_prefix)}[^\]]+)\](\((?P[^\)]*)\))?$" - ) - code_begin_pattern = re.compile(r"^```python$") - code_pattern = re.compile(r"^(?P[^#][^\( ]+)(.*?)$") - code_end_pattern = re.compile(r"^```$") - - args_pattern = re.compile(r"^### 参数映射$") - ARGS_EXPECT_HEADERS = [src_argmap_title, dst_argmap_title, "备注"] - - mapping_type = "" - signature_cache = None - - with open(filepath, "r", encoding="utf-8") as f: - for line in f: - # 现在需要考虑内容信息了 - # if not line.startswith("##"): - # continue - - if state == ParserState.wait_for_title: - title_match = title_pattern.match(line) - if title_match: - mapping_type = title_match["type"].strip() - src_api = unescape_api(title_match["src_api"].strip()) - meta_data["src_api"] = unescape_api(src_api) - meta_data["mapping_type"] = mapping_type - - if mapping_type not in mapping_type_set: - raise ValueError( - f"Unexpected mapping type: {mapping_type} in {filepath}" - ) - - state = ParserState.wait_for_src_api - else: - raise Exception(f"Cannot parse title: {line} in {filepath}") - elif state == ParserState.wait_for_src_api: - torch_match = torch_pattern.match(line) - - if torch_match: - src_api = torch_match["src_api"].strip() - torch_url = torch_match["url"] if torch_match["url"] else "" - real_url = torch_url.lstrip("(").rstrip(")") - if meta_data["src_api"] != unescape_api(src_api): - raise Exception( - f"torch api not match: {line} != {meta_data['src_api']} in {filepath}" - ) - meta_data["src_api_url"] = real_url - state = ParserState.wait_for_src_signature_begin - elif state == ParserState.wait_for_dst_api: - paddle_pattern = re.compile( - rf"^### +\[ *(?P{re.escape(dst_prefix)}[^\]]+)\](\((?P[^\)]*)\))?$" - ) - paddle_match = paddle_pattern.match(line) - - if paddle_match: - dst_api = paddle_match["dst_api"].strip() - paddle_url = paddle_match["url"].strip() - meta_data["dst_api"] = unescape_api(dst_api) - meta_data["dst_api_url"] = paddle_url - state = ParserState.wait_for_dst_signature_begin - elif state in [ - ParserState.wait_for_src_signature_begin, - ParserState.wait_for_dst_signature_begin, - ]: - cb_match = code_begin_pattern.match(line) - - if cb_match: - if state == ParserState.wait_for_src_signature_begin: - state = ParserState.wait_for_src_signature - elif state == ParserState.wait_for_dst_signature_begin: - state = ParserState.wait_for_dst_signature - else: - raise ValueError( - f"Unexpected state {state} when process {filepath} line: {line}" - ) - elif state in [ - ParserState.wait_for_src_signature, - ParserState.wait_for_dst_signature, - ]: - code_match = code_pattern.match(line) - - if code_match: - api_name = code_match["api_name"].strip() - if state == ParserState.wait_for_src_signature: - if api_name != meta_data["src_api"]: - raise ValueError( - f"Unexpected api code {api_name} != {meta_data['src_api']} when process {filepath} line: {line}" - ) - else: - state = ParserState.wait_for_src_signature_end - signature_cache = line - elif state == ParserState.wait_for_dst_signature: - if api_name != meta_data["dst_api"]: - raise ValueError( - f"Unexpected api code {api_name} != {meta_data['dst_api']} when process {filepath} line: {line}" - ) - else: - state = ParserState.wait_for_dst_signature_end - signature_cache = line - else: - # 如果写注释,就先不管了 - if line[0] != "#": - raise ValueError( - f"Api code must appear after ```, but not found correct signature when process {filepath} line: {line}." - ) - elif state in [ - ParserState.wait_for_src_signature_end, - ParserState.wait_for_dst_signature_end, - ]: - ce_match = code_end_pattern.match(line) - - if ce_match: - try: - signature_info = reformat_signature(signature_cache) - signature_cache = None - except AssertionError as e: - raise Exception( - f"Cannot parse signature code in {filepath}" - ) from e - - if state == ParserState.wait_for_src_signature_end: - meta_data["src_signature"] = signature_info - state = ParserState.wait_for_dst_api - elif state == ParserState.wait_for_dst_signature_end: - meta_data["dst_signature"] = signature_info - state = ParserState.wait_for_args - else: - raise ValueError( - f"Unexpected state {state} when process {filepath} line: {line}" - ) - else: - # not match, append line to cache - if state == ParserState.wait_for_src_signature_end: - signature_cache += line - elif state == ParserState.wait_for_dst_signature_end: - signature_cache += line - else: - raise ValueError( - f"Unexpected state {state} when process {filepath} line: {line}" - ) - elif state == ParserState.wait_for_args: - args_match = args_pattern.match(line) - if args_match: - state = ParserState.wait_for_args_table_title - elif state == ParserState.wait_for_args_table_title: - if line.startswith("|"): - args_table_headers = [ - c.strip() for c in line.split("|") if len(c.strip()) > 0 - ] - if args_table_headers != ARGS_EXPECT_HEADERS: - raise Exception( - f"args mapping table headers mismatch, expect {ARGS_EXPECT_HEADERS}, but got {args_table_headers} in {filepath} ." - ) - else: - state = ParserState.wait_for_args_table_sep - meta_data["args_mapping"] = [] - elif state == ParserState.wait_for_args_table_sep: - if line.startswith("|"): - args_table_seps = [ - c.strip() for c in line.split("|") if len(c.strip()) > 0 - ] - if len(args_table_seps) == len(ARGS_EXPECT_HEADERS): - state = ParserState.wait_for_args_table_end - else: - raise Exception( - f"Unexpected args table seps: {args_table_seps} in {filepath}" - ) - else: - raise Exception( - f"Unexpected args table sep: {line} in {filepath}" - ) - elif state == ParserState.wait_for_args_table_end: - if line.startswith("|"): - args_table_content = [c.strip() for c in line.split("|")][ - 1:-1 - ] - if len(args_table_content) == len(ARGS_EXPECT_HEADERS): - torch_arg, paddle_arg, note = args_table_content - meta_data["args_mapping"].append( - { - "src_arg": torch_arg, - "dst_arg": paddle_arg, - "note": note, - } - ) - else: - raise Exception( - f"Unexpected args table end: {args_table_content} in {filepath}" - ) - else: - state = ParserState.end - elif state == ParserState.end: - break - else: - raise ValueError( - f"Unexpected state {state} when process {filepath} line: {line}" - ) - - # 允许没有参数映射列表 - if mapping_type in ["无参数", "组合替代实现"]: - if state == ParserState.wait_for_args: - state = ParserState.end - # 必须有参数映射列表,但是可以随时停止 - else: - if state == ParserState.wait_for_args_table_end: - state = ParserState.end + continue - if not mapping_type: - raise Exception( - f"Cannot get mapping_type in parsing file: {filepath}, current meta: {meta_data}" + # 检测表格结束 + if in_table and not line.startswith("|") and line != "": + in_table = False + + # 添加最后一个类别 + if current_category is not None: + categories.append( + { + "id": current_category["id"], + "name": current_category["name"], + "table": current_table, + } ) - # 允许的终止状态,解析完了 dst_api 或者只有 src_api - # 映射类型前三个级别必须要有对应的 dst_api - if mapping_type_to_level[mapping_type] <= 3: - if state != ParserState.end: - print(state) - raise Exception( - f"Unexpected End State at {state} in parsing file: {filepath}, current meta: {meta_data}" - ) - else: - if state not in [ParserState.end, ParserState.wait_for_dst_api]: - raise Exception( - f"Unexpected End State at {state} in parsing file: {filepath}, current meta: {meta_data}" - ) - - return meta_data + return categories -def process_mapping_index(index_path, item_processer, context={}): +def extract_links(text): """ - 线性处理 `pytorch_api_mapping_cn.md` 文件 - - index_path: 该 md 文件路径 - - item_processer: 对文件每行的处理方式,输入参数 (line, line_idx, state, output, context)。 - 如果处理出错则返回 False,否则返回 True。 - - context: 用于存储处理过程中的上下文信息 - - output: 使用 context["output"] 初始化,如果不调用 item_processer,直接加入原文件对应行,否则 item_processer 处理 output 逻辑。 - - 返回值:是否成功处理,成功返回 0。 + 从文本中提取所有超链接 """ - if not os.path.exists(index_path): - raise Exception(f"Cannot find pytorch_api_mapping_cn.md: {index_path}") + return re.findall(r"\[([^\]]+)\]\(([^)]+)\)", text) - with open(index_path, "r", encoding="utf-8") as f: - lines = f.readlines() - state = IndexParserState.normal - - column_names = [] - column_count = -1 - table_seperator_pattern = re.compile(r"^ *\|(?P *-+ *\|)+ *$") - - expect_column_names = [ - "序号", - "Pytorch 最新 release", - "Paddle develop", - "映射关系分类", - "备注", - ] +def check_toc_consistency(toc, categories): + """ + 检查目录与类别标题的一致性 + """ + warnings = [] - context["table_row_idx"] = context.get("table_row_idx", -1) - output = context.get("output", []) + # 检查数量是否一致 + if len(toc) != len(categories): + warnings.append( + f"目录中有 {len(toc)} 个类别,但实际找到 {len(categories)} 个类别" + ) - for i, line in enumerate(lines): - if state == IndexParserState.error: + # 检查每个类别的序号和名称是否匹配 + for i, (toc_index, toc_name) in enumerate(toc): + if i >= len(categories): break - content = line.strip() - if not content.startswith("|"): - output.append(line) - state = IndexParserState.normal - continue - - columns = [c.strip() for c in content.split("|")] - columns = [c for c in columns if len(c) > 0] - - if state == IndexParserState.normal: - column_names.clear() - column_names.extend([c.strip() for c in columns]) - column_count = len(column_names) - - if not item_processer(line, i, state, output, context): - break - - if column_names == expect_column_names: - state = IndexParserState.table_sep - context["table_row_idx"] = 1 - # print(f'process mapping table at line {i+1}.') - else: - state = IndexParserState.table_sep_ignore - print(f"ignore table with {column_names} at line {i + 1}.") - - elif state == IndexParserState.table_sep_ignore: - if ( - not table_seperator_pattern.match(line) - or len(columns) != column_count - ): - raise Exception( - f"Table seperator not match at line {i + 1}: {line}" - ) - if not item_processer(line, i, state, output, context): - break - state = IndexParserState.table_row_ignore - elif state == IndexParserState.table_sep: - if ( - not table_seperator_pattern.match(line) - or len(columns) != column_count - ): - raise Exception( - f"Table seperator not match at line {i + 1}: {line}" - ) - if not item_processer(line, i, state, output, context): - break - state = IndexParserState.table_row - elif state == IndexParserState.table_row_ignore: - if not item_processer(line, i, state, output, context): - break - elif state == IndexParserState.table_row: - try: - context["columns"] = columns - if not item_processer(line, i, state, output, context): - break - context["table_row_idx"] += 1 - except Exception as e: - print(e) - print(f"Error at line {i + 1}: {line}") - traceback.print_exc() - ret_code = 1 - sys.exit(-IndexParserState.table_row) - else: - ret_code = 2 - raise Exception( - f"Unexpected State at {state} in processing file: {index_path}" + cat = categories[i] + if str(cat["id"]) != toc_index: + warnings.append( + f"目录中第 {i + 1} 个类别序号为 {toc_index},但实际类别序号为 {cat['id']}" ) - if state in [IndexParserState.table_row, IndexParserState.table_row_ignore]: - state = IndexParserState.normal - - if state != IndexParserState.normal: - raise Exception( - f"Unexpected End State at {state} in parsing file: {index_path}" - ) - - ret_code = context.get("ret_code", 0xCC) - if ret_code != 0: - return ret_code - - context["output"] = output - - return 0 - - -def get_doc_url_from_meta(basedir, meta): - relpath = os.path.relpath(meta["source_file"], basedir).replace("\\", "/") - diffurl = urllib.parse.urljoin(PADDLE_DOCS_BASE_URL, relpath) - return diffurl - + if cat["name"] != toc_name: + warnings.append( + f"目录中第 {i + 1} 个类别名称为 '{toc_name}',但实际类别名称为 '{cat['name']}'" + ) -def generate_alias_lines_from_paconvert(basedir, meta_dict) -> None: - alias_filename = "api_alias_mapping.json" - alias_filepath = os.path.join(basedir, alias_filename) - if not os.path.exists(alias_filepath) or not os.path.isfile(alias_filepath): - return + return warnings - alias_refer_failed_list = [] - alias_output = {} - with open(alias_filepath, "r", encoding="utf-8") as f: - api_alias = json.load(f) - for alias_name, api_name in api_alias.items(): - if api_name in meta_dict: - pass - elif alias_name in meta_dict: - # 如果反着有,就交换 - api_name, alias_name = alias_name, api_name - else: - # 都没有就抛出警告 - alias_refer_failed_list.append((alias_name, api_name)) - continue - meta_data = meta_dict[api_name] +def check_unique_torch_apis(categories): + """ + 检查 torch API 是否唯一 + """ + torch_apis = defaultdict(list) # api -> [category_ids] - dst_api = meta_data.get("dst_api", "-") - mapping_type = meta_data["mapping_type"] - url = get_doc_url_from_meta(basedir, meta_data) + for category in categories: + for row in category["table"]: + links = extract_links(row["pytorch"]) + if links: + api_name = links[0][0] # 取第一个链接的文本作为 API 名称 + torch_apis[api_name].append(category["id"]) - alias_col = f"`{alias_name}`" - paddle_col = f"`{dst_api}`" - if "src_api_url" in meta_data: - alias_col = f"[{alias_col}]({meta_data['src_api_url']})" - if "dst_api_url" in meta_data: - paddle_col = f"[{paddle_col}]({meta_data['dst_api_url']})" + # 检查重复的 API + warnings = [] + for api, category_ids in torch_apis.items(): + if len(category_ids) > 1: + warning_msg = f"Torch API '{api}' 在多个类别中出现: {category_ids}" + warnings.append(warning_msg) - macro_line = f"ALIAS-REFERENCE-ITEM(`{alias_name}`, `{api_name}`)" - alias_output[alias_name] = macro_line + return warnings - output_path = os.path.join(basedir, "alias_macro_lines.tmp.md") - with open(output_path, "w", encoding="utf-8") as f: - od_apis = collections.OrderedDict(sorted(alias_output.items())) - f.writelines(f"| {ref} |\n" for api, ref in od_apis.items()) - print(f'generated alias temp file: "{output_path}"') +def check_links_exist(categories): + """ + 检查必要的超链接是否存在(根据新规则) + 规则: + 1. 第二列(Pytorch)必须有超链接 + 2. 第三列(Paddle): + - 对于"组合替代实现"、"可删除"、"功能缺失"类别,如果内容为空或"-"则不检查 + - 否则必须有超链接 + 3. 第四列(备注): 除了"API完全一致类别"(类别1)外,都需要有超链接 + """ + warnings = [] - if len(alias_refer_failed_list) > 0: - fail_log_path = os.path.join(basedir, "alias_refer_failed.log") - with open(fail_log_path, "w", encoding="utf-8") as f: - for alias_name, api_name in alias_refer_failed_list: - f.write( - f"api `{api_name}` have no mapping doc, failed to reference from alias `{alias_name}`\n" - ) + for category in categories: + category_id = category["id"] + category_name = category["name"] - print( - f'{len(alias_refer_failed_list)} alias reference failed, see log file: "{fail_log_path}"' - ) + for i, row in enumerate(category["table"]): + row_num = i + 1 # 行号从1开始 + # 1. 检查第二列 (Pytorch) 必须有超链接 + pytorch_links = extract_links(row["pytorch"]) + if not pytorch_links: + warning_msg = f"类别 {category_id}({category_name}) 第 {row_num} 行第二列缺少超链接: {row['pytorch']}" + warnings.append(warning_msg) -def discover_markdown_files(base_dir, prefix="torch."): - pattern = re.compile(f"^{re.escape(prefix)}.*{re.escape('.md')}$") - markdown_files = [] - for path, _, file_list in os.walk(base_dir): - for filename in file_list: - if pattern.match(filename): - markdown_files.append(os.path.join(path, filename)) - return markdown_files + # 2. 检查第三列 (Paddle) + paddle_content = row["paddle"].strip() + paddle_links = extract_links(row["paddle"]) + # 特殊处理:组合替代实现、可删除、功能缺失 + special_cases = ["组合替代实现", "可删除", "功能缺失"] + is_special_case = any( + case in category_name for case in special_cases + ) -ARG_MAPPING_TABLE_HEADERS = {"torch.": "PyTorch"} + if is_special_case: + # 对于特殊类别,只有内容不为空且不是"-"时才检查链接 + if ( + paddle_content + and paddle_content != "-" + and not paddle_links + ): + warning_msg = f"类别 {category_id}({category_name}) 第 {row_num} 行第三列内容不为空但缺少超链接: {row['paddle']}" + warnings.append(warning_msg) + else: + # 对于其他类别,必须有超链接 + if not paddle_links: + warning_msg = f"类别 {category_id}({category_name}) 第 {row_num} 行第三列缺少超链接: {row['paddle']}" + warnings.append(warning_msg) + # 3. 检查第四列 (备注) + note_links = extract_links(row["note"]) + note_content = row["note"].strip() -def get_table_header_by_prefix(prefix): - if prefix in ARG_MAPPING_TABLE_HEADERS: - return ARG_MAPPING_TABLE_HEADERS[prefix] - assert prefix.endswith("."), f"prefix must end with '.' but got {prefix}" - return prefix.rstrip(".") + # 除了类别1(API完全一致类别)外,都需要有超链接 + if ( + category_id != 1 + and note_content + and note_content != "-" + and not note_links + ): + warning_msg = f"类别 {category_id}({category_name}) 第 {row_num} 行第四列缺少超链接: {row['note']}" + warnings.append(warning_msg) + return warnings -def discover_all_metas(cfp_basedir): - # 获取 api_difference/ 下的 api 映射文档 - diff_3rd_basedir = os.path.join(cfp_basedir, "api_difference_third_party") - diff_srcs = [("api_difference", "torch.", "paddle.")] - diff_srcs.extend( - [ - (os.path.join(diff_3rd_basedir, subdir), f"{subdir}.", "") - for subdir in os.listdir(diff_3rd_basedir) - ] +def main(): + parser = argparse.ArgumentParser(description="Markdown 文件校验工具") + parser.add_argument( + "--file", + "-f", + help="要校验的 Markdown 文件路径", + default=DEFAULT_FILE_PATH, ) + args = parser.parse_args() - diff_files = [] - for diff_src, api_prefix, dst_prefix in diff_srcs: - basedir = os.path.join(cfp_basedir, diff_src) - files = discover_markdown_files(basedir, api_prefix) - diff_files.append(((api_prefix, dst_prefix), files)) + current_script_path = os.path.abspath(__file__) + tools_dir = os.path.dirname(current_script_path) + base_dir = os.path.dirname(tools_dir) # 上一级目录 - print( - f"{len(files)} mapping documents found in {os.path.relpath(basedir, cfp_basedir)}." - ) - - metas = [] - for prefixs, files in diff_files: - s, d = prefixs - sh = get_table_header_by_prefix(s) - for f in files: - if os.path.basename(f) in validate_whitelist: - continue - metas.append(get_meta_from_diff_file(f, s, d, src_argmap_title=sh)) - - metas.sort(key=lambda x: x["src_api"]) - print(f"extracted {len(metas)} mapping metas data.") - return metas - - -if __name__ == "__main__": - # convert from pytorch basedir - tools_dir = os.path.dirname(__file__) - cfp_basedir = os.path.join(tools_dir, "..") - # pysrc_api_mapping_cn - mapping_index_file = os.path.join( - cfp_basedir, "deprecated/pytorch_api_mapping_cn_deprecated.md" - ) - - if not os.path.exists(mapping_index_file): - raise Exception(f"Cannot find mapping index file: {mapping_index_file}") + # 确定要校验的文件路径 + if args.file: + md_file_path = os.path.abspath(args.file) + else: + # 默认文件路径:上一级目录中的 pytorch_api_mapping_cn.md + md_file_path = os.path.join(base_dir, "pytorch_api_mapping_cn.md") - metas = discover_all_metas(cfp_basedir) + # 检查文件是否存在 + if not os.path.exists(md_file_path): + print(f"错误: 文件 '{md_file_path}' 不存在") + print("请使用 --file 参数指定正确的文件路径") + return - for m in metas: - if m["mapping_type"] not in mapping_type_set: - print(m) - raise Exception( - f"Unknown mapping type: {m['mapping_type']} in {m['source_file']}" - ) + # 读取文件所有行 + try: + with open(md_file_path, "r", encoding="utf-8") as f: + lines = f.readlines() + except Exception as e: + print(f"错误: 读取文件 '{md_file_path}' 时出错: {e!s}") + return - meta_dict = {m["src_api"].replace(r"\_", "_"): m for m in metas} + # 解析目录表格 + toc, toc_end_line = parse_toc(lines) - # 该文件用于 PaConvert 的文档对齐工作 - api_diff_output_path = os.path.join(tools_dir, "docs_mappings.json") + # 解析类别部分(从目录结束行之后开始) + if toc_end_line != -1: + category_lines = lines[toc_end_line + 1 :] + else: + category_lines = lines + categories = parse_categories(category_lines) + + print(f"正在校验文件: {md_file_path}") + print(f"找到 {len(toc)} 个目录条目") + print(f"找到 {len(categories)} 个类别") + + # 执行三个校验 + toc_warnings = check_toc_consistency(toc, categories) + unique_warnings = check_unique_torch_apis(categories) + link_warnings = check_links_exist(categories) + + # 输出警告到文件(保存在 tools_dir 路径下) + if toc_warnings: + output_path = os.path.join(tools_dir, "toc_warnings.txt") + with open(output_path, "w", encoding="utf-8") as f: + f.write("目录一致性校验警告:\n") + f.writelines(warning + "\n" for warning in toc_warnings) + print(f"生成 {output_path},包含 {len(toc_warnings)} 个警告") + + if unique_warnings: + output_path = os.path.join(tools_dir, "unique_warnings.txt") + with open(output_path, "w", encoding="utf-8") as f: + f.write("Torch API 唯一性校验警告:\n") + f.writelines(warning + "\n" for warning in unique_warnings) + print(f"生成 {output_path},包含 {len(unique_warnings)} 个警告") + + if link_warnings: + output_path = os.path.join(tools_dir, "link_warnings.txt") + with open(output_path, "w", encoding="utf-8") as f: + f.write("超链接存在性校验警告:\n") + f.writelines(warning + "\n" for warning in link_warnings) + print(f"生成 {output_path},包含 {len(link_warnings)} 个警告") + + # 如果没有警告,输出成功信息 + if not toc_warnings and not unique_warnings and not link_warnings: + print("所有校验通过,没有发现警告!") - with open(api_diff_output_path, "w", encoding="utf-8") as f: - json.dump(metas, f, ensure_ascii=False, indent=4) - generate_alias_lines_from_paconvert(tools_dir, meta_dict) +if __name__ == "__main__": + main() From 2438d829943607e0684fba7250b04a529cafd801 Mon Sep 17 00:00:00 2001 From: hd9568 <2358440725@qq.com> Date: Fri, 19 Sep 2025 10:10:37 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=E9=9C=80=E8=A6=81apply=5Freferences?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/apply_references.py | 386 ++++++++++++++++++ 1 file changed, 386 insertions(+) create mode 100644 docs/guides/model_convert/convert_from_pytorch/tools/apply_references.py diff --git a/docs/guides/model_convert/convert_from_pytorch/tools/apply_references.py b/docs/guides/model_convert/convert_from_pytorch/tools/apply_references.py new file mode 100644 index 00000000000..6cb637a7190 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/tools/apply_references.py @@ -0,0 +1,386 @@ +import argparse +import os +import re +import sys + +script_path = os.path.abspath(__file__) +tools_dir = os.path.dirname(__file__) +sys.path.append(tools_dir) + +cfp_basedir = os.path.join(tools_dir, "..") + +from validate_mapping_files import ( + DiffMeta, + IndexParserState, + discover_all_metas, + process_mapping_index as reference_mapping_item, +) + +accept_index_parser_state_set = { + IndexParserState.normal, + IndexParserState.table_sep_ignore, + IndexParserState.table_sep, + IndexParserState.table_row_ignore, + IndexParserState.table_row, +} + + +def mapping_type_to_description(mapping_type): + mapping_type_1 = [ + "无参数", + "参数完全一致", + "仅参数名不一致", + "paddle 参数更多", + "参数默认值不一致", + ] + + if mapping_type in mapping_type_1: + return "功能一致," + mapping_type, True + + mapping_type_2 = ["torch 参数更多"] + if mapping_type in mapping_type_2: + return "功能一致," + mapping_type, True + + mapping_type_3 = [ + # "参数不一致", + "返回参数类型不一致", + "输入参数类型不一致", + "输入参数用法不一致", + ] + if mapping_type in mapping_type_3: + return "功能一致," + mapping_type, True + + mapping_type_4 = ["组合替代实现"] + if mapping_type in mapping_type_4: + return "组合替代实现", True + + mapping_type_5 = ["涉及上下文修改"] + if mapping_type in mapping_type_5: + return "功能一致," + mapping_type, True + + mapping_type_6 = ["对应 API 不在主框架"] + if mapping_type in mapping_type_6: + return "对应 API 不在主框架【占位】", False + + mapping_type_7 = ["功能缺失"] + if mapping_type in mapping_type_7: + return "功能缺失", False + + mapping_type_delete = ["可删除"] + if mapping_type in mapping_type_delete: + return "无对应 API,可以直接删除,对网络一般无影响", False + + raise ValueError( + f"Unexpected PyTorch-PaddlePaddle api mapping type {mapping_type}, please check " + ) + return "【未知类型】", False + + +# 以后没有 REFERENCE-ITEM 需要维护了,全部从 api_difference/ 目录生成 +_REFERENCE_ITEM_PATTERN = re.compile( + r"^\| *REFERENCE-MAPPING-ITEM\( *(?P[^,]+) *, *(?P.+) *\) *\|$" +) +REFERENCE_TABLE_PATTERN = re.compile( + r"^\| *REFERENCE-MAPPING-TABLE\( *(?P[^,]+) *(, *max_depth *= *(?P\d+) *)?\) *\|$" +) +ALIAS_PATTERN = re.compile( + r"^\| *ALIAS-REFERENCE-ITEM\( *(?P[^,]+) *, *(?P[^,]+) *\) *\|$" +) +NOT_IMPLEMENTED_PATTERN = re.compile( + r"^\| *NOT-IMPLEMENTED-ITEM\( *(?P[^,]+) *, *(?P.+), *(?P.+) *\) *\|$" +) +IN_DEVELOPMENT_PATTERN = re.compile( + r"^\| *IN-DEVELOPMENT-PATTERN\( *(?P[^,]+) *, *(?P.+) *\) *\|$" +) + +DOCS_REPO_BASEURL = "https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/" + + +def docs_url_to_relative_page(url): + """将映射文档的 PaddlePaddle/docs url 转换为网页路径""" + if not url.startswith(DOCS_REPO_BASEURL): + return url + + md_path = url[len(DOCS_REPO_BASEURL) :] + if md_path.endswith(".md"): + return md_path[:-3] + ".html" + return md_path + + +def doc_path_to_relative_page(path): + """将映射文档的本地路径转换为网页相对路径""" + md_path = os.path.relpath(path, cfp_basedir) + + assert md_path.endswith(".md"), f"Unexpected mapping doc path: {path}" + + return md_path[:-3] + ".html" + + +def reference_table_match_to_condition(m): + api_prefix = m["api_prefix"].strip("`") + max_depth = m["max_depth"] + if max_depth is None: + max_depth = 255 + else: + max_depth = int(max_depth) + return api_prefix, max_depth + + +def get_referenced_api_columns(src_api, metadata_dict, alias=None): + assert src_api in metadata_dict, ( + f'Error: cannot find mapping doc of api "{src_api}"' + ) + api_data: DiffMeta = metadata_dict[src_api] + + diff_page_url = doc_path_to_relative_page(api_data["source_file"]) + + src_api_url = api_data["src_api_url"] + api_disp_name = src_api if alias is None else alias + src_api_column = f"[`{api_disp_name}`]({src_api_url})" + + mapping_type = api_data["mapping_type"] + mapping_type_column = mapping_type + + _mapping_type_desc, show_diff_url = mapping_type_to_description( + mapping_type + ) + desc_column = "" + if show_diff_url: + desc_column = f"[详细对比]({diff_page_url})" + if alias is not None: + desc_column = f"`{src_api}` 别名,{desc_column}" + + if "dst_api" not in api_data: + if mapping_type not in ["组合替代实现", "可删除", "功能缺失"]: + print(f"Error: cannot find dst_api for src_api: {src_api}") + dst_api_column = "" + else: + dst_api = api_data["dst_api"] + dst_api_url = api_data["dst_api_url"] + dst_api_column = f"[`{dst_api}`]({dst_api_url})" + + return [ + src_api_column, + dst_api_column, + mapping_type_column, + desc_column, + ] + + +def apply_reference_to_row_ex(line, metadata_dict, context, line_idx): + line = line.rstrip() + reference_table_match = REFERENCE_TABLE_PATTERN.match(line) + alias_match = ALIAS_PATTERN.match(line) + not_implemented_match = NOT_IMPLEMENTED_PATTERN.match(line) + in_development_match = IN_DEVELOPMENT_PATTERN.match(line) + + row_idx_s = str(context["table_row_idx"]) + + def record_api(api): + if api not in context["api_used_src"]: + context["api_used_src"][api] = [] + context["api_used_src"][api].append((line_idx, line)) + + if reference_table_match: + condition = reference_table_match_to_condition(reference_table_match) + api_list = context["c2a_dict"][ + condition + ] # 这个键一定存在,否则说明前面出错了 + output_lines = [] + cur_row_idx = context["table_row_idx"] + for api in api_list: + record_api(api) + + content = get_referenced_api_columns(api, metadata_dict) + content.insert(0, str(cur_row_idx)) + output = "| " + " | ".join(content) + " |\n" + output_lines.append(output) + cur_row_idx += 1 + # 因为外面会给 table_row_idx 自动加 1,所以这里减去 1 + context["table_row_idx"] = cur_row_idx - 1 + return output_lines + elif alias_match: + alias_name = alias_match["alias_name"].strip("`").replace(r"\_", "_") + + record_api(alias_name) + + src_api = alias_match["src_api"].strip("`").replace(r"\_", "_") + + content = get_referenced_api_columns( + src_api, metadata_dict, alias=alias_name + ) + + content.insert(0, row_idx_s) + + output = "| " + " | ".join(content) + " |\n" + return [output] + elif not_implemented_match: + src_api = ( + not_implemented_match["src_api"].strip("`").replace(r"\_", "_") + ) + record_api(src_api) + + src_api_url = not_implemented_match["src_api_url"].strip() + + src_api_column = f"[`{src_api}`]({src_api_url})" + + dst_api_column = "" + mapping_column = "功能缺失" + mapping_url_column = not_implemented_match["remark"].strip() + + content = [ + row_idx_s, + src_api_column, + dst_api_column, + mapping_column, + mapping_url_column, + ] + output = "| " + " | ".join(content) + " |\n" + return [output] + elif in_development_match: + src_api = in_development_match["src_api"].strip("`").replace(r"\_", "_") + record_api(src_api) + + src_api_url = in_development_match["src_api_url"].strip() + + src_api_column = f"[`{src_api}`]({src_api_url})" + + dst_api_column = "" + mapping_column = "映射关系开发中" + mapping_url_column = "" + + content = [ + row_idx_s, + src_api_column, + dst_api_column, + mapping_column, + mapping_url_column, + ] + output = "| " + " | ".join(content) + " |\n" + return [output] + else: + raise ValueError( + f"found manual-maintaining row at line [{line_idx}]: {line}" + ) + return [line] + + +def reference_mapping_item_processer(line, line_idx, state, output, context): + if not line.startswith("|"): + output.append(line) + return True + + metadata_dict = context.get("metadata_dict", {}) + + if state == IndexParserState.table_row: + # check content of table to process in common process + output_lines = apply_reference_to_row_ex( + line, metadata_dict, context, line_idx + 1 + ) + + output += output_lines + return True + elif state in accept_index_parser_state_set: + output.append(line) + return True + + print(state) + return False + + +def reference_table_scanner(line, _line_idx, state, output, context): + if not line.startswith("|"): + return True + + if state == IndexParserState.table_row: + # check content of table to process in common process + rtm = REFERENCE_TABLE_PATTERN.match(line) + if rtm: + condition = reference_table_match_to_condition(rtm) + context["table_conditions"].append(condition) + return True + elif state in accept_index_parser_state_set: + return True + + return False + + +def get_c2a_dict(conditions, meta_dict): + c2a_dict = {c: [] for c in conditions} + conditions.sort( + key=lambda c: (-len(c[0]), c[1]) + ) # 先按照字符串长度降序,随后按照最大深度升序 + for api in meta_dict: + for api_prefix, max_depth in conditions: + if not api.startswith(api_prefix): + continue + depth = len(api.split(".")) - 1 + if depth > max_depth: + continue + c2a_dict[(api_prefix, max_depth)].append(api) + break + else: + print(f"Warning: cannot find a suitable condition for api {api}") + + return c2a_dict + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument( + "-c", + "--check_only", + action="store_true", + help="Write back to the source file", + ) + args = parser.parse_args() + + CHECK_ONLY = args.check_only + + # pysrc_api_mapping_cn + mapping_index_file = os.path.join(cfp_basedir, "pytorch_api_mapping_cn.md") + + metas = discover_all_metas(cfp_basedir) + + meta_dict = {m["src_api"].replace(r"\_", "_"): m for m in metas} + + reference_context = { + "metadata_dict": meta_dict, + "ret_code": 0, + "output": [], + "table_conditions": [], + "api_used_src": {}, + } + + # 第一遍预读,用来分析有哪些表格和匹配条件 + ret_code = reference_mapping_item( + mapping_index_file, reference_table_scanner, reference_context + ) + assert ret_code == 0 + reference_context["output"] = [] + + # 现在 c2a_dict 包含每个条件对应的 api 列表 + c2a_dict = get_c2a_dict(reference_context["table_conditions"], meta_dict) + reference_context["c2a_dict"] = c2a_dict + + # 第二遍正式读,读并处理 + ret_code = reference_mapping_item( + mapping_index_file, reference_mapping_item_processer, reference_context + ) + + # 检查是否重复出现 + for api, rows in reference_context["api_used_src"].items(): + if len(rows) > 1: + row_ids = [r[0] for r in rows] + print(f"Error: {api} used in multiple rows: {row_ids}") + for row_id, line in rows: + print(f" - row [{row_id}]: {line}") + + # 如果只检查,就写到临时文件去 + output_path = mapping_index_file + if CHECK_ONLY: + output_path = os.path.join(tools_dir, "generated.tmp.md") + + with open(output_path, "w", encoding="utf-8") as f: + f.writelines(reference_context["output"]) + # 映射关系文件的保存流程移动至 `validate_mapping_in_api_difference.py` From 079bdead48a41c1da571ebfc247a3449f837f6d9 Mon Sep 17 00:00:00 2001 From: hd9568 <2358440725@qq.com> Date: Fri, 19 Sep 2025 10:39:16 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=E6=81=A2=E5=A4=8Dvalidate=5Fmapping=5Ffile?= =?UTF-8?q?s.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/get_docs_mappings.py | 780 -------------- .../convert_from_pytorch/tools/valid.py | 337 ++++++ .../tools/validate_mapping_files.py | 985 +++++++++++++----- 3 files changed, 1051 insertions(+), 1051 deletions(-) delete mode 100644 docs/guides/model_convert/convert_from_pytorch/tools/get_docs_mappings.py create mode 100644 docs/guides/model_convert/convert_from_pytorch/tools/valid.py diff --git a/docs/guides/model_convert/convert_from_pytorch/tools/get_docs_mappings.py b/docs/guides/model_convert/convert_from_pytorch/tools/get_docs_mappings.py deleted file mode 100644 index f57bfafe6b9..00000000000 --- a/docs/guides/model_convert/convert_from_pytorch/tools/get_docs_mappings.py +++ /dev/null @@ -1,780 +0,0 @@ -from __future__ import annotations - -import collections -import json -import os -import re -import sys -import traceback -import urllib -import urllib.parse -from enum import IntEnum -from typing import TypedDict - -PADDLE_DOCS_BASE_URL = "https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/" - -validate_whitelist = [] - -mapping_type_levels = [ - # type 0 - ["UNDEFINED_MAPPING_TYPE_0"], - # type 1 - [ - "无参数", - "参数完全一致", - "仅参数名不一致", - "paddle 参数更多", - "参数默认值不一致", - ], - # type 2 - [ - "torch 参数更多", - ], - # type 3 - [ - "返回参数类型不一致", - "输入参数类型不一致", - "输入参数用法不一致", - ], - # type 4 - [ - "组合替代实现", - ], - # type 5 - [ - "涉及上下文修改", - ], - # type 6 - [ - "对应 API 不在主框架", - ], - # type 7 - [ - "功能缺失", - ], - # delete - [ - "可删除", - ], -] - -mapping_type_set = {t for ts in mapping_type_levels for t in ts} -mapping_type_to_level = { - t: level for level, ts in enumerate(mapping_type_levels) for t in ts -} - - -class DiffMeta(TypedDict): - src_api: str - src_api_url: str | None - src_signature: str | None - dst_api: str | None - dst_api_url: str | None - dst_signature: str | None - args_mapping: list[dict[str, str]] | None - mapping_type: str - source_file: str - - -class IndexParserState(IntEnum): - error = -1 - normal = 0 - table_sep = 1 - table_row = 2 - table_sep_ignore = 3 - table_row_ignore = 4 - - -class ParserState(IntEnum): - wait_for_title = 0 - - wait_for_src_api = 1 - wait_for_src_signature_begin = 2 - wait_for_src_signature = 3 - wait_for_src_signature_end = 4 - - wait_for_dst_api = 5 - wait_for_dst_signature_begin = 6 - wait_for_dst_signature = 7 - wait_for_dst_signature_end = 8 - - wait_for_args = 9 - wait_for_args_table_title = 10 - wait_for_args_table_sep = 11 - wait_for_args_table_end = 12 - - end = 13 - - -def unescape_api(api): - return api.replace(r"\_", "_") - - -def split_args(args_str): - """ - 按逗号分割参数字符串,忽略括号内的逗号 - """ - args = [] - current = [] - stack = [] - brackets = {"(": ")", "[": "]", "{": "}"} - closing = {v: k for k, v in brackets.items()} - - for char in args_str: - if char in brackets: - stack.append(brackets[char]) - elif char in closing: - if stack and stack[-1] == char: - stack.pop() - else: - raise ValueError(f"Unmatched closing bracket: {char}") - elif char == "," and not stack: - arg = "".join(current).strip() - if arg: - args.append(arg) - current = [] - continue - current.append(char) - - arg = "".join(current).strip() - if arg: - args.append(arg) - return args - - -def split_signatures(buffer): - """ - 分割包含多个函数签名的字符串 - """ - signatures = [] - current = [] - stack = [] - brackets = {"(": ")", "[": "]", "{": "}"} - closing = {v: k for k, v in brackets.items()} - - for char in buffer: - if char in brackets: - stack.append(brackets[char]) - elif char in closing: - if stack and stack[-1] == char: - stack.pop() - else: - raise ValueError(f"Unmatched closing bracket: {char}") - current.append(char) - if char == ")" and not stack: - # End of a function signature - signature = "".join(current).strip() - signatures.append(signature) - current = [] - - if current: - signatures.append("".join(current).strip()) - - return signatures - - -def reformat_signature(code): - """ - 从函数签名代码中解析出函数名和参数列表 - - code: 函数签名代码,可能包含多个函数声明 - - 返回值: 包含所有函数名和参数列表的列表 - """ - lines = [l for l in code.split("\n") if len(l.strip()) > 0] - assert len(lines) > 0, "code have no lines." - buffer = "".join([l.strip() for l in lines]) - - signatures = split_signatures(buffer) - - parsed_signatures = [] - - arg_pattern = re.compile( - r"^(?P[^\=\:]+)" # 参数名 - r"(?:\s*\:\s*(?P[^=]+))?" # 可选的类型注解 - r"(?:\s*\=\s*(?P.+))?$" # 可选的默认值 - ) - - for sig in signatures: - first_par_pos = sig.find("(") - m = re.match(r"^\s*(?P[^\( ]+)(.*?)$", sig) - assert m is not None, f'code first line "{sig}" not match api pattern.' - api_name = m.group("api_name") - - if first_par_pos < 0: - # 要是没括号,可能是特殊情况,比如 property - parsed_signatures.append({"api_name": api_name}) - continue - - last_par_pos = sig.rfind(")") - assert last_par_pos > first_par_pos, ( - f'code first line "{sig}" not match api pattern.' - ) - args_buffer = sig[first_par_pos + 1 : last_par_pos] - - args = [] - args_buffer = args_buffer.strip() - - arg_buffer_list = split_args(args_buffer) - - for arg_buffer in arg_buffer_list: - m = arg_pattern.match(arg_buffer) - assert m is not None, ( - f'code arg "{arg_buffer}" not match arg pattern.' - ) - arg_name = m.group("arg_name").strip() - arg_type = ( - m.group("arg_type").strip() if m.group("arg_type") else None - ) - arg_default = ( - m.group("arg_default").strip() - if m.group("arg_default") - else None - ) - - if ( - arg_name.startswith("*") - or arg_name.startswith("**") - or arg_name[0].isalpha() - or arg_name[0] == "_" - ): - # if is a valid arg name - args.append( - { - "arg_name": arg_name, - "arg_type": arg_type, - "arg_default": arg_default, - } - ) - else: - if args: - if args[-1]["arg_default"] is not None: - args[-1]["arg_default"] += f", {arg_name}" - else: - args[-1]["arg_default"] = arg_name - else: - raise ValueError(f"Invalid argument format: {arg_buffer}") - - parsed_signatures.append({"api_name": api_name, "args": args}) - - return parsed_signatures - - -def get_meta_from_diff_file( - filepath, - src_prefix="torch.", - dst_prefix="paddle.", - src_argmap_title="PyTorch", - dst_argmap_title="PaddlePaddle", -): - """ - 该函数从指定的映射文件中解析出元数据信息 - - filepath: 映射文件路径 - - src_prefix: 需要映射的 API 前缀 - - dst_prefix: 映射目标 API 前缀 - - 返回值: DiffMeta 类型的元数据信息 - """ - meta_data: DiffMeta = {"source_file": filepath} - state = ParserState.wait_for_title - title_pattern = re.compile(r"^## +\[(?P[^\]]+)\] *(?P.+)$") - torch_pattern = re.compile( - rf"^### +\[ *(?P{re.escape(src_prefix)}[^\]]+)\](?P\([^\)]*\))?$" - ) - paddle_pattern = re.compile( - rf"^### +\[ *(?P{re.escape(dst_prefix)}[^\]]+)\](\((?P[^\)]*)\))?$" - ) - code_begin_pattern = re.compile(r"^```python$") - code_pattern = re.compile(r"^(?P[^#][^\( ]+)(.*?)$") - code_end_pattern = re.compile(r"^```$") - - args_pattern = re.compile(r"^### 参数映射$") - ARGS_EXPECT_HEADERS = [src_argmap_title, dst_argmap_title, "备注"] - - mapping_type = "" - signature_cache = None - - with open(filepath, "r", encoding="utf-8") as f: - for line in f: - # 现在需要考虑内容信息了 - # if not line.startswith("##"): - # continue - - if state == ParserState.wait_for_title: - title_match = title_pattern.match(line) - if title_match: - mapping_type = title_match["type"].strip() - src_api = unescape_api(title_match["src_api"].strip()) - meta_data["src_api"] = unescape_api(src_api) - meta_data["mapping_type"] = mapping_type - - if mapping_type not in mapping_type_set: - raise ValueError( - f"Unexpected mapping type: {mapping_type} in {filepath}" - ) - - state = ParserState.wait_for_src_api - else: - raise Exception(f"Cannot parse title: {line} in {filepath}") - elif state == ParserState.wait_for_src_api: - torch_match = torch_pattern.match(line) - - if torch_match: - src_api = torch_match["src_api"].strip() - torch_url = torch_match["url"] if torch_match["url"] else "" - real_url = torch_url.lstrip("(").rstrip(")") - if meta_data["src_api"] != unescape_api(src_api): - raise Exception( - f"torch api not match: {line} != {meta_data['src_api']} in {filepath}" - ) - meta_data["src_api_url"] = real_url - state = ParserState.wait_for_src_signature_begin - elif state == ParserState.wait_for_dst_api: - paddle_pattern = re.compile( - rf"^### +\[ *(?P{re.escape(dst_prefix)}[^\]]+)\](\((?P[^\)]*)\))?$" - ) - paddle_match = paddle_pattern.match(line) - - if paddle_match: - dst_api = paddle_match["dst_api"].strip() - paddle_url = paddle_match["url"].strip() - meta_data["dst_api"] = unescape_api(dst_api) - meta_data["dst_api_url"] = paddle_url - state = ParserState.wait_for_dst_signature_begin - elif state in [ - ParserState.wait_for_src_signature_begin, - ParserState.wait_for_dst_signature_begin, - ]: - cb_match = code_begin_pattern.match(line) - - if cb_match: - if state == ParserState.wait_for_src_signature_begin: - state = ParserState.wait_for_src_signature - elif state == ParserState.wait_for_dst_signature_begin: - state = ParserState.wait_for_dst_signature - else: - raise ValueError( - f"Unexpected state {state} when process {filepath} line: {line}" - ) - elif state in [ - ParserState.wait_for_src_signature, - ParserState.wait_for_dst_signature, - ]: - code_match = code_pattern.match(line) - - if code_match: - api_name = code_match["api_name"].strip() - if state == ParserState.wait_for_src_signature: - if api_name != meta_data["src_api"]: - raise ValueError( - f"Unexpected api code {api_name} != {meta_data['src_api']} when process {filepath} line: {line}" - ) - else: - state = ParserState.wait_for_src_signature_end - signature_cache = line - elif state == ParserState.wait_for_dst_signature: - if api_name != meta_data["dst_api"]: - raise ValueError( - f"Unexpected api code {api_name} != {meta_data['dst_api']} when process {filepath} line: {line}" - ) - else: - state = ParserState.wait_for_dst_signature_end - signature_cache = line - else: - # 如果写注释,就先不管了 - if line[0] != "#": - raise ValueError( - f"Api code must appear after ```, but not found correct signature when process {filepath} line: {line}." - ) - elif state in [ - ParserState.wait_for_src_signature_end, - ParserState.wait_for_dst_signature_end, - ]: - ce_match = code_end_pattern.match(line) - - if ce_match: - try: - signature_info = reformat_signature(signature_cache) - signature_cache = None - except AssertionError as e: - raise Exception( - f"Cannot parse signature code in {filepath}" - ) from e - - if state == ParserState.wait_for_src_signature_end: - meta_data["src_signature"] = signature_info - state = ParserState.wait_for_dst_api - elif state == ParserState.wait_for_dst_signature_end: - meta_data["dst_signature"] = signature_info - state = ParserState.wait_for_args - else: - raise ValueError( - f"Unexpected state {state} when process {filepath} line: {line}" - ) - else: - # not match, append line to cache - if state == ParserState.wait_for_src_signature_end: - signature_cache += line - elif state == ParserState.wait_for_dst_signature_end: - signature_cache += line - else: - raise ValueError( - f"Unexpected state {state} when process {filepath} line: {line}" - ) - elif state == ParserState.wait_for_args: - args_match = args_pattern.match(line) - if args_match: - state = ParserState.wait_for_args_table_title - elif state == ParserState.wait_for_args_table_title: - if line.startswith("|"): - args_table_headers = [ - c.strip() for c in line.split("|") if len(c.strip()) > 0 - ] - if args_table_headers != ARGS_EXPECT_HEADERS: - raise Exception( - f"args mapping table headers mismatch, expect {ARGS_EXPECT_HEADERS}, but got {args_table_headers} in {filepath} ." - ) - else: - state = ParserState.wait_for_args_table_sep - meta_data["args_mapping"] = [] - elif state == ParserState.wait_for_args_table_sep: - if line.startswith("|"): - args_table_seps = [ - c.strip() for c in line.split("|") if len(c.strip()) > 0 - ] - if len(args_table_seps) == len(ARGS_EXPECT_HEADERS): - state = ParserState.wait_for_args_table_end - else: - raise Exception( - f"Unexpected args table seps: {args_table_seps} in {filepath}" - ) - else: - raise Exception( - f"Unexpected args table sep: {line} in {filepath}" - ) - elif state == ParserState.wait_for_args_table_end: - if line.startswith("|"): - args_table_content = [c.strip() for c in line.split("|")][ - 1:-1 - ] - if len(args_table_content) == len(ARGS_EXPECT_HEADERS): - torch_arg, paddle_arg, note = args_table_content - meta_data["args_mapping"].append( - { - "src_arg": torch_arg, - "dst_arg": paddle_arg, - "note": note, - } - ) - else: - raise Exception( - f"Unexpected args table end: {args_table_content} in {filepath}" - ) - else: - state = ParserState.end - elif state == ParserState.end: - break - else: - raise ValueError( - f"Unexpected state {state} when process {filepath} line: {line}" - ) - - # 允许没有参数映射列表 - if mapping_type in ["无参数", "组合替代实现"]: - if state == ParserState.wait_for_args: - state = ParserState.end - # 必须有参数映射列表,但是可以随时停止 - else: - if state == ParserState.wait_for_args_table_end: - state = ParserState.end - - if not mapping_type: - raise Exception( - f"Cannot get mapping_type in parsing file: {filepath}, current meta: {meta_data}" - ) - - # 允许的终止状态,解析完了 dst_api 或者只有 src_api - # 映射类型前三个级别必须要有对应的 dst_api - if mapping_type_to_level[mapping_type] <= 3: - if state != ParserState.end: - print(state) - raise Exception( - f"Unexpected End State at {state} in parsing file: {filepath}, current meta: {meta_data}" - ) - else: - if state not in [ParserState.end, ParserState.wait_for_dst_api]: - raise Exception( - f"Unexpected End State at {state} in parsing file: {filepath}, current meta: {meta_data}" - ) - - return meta_data - - -def process_mapping_index(index_path, item_processer, context={}): - """ - 线性处理 `pytorch_api_mapping_cn.md` 文件 - - index_path: 该 md 文件路径 - - item_processer: 对文件每行的处理方式,输入参数 (line, line_idx, state, output, context)。 - 如果处理出错则返回 False,否则返回 True。 - - context: 用于存储处理过程中的上下文信息 - - output: 使用 context["output"] 初始化,如果不调用 item_processer,直接加入原文件对应行,否则 item_processer 处理 output 逻辑。 - - 返回值:是否成功处理,成功返回 0。 - """ - if not os.path.exists(index_path): - raise Exception(f"Cannot find pytorch_api_mapping_cn.md: {index_path}") - - with open(index_path, "r", encoding="utf-8") as f: - lines = f.readlines() - - state = IndexParserState.normal - - column_names = [] - column_count = -1 - table_seperator_pattern = re.compile(r"^ *\|(?P *-+ *\|)+ *$") - - expect_column_names = [ - "序号", - "Pytorch 最新 release", - "Paddle develop", - "映射关系分类", - "备注", - ] - - context["table_row_idx"] = context.get("table_row_idx", -1) - output = context.get("output", []) - - for i, line in enumerate(lines): - if state == IndexParserState.error: - break - - content = line.strip() - if not content.startswith("|"): - output.append(line) - state = IndexParserState.normal - continue - - columns = [c.strip() for c in content.split("|")] - columns = [c for c in columns if len(c) > 0] - - if state == IndexParserState.normal: - column_names.clear() - column_names.extend([c.strip() for c in columns]) - column_count = len(column_names) - - if not item_processer(line, i, state, output, context): - break - - if column_names == expect_column_names: - state = IndexParserState.table_sep - context["table_row_idx"] = 1 - # print(f'process mapping table at line {i+1}.') - else: - state = IndexParserState.table_sep_ignore - print(f"ignore table with {column_names} at line {i + 1}.") - - elif state == IndexParserState.table_sep_ignore: - if ( - not table_seperator_pattern.match(line) - or len(columns) != column_count - ): - raise Exception( - f"Table seperator not match at line {i + 1}: {line}" - ) - if not item_processer(line, i, state, output, context): - break - state = IndexParserState.table_row_ignore - elif state == IndexParserState.table_sep: - if ( - not table_seperator_pattern.match(line) - or len(columns) != column_count - ): - raise Exception( - f"Table seperator not match at line {i + 1}: {line}" - ) - if not item_processer(line, i, state, output, context): - break - state = IndexParserState.table_row - elif state == IndexParserState.table_row_ignore: - if not item_processer(line, i, state, output, context): - break - elif state == IndexParserState.table_row: - try: - context["columns"] = columns - if not item_processer(line, i, state, output, context): - break - context["table_row_idx"] += 1 - except Exception as e: - print(e) - print(f"Error at line {i + 1}: {line}") - traceback.print_exc() - ret_code = 1 - sys.exit(-IndexParserState.table_row) - else: - ret_code = 2 - raise Exception( - f"Unexpected State at {state} in processing file: {index_path}" - ) - - if state in [IndexParserState.table_row, IndexParserState.table_row_ignore]: - state = IndexParserState.normal - - if state != IndexParserState.normal: - raise Exception( - f"Unexpected End State at {state} in parsing file: {index_path}" - ) - - ret_code = context.get("ret_code", 0xCC) - if ret_code != 0: - return ret_code - - context["output"] = output - - return 0 - - -def get_doc_url_from_meta(basedir, meta): - relpath = os.path.relpath(meta["source_file"], basedir).replace("\\", "/") - diffurl = urllib.parse.urljoin(PADDLE_DOCS_BASE_URL, relpath) - return diffurl - - -def generate_alias_lines_from_paconvert(basedir, meta_dict) -> None: - alias_filename = "api_alias_mapping.json" - alias_filepath = os.path.join(basedir, alias_filename) - if not os.path.exists(alias_filepath) or not os.path.isfile(alias_filepath): - return - - alias_refer_failed_list = [] - alias_output = {} - with open(alias_filepath, "r", encoding="utf-8") as f: - api_alias = json.load(f) - for alias_name, api_name in api_alias.items(): - if api_name in meta_dict: - pass - elif alias_name in meta_dict: - # 如果反着有,就交换 - api_name, alias_name = alias_name, api_name - else: - # 都没有就抛出警告 - alias_refer_failed_list.append((alias_name, api_name)) - continue - - meta_data = meta_dict[api_name] - - dst_api = meta_data.get("dst_api", "-") - mapping_type = meta_data["mapping_type"] - url = get_doc_url_from_meta(basedir, meta_data) - - alias_col = f"`{alias_name}`" - paddle_col = f"`{dst_api}`" - if "src_api_url" in meta_data: - alias_col = f"[{alias_col}]({meta_data['src_api_url']})" - if "dst_api_url" in meta_data: - paddle_col = f"[{paddle_col}]({meta_data['dst_api_url']})" - - macro_line = f"ALIAS-REFERENCE-ITEM(`{alias_name}`, `{api_name}`)" - alias_output[alias_name] = macro_line - - output_path = os.path.join(basedir, "alias_macro_lines.tmp.md") - with open(output_path, "w", encoding="utf-8") as f: - od_apis = collections.OrderedDict(sorted(alias_output.items())) - f.writelines(f"| {ref} |\n" for api, ref in od_apis.items()) - - print(f'generated alias temp file: "{output_path}"') - - if len(alias_refer_failed_list) > 0: - fail_log_path = os.path.join(basedir, "alias_refer_failed.log") - with open(fail_log_path, "w", encoding="utf-8") as f: - for alias_name, api_name in alias_refer_failed_list: - f.write( - f"api `{api_name}` have no mapping doc, failed to reference from alias `{alias_name}`\n" - ) - - print( - f'{len(alias_refer_failed_list)} alias reference failed, see log file: "{fail_log_path}"' - ) - - -def discover_markdown_files(base_dir, prefix="torch."): - pattern = re.compile(f"^{re.escape(prefix)}.*{re.escape('.md')}$") - markdown_files = [] - for path, _, file_list in os.walk(base_dir): - for filename in file_list: - if pattern.match(filename): - markdown_files.append(os.path.join(path, filename)) - return markdown_files - - -ARG_MAPPING_TABLE_HEADERS = {"torch.": "PyTorch"} - - -def get_table_header_by_prefix(prefix): - if prefix in ARG_MAPPING_TABLE_HEADERS: - return ARG_MAPPING_TABLE_HEADERS[prefix] - assert prefix.endswith("."), f"prefix must end with '.' but got {prefix}" - return prefix.rstrip(".") - - -def discover_all_metas(cfp_basedir): - # 获取 api_difference/ 下的 api 映射文档 - diff_3rd_basedir = os.path.join(cfp_basedir, "api_difference_third_party") - - diff_srcs = [("api_difference", "torch.", "paddle.")] - diff_srcs.extend( - [ - (os.path.join(diff_3rd_basedir, subdir), f"{subdir}.", "") - for subdir in os.listdir(diff_3rd_basedir) - ] - ) - - diff_files = [] - for diff_src, api_prefix, dst_prefix in diff_srcs: - basedir = os.path.join(cfp_basedir, diff_src) - files = discover_markdown_files(basedir, api_prefix) - diff_files.append(((api_prefix, dst_prefix), files)) - - print( - f"{len(files)} mapping documents found in {os.path.relpath(basedir, cfp_basedir)}." - ) - - metas = [] - for prefixs, files in diff_files: - s, d = prefixs - sh = get_table_header_by_prefix(s) - for f in files: - if os.path.basename(f) in validate_whitelist: - continue - metas.append(get_meta_from_diff_file(f, s, d, src_argmap_title=sh)) - - metas.sort(key=lambda x: x["src_api"]) - print(f"extracted {len(metas)} mapping metas data.") - return metas - - -if __name__ == "__main__": - # convert from pytorch basedir - tools_dir = os.path.dirname(__file__) - cfp_basedir = os.path.join(tools_dir, "..") - # pysrc_api_mapping_cn - mapping_index_file = os.path.join( - cfp_basedir, "deprecated/pytorch_api_mapping_cn_deprecated.md" - ) - - if not os.path.exists(mapping_index_file): - raise Exception(f"Cannot find mapping index file: {mapping_index_file}") - - metas = discover_all_metas(cfp_basedir) - - for m in metas: - if m["mapping_type"] not in mapping_type_set: - print(m) - raise Exception( - f"Unknown mapping type: {m['mapping_type']} in {m['source_file']}" - ) - - meta_dict = {m["src_api"].replace(r"\_", "_"): m for m in metas} - - # 该文件用于 PaConvert 的文档对齐工作 - api_diff_output_path = os.path.join(tools_dir, "docs_mappings.json") - - with open(api_diff_output_path, "w", encoding="utf-8") as f: - json.dump(metas, f, ensure_ascii=False, indent=4) - - generate_alias_lines_from_paconvert(tools_dir, meta_dict) diff --git a/docs/guides/model_convert/convert_from_pytorch/tools/valid.py b/docs/guides/model_convert/convert_from_pytorch/tools/valid.py new file mode 100644 index 00000000000..af2fcf112a9 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/tools/valid.py @@ -0,0 +1,337 @@ +import argparse +import os +import re +from collections import defaultdict + +# 默认文件路径 +DEFAULT_FILE_PATH = "/workspace/paddleDocs/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md" + + +def parse_toc(lines): + """ + 解析目录表格,返回目录条目列表和结束行号 + """ + toc = [] + toc_end_line = -1 + in_toc = False + found_header = False + + for i, line in enumerate(lines): + line = line.strip() + + if line == "## API 映射表目录": + in_toc = True + continue + + if in_toc: + if line.startswith("|") and "序号" in line and "类别" in line: + found_header = True + continue + + if ( + found_header + and line.startswith("|") + and re.match(r"^\|?[-:\s|]+\|?$", line) + ): + continue # 跳过分隔行 + + if found_header and line.startswith("|"): + # 解析数据行 + columns = [col.strip() for col in line.split("|")[1:-1]] + if len(columns) >= 2: + toc.append((columns[0], columns[1])) # (序号, 类别名称) + else: + # 表格结束 + if found_header: + toc_end_line = i + break + + return toc, toc_end_line + + +def parse_categories(lines): + """ + 解析类别部分,提取所有类别及其表格数据 + """ + categories = [] + current_category = None + current_table = [] + in_table = False + + for line in lines: + line = line.strip() + + # 检测类别标题 (## X. 类别名称) + category_match = re.match(r"^## (\d+)\. (.+)$", line) + if category_match: + # 保存前一个类别和表格 + if current_category is not None: + categories.append( + { + "id": current_category["id"], + "name": current_category["name"], + "table": current_table, + } + ) + + # 开始新类别 + current_category = { + "id": int(category_match.group(1)), + "name": category_match.group(2), + } + current_table = [] + in_table = False + continue + + # 检测表格开始 + if line.startswith("|") and "Pytorch" in line and "Paddle" in line: + in_table = True + continue + + # 检测表格行 + if in_table and line.startswith("|"): + # 跳过表头分隔行 + if re.match(r"^\|?[-:\s|]+\|?$", line): + continue + + # 解析表格行 + columns = [col.strip() for col in line.split("|")[1:-1]] + if len(columns) >= 4: + current_table.append( + { + "index": columns[0], + "pytorch": columns[1], + "paddle": columns[2], + "note": columns[3] if len(columns) > 3 else "", + } + ) + continue + + # 检测表格结束 + if in_table and not line.startswith("|") and line != "": + in_table = False + + # 添加最后一个类别 + if current_category is not None: + categories.append( + { + "id": current_category["id"], + "name": current_category["name"], + "table": current_table, + } + ) + + return categories + + +def extract_links(text): + """ + 从文本中提取所有超链接 + """ + return re.findall(r"\[([^\]]+)\]\(([^)]+)\)", text) + + +def check_toc_consistency(toc, categories): + """ + 检查目录与类别标题的一致性 + """ + warnings = [] + + # 检查数量是否一致 + if len(toc) != len(categories): + warnings.append( + f"目录中有 {len(toc)} 个类别,但实际找到 {len(categories)} 个类别" + ) + + # 检查每个类别的序号和名称是否匹配 + for i, (toc_index, toc_name) in enumerate(toc): + if i >= len(categories): + break + + cat = categories[i] + if str(cat["id"]) != toc_index: + warnings.append( + f"目录中第 {i + 1} 个类别序号为 {toc_index},但实际类别序号为 {cat['id']}" + ) + + if cat["name"] != toc_name: + warnings.append( + f"目录中第 {i + 1} 个类别名称为 '{toc_name}',但实际类别名称为 '{cat['name']}'" + ) + + return warnings + + +def check_unique_torch_apis(categories): + """ + 检查 torch API 是否唯一 + """ + torch_apis = defaultdict(list) # api -> [category_ids] + + for category in categories: + for row in category["table"]: + links = extract_links(row["pytorch"]) + if links: + api_name = links[0][0] # 取第一个链接的文本作为 API 名称 + torch_apis[api_name].append(category["id"]) + + # 检查重复的 API + warnings = [] + for api, category_ids in torch_apis.items(): + if len(category_ids) > 1: + warning_msg = f"Torch API '{api}' 在多个类别中出现: {category_ids}" + warnings.append(warning_msg) + + return warnings + + +def check_links_exist(categories): + """ + 检查必要的超链接是否存在(根据新规则) + 规则: + 1. 第二列(Pytorch)必须有超链接 + 2. 第三列(Paddle): + - 对于"组合替代实现"、"可删除"、"功能缺失"类别,如果内容为空或"-"则不检查 + - 否则必须有超链接 + 3. 第四列(备注): 除了"API完全一致类别"(类别1)外,都需要有超链接 + """ + warnings = [] + + for category in categories: + category_id = category["id"] + category_name = category["name"] + + for i, row in enumerate(category["table"]): + row_num = i + 1 # 行号从1开始 + + # 1. 检查第二列 (Pytorch) 必须有超链接 + pytorch_links = extract_links(row["pytorch"]) + if not pytorch_links: + warning_msg = f"类别 {category_id}({category_name}) 第 {row_num} 行第二列缺少超链接: {row['pytorch']}" + warnings.append(warning_msg) + + # 2. 检查第三列 (Paddle) + paddle_content = row["paddle"].strip() + paddle_links = extract_links(row["paddle"]) + + # 特殊处理:组合替代实现、可删除、功能缺失 + special_cases = ["组合替代实现", "可删除", "功能缺失"] + is_special_case = any( + case in category_name for case in special_cases + ) + + if is_special_case: + # 对于特殊类别,只有内容不为空且不是"-"时才检查链接 + if ( + paddle_content + and paddle_content != "-" + and not paddle_links + ): + warning_msg = f"类别 {category_id}({category_name}) 第 {row_num} 行第三列内容不为空但缺少超链接: {row['paddle']}" + warnings.append(warning_msg) + else: + # 对于其他类别,必须有超链接 + if not paddle_links: + warning_msg = f"类别 {category_id}({category_name}) 第 {row_num} 行第三列缺少超链接: {row['paddle']}" + warnings.append(warning_msg) + + # 3. 检查第四列 (备注) + note_links = extract_links(row["note"]) + note_content = row["note"].strip() + + # 除了类别1(API完全一致类别)外,都需要有超链接 + if ( + category_id != 1 + and note_content + and note_content != "-" + and not note_links + ): + warning_msg = f"类别 {category_id}({category_name}) 第 {row_num} 行第四列缺少超链接: {row['note']}" + warnings.append(warning_msg) + + return warnings + + +def main(): + parser = argparse.ArgumentParser(description="Markdown 文件校验工具") + parser.add_argument( + "--file", + "-f", + help="要校验的 Markdown 文件路径", + default=DEFAULT_FILE_PATH, + ) + args = parser.parse_args() + + current_script_path = os.path.abspath(__file__) + tools_dir = os.path.dirname(current_script_path) + base_dir = os.path.dirname(tools_dir) # 上一级目录 + + # 确定要校验的文件路径 + if args.file: + md_file_path = os.path.abspath(args.file) + else: + # 默认文件路径:上一级目录中的 pytorch_api_mapping_cn.md + md_file_path = os.path.join(base_dir, "pytorch_api_mapping_cn.md") + + # 检查文件是否存在 + if not os.path.exists(md_file_path): + print(f"错误: 文件 '{md_file_path}' 不存在") + print("请使用 --file 参数指定正确的文件路径") + return + + # 读取文件所有行 + try: + with open(md_file_path, "r", encoding="utf-8") as f: + lines = f.readlines() + except Exception as e: + print(f"错误: 读取文件 '{md_file_path}' 时出错: {e!s}") + return + + # 解析目录表格 + toc, toc_end_line = parse_toc(lines) + + # 解析类别部分(从目录结束行之后开始) + if toc_end_line != -1: + category_lines = lines[toc_end_line + 1 :] + else: + category_lines = lines + categories = parse_categories(category_lines) + + print(f"正在校验文件: {md_file_path}") + print(f"找到 {len(toc)} 个目录条目") + print(f"找到 {len(categories)} 个类别") + + # 执行三个校验 + toc_warnings = check_toc_consistency(toc, categories) + unique_warnings = check_unique_torch_apis(categories) + link_warnings = check_links_exist(categories) + + # 输出警告到文件(保存在 tools_dir 路径下) + if toc_warnings: + output_path = os.path.join(tools_dir, "toc_warnings.txt") + with open(output_path, "w", encoding="utf-8") as f: + f.write("目录一致性校验警告:\n") + f.writelines(warning + "\n" for warning in toc_warnings) + print(f"生成 {output_path},包含 {len(toc_warnings)} 个警告") + + if unique_warnings: + output_path = os.path.join(tools_dir, "unique_warnings.txt") + with open(output_path, "w", encoding="utf-8") as f: + f.write("Torch API 唯一性校验警告:\n") + f.writelines(warning + "\n" for warning in unique_warnings) + print(f"生成 {output_path},包含 {len(unique_warnings)} 个警告") + + if link_warnings: + output_path = os.path.join(tools_dir, "link_warnings.txt") + with open(output_path, "w", encoding="utf-8") as f: + f.write("超链接存在性校验警告:\n") + f.writelines(warning + "\n" for warning in link_warnings) + print(f"生成 {output_path},包含 {len(link_warnings)} 个警告") + + # 如果没有警告,输出成功信息 + if not toc_warnings and not unique_warnings and not link_warnings: + print("所有校验通过,没有发现警告!") + + +if __name__ == "__main__": + main() diff --git a/docs/guides/model_convert/convert_from_pytorch/tools/validate_mapping_files.py b/docs/guides/model_convert/convert_from_pytorch/tools/validate_mapping_files.py index af2fcf112a9..f57bfafe6b9 100644 --- a/docs/guides/model_convert/convert_from_pytorch/tools/validate_mapping_files.py +++ b/docs/guides/model_convert/convert_from_pytorch/tools/validate_mapping_files.py @@ -1,337 +1,780 @@ -import argparse +from __future__ import annotations + +import collections +import json import os import re -from collections import defaultdict +import sys +import traceback +import urllib +import urllib.parse +from enum import IntEnum +from typing import TypedDict + +PADDLE_DOCS_BASE_URL = "https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/" + +validate_whitelist = [] + +mapping_type_levels = [ + # type 0 + ["UNDEFINED_MAPPING_TYPE_0"], + # type 1 + [ + "无参数", + "参数完全一致", + "仅参数名不一致", + "paddle 参数更多", + "参数默认值不一致", + ], + # type 2 + [ + "torch 参数更多", + ], + # type 3 + [ + "返回参数类型不一致", + "输入参数类型不一致", + "输入参数用法不一致", + ], + # type 4 + [ + "组合替代实现", + ], + # type 5 + [ + "涉及上下文修改", + ], + # type 6 + [ + "对应 API 不在主框架", + ], + # type 7 + [ + "功能缺失", + ], + # delete + [ + "可删除", + ], +] + +mapping_type_set = {t for ts in mapping_type_levels for t in ts} +mapping_type_to_level = { + t: level for level, ts in enumerate(mapping_type_levels) for t in ts +} + + +class DiffMeta(TypedDict): + src_api: str + src_api_url: str | None + src_signature: str | None + dst_api: str | None + dst_api_url: str | None + dst_signature: str | None + args_mapping: list[dict[str, str]] | None + mapping_type: str + source_file: str + + +class IndexParserState(IntEnum): + error = -1 + normal = 0 + table_sep = 1 + table_row = 2 + table_sep_ignore = 3 + table_row_ignore = 4 + + +class ParserState(IntEnum): + wait_for_title = 0 + + wait_for_src_api = 1 + wait_for_src_signature_begin = 2 + wait_for_src_signature = 3 + wait_for_src_signature_end = 4 + + wait_for_dst_api = 5 + wait_for_dst_signature_begin = 6 + wait_for_dst_signature = 7 + wait_for_dst_signature_end = 8 + + wait_for_args = 9 + wait_for_args_table_title = 10 + wait_for_args_table_sep = 11 + wait_for_args_table_end = 12 + + end = 13 + + +def unescape_api(api): + return api.replace(r"\_", "_") + + +def split_args(args_str): + """ + 按逗号分割参数字符串,忽略括号内的逗号 + """ + args = [] + current = [] + stack = [] + brackets = {"(": ")", "[": "]", "{": "}"} + closing = {v: k for k, v in brackets.items()} + + for char in args_str: + if char in brackets: + stack.append(brackets[char]) + elif char in closing: + if stack and stack[-1] == char: + stack.pop() + else: + raise ValueError(f"Unmatched closing bracket: {char}") + elif char == "," and not stack: + arg = "".join(current).strip() + if arg: + args.append(arg) + current = [] + continue + current.append(char) -# 默认文件路径 -DEFAULT_FILE_PATH = "/workspace/paddleDocs/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md" + arg = "".join(current).strip() + if arg: + args.append(arg) + return args -def parse_toc(lines): +def split_signatures(buffer): """ - 解析目录表格,返回目录条目列表和结束行号 + 分割包含多个函数签名的字符串 """ - toc = [] - toc_end_line = -1 - in_toc = False - found_header = False + signatures = [] + current = [] + stack = [] + brackets = {"(": ")", "[": "]", "{": "}"} + closing = {v: k for k, v in brackets.items()} + + for char in buffer: + if char in brackets: + stack.append(brackets[char]) + elif char in closing: + if stack and stack[-1] == char: + stack.pop() + else: + raise ValueError(f"Unmatched closing bracket: {char}") + current.append(char) + if char == ")" and not stack: + # End of a function signature + signature = "".join(current).strip() + signatures.append(signature) + current = [] - for i, line in enumerate(lines): - line = line.strip() + if current: + signatures.append("".join(current).strip()) - if line == "## API 映射表目录": - in_toc = True - continue + return signatures - if in_toc: - if line.startswith("|") and "序号" in line and "类别" in line: - found_header = True - continue - if ( - found_header - and line.startswith("|") - and re.match(r"^\|?[-:\s|]+\|?$", line) - ): - continue # 跳过分隔行 +def reformat_signature(code): + """ + 从函数签名代码中解析出函数名和参数列表 + - code: 函数签名代码,可能包含多个函数声明 + - 返回值: 包含所有函数名和参数列表的列表 + """ + lines = [l for l in code.split("\n") if len(l.strip()) > 0] + assert len(lines) > 0, "code have no lines." + buffer = "".join([l.strip() for l in lines]) - if found_header and line.startswith("|"): - # 解析数据行 - columns = [col.strip() for col in line.split("|")[1:-1]] - if len(columns) >= 2: - toc.append((columns[0], columns[1])) # (序号, 类别名称) - else: - # 表格结束 - if found_header: - toc_end_line = i - break + signatures = split_signatures(buffer) - return toc, toc_end_line + parsed_signatures = [] + arg_pattern = re.compile( + r"^(?P[^\=\:]+)" # 参数名 + r"(?:\s*\:\s*(?P[^=]+))?" # 可选的类型注解 + r"(?:\s*\=\s*(?P.+))?$" # 可选的默认值 + ) -def parse_categories(lines): - """ - 解析类别部分,提取所有类别及其表格数据 - """ - categories = [] - current_category = None - current_table = [] - in_table = False - - for line in lines: - line = line.strip() - - # 检测类别标题 (## X. 类别名称) - category_match = re.match(r"^## (\d+)\. (.+)$", line) - if category_match: - # 保存前一个类别和表格 - if current_category is not None: - categories.append( - { - "id": current_category["id"], - "name": current_category["name"], - "table": current_table, - } - ) + for sig in signatures: + first_par_pos = sig.find("(") + m = re.match(r"^\s*(?P[^\( ]+)(.*?)$", sig) + assert m is not None, f'code first line "{sig}" not match api pattern.' + api_name = m.group("api_name") - # 开始新类别 - current_category = { - "id": int(category_match.group(1)), - "name": category_match.group(2), - } - current_table = [] - in_table = False + if first_par_pos < 0: + # 要是没括号,可能是特殊情况,比如 property + parsed_signatures.append({"api_name": api_name}) continue - # 检测表格开始 - if line.startswith("|") and "Pytorch" in line and "Paddle" in line: - in_table = True - continue + last_par_pos = sig.rfind(")") + assert last_par_pos > first_par_pos, ( + f'code first line "{sig}" not match api pattern.' + ) + args_buffer = sig[first_par_pos + 1 : last_par_pos] - # 检测表格行 - if in_table and line.startswith("|"): - # 跳过表头分隔行 - if re.match(r"^\|?[-:\s|]+\|?$", line): - continue + args = [] + args_buffer = args_buffer.strip() + + arg_buffer_list = split_args(args_buffer) + + for arg_buffer in arg_buffer_list: + m = arg_pattern.match(arg_buffer) + assert m is not None, ( + f'code arg "{arg_buffer}" not match arg pattern.' + ) + arg_name = m.group("arg_name").strip() + arg_type = ( + m.group("arg_type").strip() if m.group("arg_type") else None + ) + arg_default = ( + m.group("arg_default").strip() + if m.group("arg_default") + else None + ) - # 解析表格行 - columns = [col.strip() for col in line.split("|")[1:-1]] - if len(columns) >= 4: - current_table.append( + if ( + arg_name.startswith("*") + or arg_name.startswith("**") + or arg_name[0].isalpha() + or arg_name[0] == "_" + ): + # if is a valid arg name + args.append( { - "index": columns[0], - "pytorch": columns[1], - "paddle": columns[2], - "note": columns[3] if len(columns) > 3 else "", + "arg_name": arg_name, + "arg_type": arg_type, + "arg_default": arg_default, } ) - continue + else: + if args: + if args[-1]["arg_default"] is not None: + args[-1]["arg_default"] += f", {arg_name}" + else: + args[-1]["arg_default"] = arg_name + else: + raise ValueError(f"Invalid argument format: {arg_buffer}") + + parsed_signatures.append({"api_name": api_name, "args": args}) + + return parsed_signatures + + +def get_meta_from_diff_file( + filepath, + src_prefix="torch.", + dst_prefix="paddle.", + src_argmap_title="PyTorch", + dst_argmap_title="PaddlePaddle", +): + """ + 该函数从指定的映射文件中解析出元数据信息 + - filepath: 映射文件路径 + - src_prefix: 需要映射的 API 前缀 + - dst_prefix: 映射目标 API 前缀 + - 返回值: DiffMeta 类型的元数据信息 + """ + meta_data: DiffMeta = {"source_file": filepath} + state = ParserState.wait_for_title + title_pattern = re.compile(r"^## +\[(?P[^\]]+)\] *(?P.+)$") + torch_pattern = re.compile( + rf"^### +\[ *(?P{re.escape(src_prefix)}[^\]]+)\](?P\([^\)]*\))?$" + ) + paddle_pattern = re.compile( + rf"^### +\[ *(?P{re.escape(dst_prefix)}[^\]]+)\](\((?P[^\)]*)\))?$" + ) + code_begin_pattern = re.compile(r"^```python$") + code_pattern = re.compile(r"^(?P[^#][^\( ]+)(.*?)$") + code_end_pattern = re.compile(r"^```$") + + args_pattern = re.compile(r"^### 参数映射$") + ARGS_EXPECT_HEADERS = [src_argmap_title, dst_argmap_title, "备注"] + + mapping_type = "" + signature_cache = None + + with open(filepath, "r", encoding="utf-8") as f: + for line in f: + # 现在需要考虑内容信息了 + # if not line.startswith("##"): + # continue + + if state == ParserState.wait_for_title: + title_match = title_pattern.match(line) + if title_match: + mapping_type = title_match["type"].strip() + src_api = unescape_api(title_match["src_api"].strip()) + meta_data["src_api"] = unescape_api(src_api) + meta_data["mapping_type"] = mapping_type + + if mapping_type not in mapping_type_set: + raise ValueError( + f"Unexpected mapping type: {mapping_type} in {filepath}" + ) + + state = ParserState.wait_for_src_api + else: + raise Exception(f"Cannot parse title: {line} in {filepath}") + elif state == ParserState.wait_for_src_api: + torch_match = torch_pattern.match(line) + + if torch_match: + src_api = torch_match["src_api"].strip() + torch_url = torch_match["url"] if torch_match["url"] else "" + real_url = torch_url.lstrip("(").rstrip(")") + if meta_data["src_api"] != unescape_api(src_api): + raise Exception( + f"torch api not match: {line} != {meta_data['src_api']} in {filepath}" + ) + meta_data["src_api_url"] = real_url + state = ParserState.wait_for_src_signature_begin + elif state == ParserState.wait_for_dst_api: + paddle_pattern = re.compile( + rf"^### +\[ *(?P{re.escape(dst_prefix)}[^\]]+)\](\((?P[^\)]*)\))?$" + ) + paddle_match = paddle_pattern.match(line) + + if paddle_match: + dst_api = paddle_match["dst_api"].strip() + paddle_url = paddle_match["url"].strip() + meta_data["dst_api"] = unescape_api(dst_api) + meta_data["dst_api_url"] = paddle_url + state = ParserState.wait_for_dst_signature_begin + elif state in [ + ParserState.wait_for_src_signature_begin, + ParserState.wait_for_dst_signature_begin, + ]: + cb_match = code_begin_pattern.match(line) + + if cb_match: + if state == ParserState.wait_for_src_signature_begin: + state = ParserState.wait_for_src_signature + elif state == ParserState.wait_for_dst_signature_begin: + state = ParserState.wait_for_dst_signature + else: + raise ValueError( + f"Unexpected state {state} when process {filepath} line: {line}" + ) + elif state in [ + ParserState.wait_for_src_signature, + ParserState.wait_for_dst_signature, + ]: + code_match = code_pattern.match(line) + + if code_match: + api_name = code_match["api_name"].strip() + if state == ParserState.wait_for_src_signature: + if api_name != meta_data["src_api"]: + raise ValueError( + f"Unexpected api code {api_name} != {meta_data['src_api']} when process {filepath} line: {line}" + ) + else: + state = ParserState.wait_for_src_signature_end + signature_cache = line + elif state == ParserState.wait_for_dst_signature: + if api_name != meta_data["dst_api"]: + raise ValueError( + f"Unexpected api code {api_name} != {meta_data['dst_api']} when process {filepath} line: {line}" + ) + else: + state = ParserState.wait_for_dst_signature_end + signature_cache = line + else: + # 如果写注释,就先不管了 + if line[0] != "#": + raise ValueError( + f"Api code must appear after ```, but not found correct signature when process {filepath} line: {line}." + ) + elif state in [ + ParserState.wait_for_src_signature_end, + ParserState.wait_for_dst_signature_end, + ]: + ce_match = code_end_pattern.match(line) + + if ce_match: + try: + signature_info = reformat_signature(signature_cache) + signature_cache = None + except AssertionError as e: + raise Exception( + f"Cannot parse signature code in {filepath}" + ) from e + + if state == ParserState.wait_for_src_signature_end: + meta_data["src_signature"] = signature_info + state = ParserState.wait_for_dst_api + elif state == ParserState.wait_for_dst_signature_end: + meta_data["dst_signature"] = signature_info + state = ParserState.wait_for_args + else: + raise ValueError( + f"Unexpected state {state} when process {filepath} line: {line}" + ) + else: + # not match, append line to cache + if state == ParserState.wait_for_src_signature_end: + signature_cache += line + elif state == ParserState.wait_for_dst_signature_end: + signature_cache += line + else: + raise ValueError( + f"Unexpected state {state} when process {filepath} line: {line}" + ) + elif state == ParserState.wait_for_args: + args_match = args_pattern.match(line) + if args_match: + state = ParserState.wait_for_args_table_title + elif state == ParserState.wait_for_args_table_title: + if line.startswith("|"): + args_table_headers = [ + c.strip() for c in line.split("|") if len(c.strip()) > 0 + ] + if args_table_headers != ARGS_EXPECT_HEADERS: + raise Exception( + f"args mapping table headers mismatch, expect {ARGS_EXPECT_HEADERS}, but got {args_table_headers} in {filepath} ." + ) + else: + state = ParserState.wait_for_args_table_sep + meta_data["args_mapping"] = [] + elif state == ParserState.wait_for_args_table_sep: + if line.startswith("|"): + args_table_seps = [ + c.strip() for c in line.split("|") if len(c.strip()) > 0 + ] + if len(args_table_seps) == len(ARGS_EXPECT_HEADERS): + state = ParserState.wait_for_args_table_end + else: + raise Exception( + f"Unexpected args table seps: {args_table_seps} in {filepath}" + ) + else: + raise Exception( + f"Unexpected args table sep: {line} in {filepath}" + ) + elif state == ParserState.wait_for_args_table_end: + if line.startswith("|"): + args_table_content = [c.strip() for c in line.split("|")][ + 1:-1 + ] + if len(args_table_content) == len(ARGS_EXPECT_HEADERS): + torch_arg, paddle_arg, note = args_table_content + meta_data["args_mapping"].append( + { + "src_arg": torch_arg, + "dst_arg": paddle_arg, + "note": note, + } + ) + else: + raise Exception( + f"Unexpected args table end: {args_table_content} in {filepath}" + ) + else: + state = ParserState.end + elif state == ParserState.end: + break + else: + raise ValueError( + f"Unexpected state {state} when process {filepath} line: {line}" + ) + + # 允许没有参数映射列表 + if mapping_type in ["无参数", "组合替代实现"]: + if state == ParserState.wait_for_args: + state = ParserState.end + # 必须有参数映射列表,但是可以随时停止 + else: + if state == ParserState.wait_for_args_table_end: + state = ParserState.end - # 检测表格结束 - if in_table and not line.startswith("|") and line != "": - in_table = False - - # 添加最后一个类别 - if current_category is not None: - categories.append( - { - "id": current_category["id"], - "name": current_category["name"], - "table": current_table, - } + if not mapping_type: + raise Exception( + f"Cannot get mapping_type in parsing file: {filepath}, current meta: {meta_data}" ) - return categories + # 允许的终止状态,解析完了 dst_api 或者只有 src_api + # 映射类型前三个级别必须要有对应的 dst_api + if mapping_type_to_level[mapping_type] <= 3: + if state != ParserState.end: + print(state) + raise Exception( + f"Unexpected End State at {state} in parsing file: {filepath}, current meta: {meta_data}" + ) + else: + if state not in [ParserState.end, ParserState.wait_for_dst_api]: + raise Exception( + f"Unexpected End State at {state} in parsing file: {filepath}, current meta: {meta_data}" + ) + + return meta_data -def extract_links(text): +def process_mapping_index(index_path, item_processer, context={}): """ - 从文本中提取所有超链接 + 线性处理 `pytorch_api_mapping_cn.md` 文件 + - index_path: 该 md 文件路径 + - item_processer: 对文件每行的处理方式,输入参数 (line, line_idx, state, output, context)。 + 如果处理出错则返回 False,否则返回 True。 + - context: 用于存储处理过程中的上下文信息 + - output: 使用 context["output"] 初始化,如果不调用 item_processer,直接加入原文件对应行,否则 item_processer 处理 output 逻辑。 + - 返回值:是否成功处理,成功返回 0。 """ - return re.findall(r"\[([^\]]+)\]\(([^)]+)\)", text) + if not os.path.exists(index_path): + raise Exception(f"Cannot find pytorch_api_mapping_cn.md: {index_path}") + with open(index_path, "r", encoding="utf-8") as f: + lines = f.readlines() -def check_toc_consistency(toc, categories): - """ - 检查目录与类别标题的一致性 - """ - warnings = [] + state = IndexParserState.normal - # 检查数量是否一致 - if len(toc) != len(categories): - warnings.append( - f"目录中有 {len(toc)} 个类别,但实际找到 {len(categories)} 个类别" - ) + column_names = [] + column_count = -1 + table_seperator_pattern = re.compile(r"^ *\|(?P *-+ *\|)+ *$") - # 检查每个类别的序号和名称是否匹配 - for i, (toc_index, toc_name) in enumerate(toc): - if i >= len(categories): + expect_column_names = [ + "序号", + "Pytorch 最新 release", + "Paddle develop", + "映射关系分类", + "备注", + ] + + context["table_row_idx"] = context.get("table_row_idx", -1) + output = context.get("output", []) + + for i, line in enumerate(lines): + if state == IndexParserState.error: break - cat = categories[i] - if str(cat["id"]) != toc_index: - warnings.append( - f"目录中第 {i + 1} 个类别序号为 {toc_index},但实际类别序号为 {cat['id']}" - ) + content = line.strip() + if not content.startswith("|"): + output.append(line) + state = IndexParserState.normal + continue - if cat["name"] != toc_name: - warnings.append( - f"目录中第 {i + 1} 个类别名称为 '{toc_name}',但实际类别名称为 '{cat['name']}'" - ) + columns = [c.strip() for c in content.split("|")] + columns = [c for c in columns if len(c) > 0] - return warnings + if state == IndexParserState.normal: + column_names.clear() + column_names.extend([c.strip() for c in columns]) + column_count = len(column_names) + if not item_processer(line, i, state, output, context): + break -def check_unique_torch_apis(categories): - """ - 检查 torch API 是否唯一 - """ - torch_apis = defaultdict(list) # api -> [category_ids] + if column_names == expect_column_names: + state = IndexParserState.table_sep + context["table_row_idx"] = 1 + # print(f'process mapping table at line {i+1}.') + else: + state = IndexParserState.table_sep_ignore + print(f"ignore table with {column_names} at line {i + 1}.") - for category in categories: - for row in category["table"]: - links = extract_links(row["pytorch"]) - if links: - api_name = links[0][0] # 取第一个链接的文本作为 API 名称 - torch_apis[api_name].append(category["id"]) + elif state == IndexParserState.table_sep_ignore: + if ( + not table_seperator_pattern.match(line) + or len(columns) != column_count + ): + raise Exception( + f"Table seperator not match at line {i + 1}: {line}" + ) + if not item_processer(line, i, state, output, context): + break + state = IndexParserState.table_row_ignore + elif state == IndexParserState.table_sep: + if ( + not table_seperator_pattern.match(line) + or len(columns) != column_count + ): + raise Exception( + f"Table seperator not match at line {i + 1}: {line}" + ) + if not item_processer(line, i, state, output, context): + break + state = IndexParserState.table_row + elif state == IndexParserState.table_row_ignore: + if not item_processer(line, i, state, output, context): + break + elif state == IndexParserState.table_row: + try: + context["columns"] = columns + if not item_processer(line, i, state, output, context): + break + context["table_row_idx"] += 1 + except Exception as e: + print(e) + print(f"Error at line {i + 1}: {line}") + traceback.print_exc() + ret_code = 1 + sys.exit(-IndexParserState.table_row) + else: + ret_code = 2 + raise Exception( + f"Unexpected State at {state} in processing file: {index_path}" + ) - # 检查重复的 API - warnings = [] - for api, category_ids in torch_apis.items(): - if len(category_ids) > 1: - warning_msg = f"Torch API '{api}' 在多个类别中出现: {category_ids}" - warnings.append(warning_msg) + if state in [IndexParserState.table_row, IndexParserState.table_row_ignore]: + state = IndexParserState.normal - return warnings + if state != IndexParserState.normal: + raise Exception( + f"Unexpected End State at {state} in parsing file: {index_path}" + ) + ret_code = context.get("ret_code", 0xCC) + if ret_code != 0: + return ret_code -def check_links_exist(categories): - """ - 检查必要的超链接是否存在(根据新规则) - 规则: - 1. 第二列(Pytorch)必须有超链接 - 2. 第三列(Paddle): - - 对于"组合替代实现"、"可删除"、"功能缺失"类别,如果内容为空或"-"则不检查 - - 否则必须有超链接 - 3. 第四列(备注): 除了"API完全一致类别"(类别1)外,都需要有超链接 - """ - warnings = [] + context["output"] = output - for category in categories: - category_id = category["id"] - category_name = category["name"] + return 0 - for i, row in enumerate(category["table"]): - row_num = i + 1 # 行号从1开始 - # 1. 检查第二列 (Pytorch) 必须有超链接 - pytorch_links = extract_links(row["pytorch"]) - if not pytorch_links: - warning_msg = f"类别 {category_id}({category_name}) 第 {row_num} 行第二列缺少超链接: {row['pytorch']}" - warnings.append(warning_msg) +def get_doc_url_from_meta(basedir, meta): + relpath = os.path.relpath(meta["source_file"], basedir).replace("\\", "/") + diffurl = urllib.parse.urljoin(PADDLE_DOCS_BASE_URL, relpath) + return diffurl - # 2. 检查第三列 (Paddle) - paddle_content = row["paddle"].strip() - paddle_links = extract_links(row["paddle"]) - # 特殊处理:组合替代实现、可删除、功能缺失 - special_cases = ["组合替代实现", "可删除", "功能缺失"] - is_special_case = any( - case in category_name for case in special_cases - ) +def generate_alias_lines_from_paconvert(basedir, meta_dict) -> None: + alias_filename = "api_alias_mapping.json" + alias_filepath = os.path.join(basedir, alias_filename) + if not os.path.exists(alias_filepath) or not os.path.isfile(alias_filepath): + return - if is_special_case: - # 对于特殊类别,只有内容不为空且不是"-"时才检查链接 - if ( - paddle_content - and paddle_content != "-" - and not paddle_links - ): - warning_msg = f"类别 {category_id}({category_name}) 第 {row_num} 行第三列内容不为空但缺少超链接: {row['paddle']}" - warnings.append(warning_msg) + alias_refer_failed_list = [] + alias_output = {} + with open(alias_filepath, "r", encoding="utf-8") as f: + api_alias = json.load(f) + for alias_name, api_name in api_alias.items(): + if api_name in meta_dict: + pass + elif alias_name in meta_dict: + # 如果反着有,就交换 + api_name, alias_name = alias_name, api_name else: - # 对于其他类别,必须有超链接 - if not paddle_links: - warning_msg = f"类别 {category_id}({category_name}) 第 {row_num} 行第三列缺少超链接: {row['paddle']}" - warnings.append(warning_msg) + # 都没有就抛出警告 + alias_refer_failed_list.append((alias_name, api_name)) + continue - # 3. 检查第四列 (备注) - note_links = extract_links(row["note"]) - note_content = row["note"].strip() + meta_data = meta_dict[api_name] - # 除了类别1(API完全一致类别)外,都需要有超链接 - if ( - category_id != 1 - and note_content - and note_content != "-" - and not note_links - ): - warning_msg = f"类别 {category_id}({category_name}) 第 {row_num} 行第四列缺少超链接: {row['note']}" - warnings.append(warning_msg) + dst_api = meta_data.get("dst_api", "-") + mapping_type = meta_data["mapping_type"] + url = get_doc_url_from_meta(basedir, meta_data) - return warnings + alias_col = f"`{alias_name}`" + paddle_col = f"`{dst_api}`" + if "src_api_url" in meta_data: + alias_col = f"[{alias_col}]({meta_data['src_api_url']})" + if "dst_api_url" in meta_data: + paddle_col = f"[{paddle_col}]({meta_data['dst_api_url']})" + macro_line = f"ALIAS-REFERENCE-ITEM(`{alias_name}`, `{api_name}`)" + alias_output[alias_name] = macro_line -def main(): - parser = argparse.ArgumentParser(description="Markdown 文件校验工具") - parser.add_argument( - "--file", - "-f", - help="要校验的 Markdown 文件路径", - default=DEFAULT_FILE_PATH, - ) - args = parser.parse_args() + output_path = os.path.join(basedir, "alias_macro_lines.tmp.md") + with open(output_path, "w", encoding="utf-8") as f: + od_apis = collections.OrderedDict(sorted(alias_output.items())) + f.writelines(f"| {ref} |\n" for api, ref in od_apis.items()) - current_script_path = os.path.abspath(__file__) - tools_dir = os.path.dirname(current_script_path) - base_dir = os.path.dirname(tools_dir) # 上一级目录 + print(f'generated alias temp file: "{output_path}"') - # 确定要校验的文件路径 - if args.file: - md_file_path = os.path.abspath(args.file) - else: - # 默认文件路径:上一级目录中的 pytorch_api_mapping_cn.md - md_file_path = os.path.join(base_dir, "pytorch_api_mapping_cn.md") + if len(alias_refer_failed_list) > 0: + fail_log_path = os.path.join(basedir, "alias_refer_failed.log") + with open(fail_log_path, "w", encoding="utf-8") as f: + for alias_name, api_name in alias_refer_failed_list: + f.write( + f"api `{api_name}` have no mapping doc, failed to reference from alias `{alias_name}`\n" + ) - # 检查文件是否存在 - if not os.path.exists(md_file_path): - print(f"错误: 文件 '{md_file_path}' 不存在") - print("请使用 --file 参数指定正确的文件路径") - return + print( + f'{len(alias_refer_failed_list)} alias reference failed, see log file: "{fail_log_path}"' + ) - # 读取文件所有行 - try: - with open(md_file_path, "r", encoding="utf-8") as f: - lines = f.readlines() - except Exception as e: - print(f"错误: 读取文件 '{md_file_path}' 时出错: {e!s}") - return - # 解析目录表格 - toc, toc_end_line = parse_toc(lines) +def discover_markdown_files(base_dir, prefix="torch."): + pattern = re.compile(f"^{re.escape(prefix)}.*{re.escape('.md')}$") + markdown_files = [] + for path, _, file_list in os.walk(base_dir): + for filename in file_list: + if pattern.match(filename): + markdown_files.append(os.path.join(path, filename)) + return markdown_files + + +ARG_MAPPING_TABLE_HEADERS = {"torch.": "PyTorch"} + + +def get_table_header_by_prefix(prefix): + if prefix in ARG_MAPPING_TABLE_HEADERS: + return ARG_MAPPING_TABLE_HEADERS[prefix] + assert prefix.endswith("."), f"prefix must end with '.' but got {prefix}" + return prefix.rstrip(".") - # 解析类别部分(从目录结束行之后开始) - if toc_end_line != -1: - category_lines = lines[toc_end_line + 1 :] - else: - category_lines = lines - categories = parse_categories(category_lines) - - print(f"正在校验文件: {md_file_path}") - print(f"找到 {len(toc)} 个目录条目") - print(f"找到 {len(categories)} 个类别") - - # 执行三个校验 - toc_warnings = check_toc_consistency(toc, categories) - unique_warnings = check_unique_torch_apis(categories) - link_warnings = check_links_exist(categories) - - # 输出警告到文件(保存在 tools_dir 路径下) - if toc_warnings: - output_path = os.path.join(tools_dir, "toc_warnings.txt") - with open(output_path, "w", encoding="utf-8") as f: - f.write("目录一致性校验警告:\n") - f.writelines(warning + "\n" for warning in toc_warnings) - print(f"生成 {output_path},包含 {len(toc_warnings)} 个警告") - - if unique_warnings: - output_path = os.path.join(tools_dir, "unique_warnings.txt") - with open(output_path, "w", encoding="utf-8") as f: - f.write("Torch API 唯一性校验警告:\n") - f.writelines(warning + "\n" for warning in unique_warnings) - print(f"生成 {output_path},包含 {len(unique_warnings)} 个警告") - - if link_warnings: - output_path = os.path.join(tools_dir, "link_warnings.txt") - with open(output_path, "w", encoding="utf-8") as f: - f.write("超链接存在性校验警告:\n") - f.writelines(warning + "\n" for warning in link_warnings) - print(f"生成 {output_path},包含 {len(link_warnings)} 个警告") - - # 如果没有警告,输出成功信息 - if not toc_warnings and not unique_warnings and not link_warnings: - print("所有校验通过,没有发现警告!") + +def discover_all_metas(cfp_basedir): + # 获取 api_difference/ 下的 api 映射文档 + diff_3rd_basedir = os.path.join(cfp_basedir, "api_difference_third_party") + + diff_srcs = [("api_difference", "torch.", "paddle.")] + diff_srcs.extend( + [ + (os.path.join(diff_3rd_basedir, subdir), f"{subdir}.", "") + for subdir in os.listdir(diff_3rd_basedir) + ] + ) + + diff_files = [] + for diff_src, api_prefix, dst_prefix in diff_srcs: + basedir = os.path.join(cfp_basedir, diff_src) + files = discover_markdown_files(basedir, api_prefix) + diff_files.append(((api_prefix, dst_prefix), files)) + + print( + f"{len(files)} mapping documents found in {os.path.relpath(basedir, cfp_basedir)}." + ) + + metas = [] + for prefixs, files in diff_files: + s, d = prefixs + sh = get_table_header_by_prefix(s) + for f in files: + if os.path.basename(f) in validate_whitelist: + continue + metas.append(get_meta_from_diff_file(f, s, d, src_argmap_title=sh)) + + metas.sort(key=lambda x: x["src_api"]) + print(f"extracted {len(metas)} mapping metas data.") + return metas if __name__ == "__main__": - main() + # convert from pytorch basedir + tools_dir = os.path.dirname(__file__) + cfp_basedir = os.path.join(tools_dir, "..") + # pysrc_api_mapping_cn + mapping_index_file = os.path.join( + cfp_basedir, "deprecated/pytorch_api_mapping_cn_deprecated.md" + ) + + if not os.path.exists(mapping_index_file): + raise Exception(f"Cannot find mapping index file: {mapping_index_file}") + + metas = discover_all_metas(cfp_basedir) + + for m in metas: + if m["mapping_type"] not in mapping_type_set: + print(m) + raise Exception( + f"Unknown mapping type: {m['mapping_type']} in {m['source_file']}" + ) + + meta_dict = {m["src_api"].replace(r"\_", "_"): m for m in metas} + + # 该文件用于 PaConvert 的文档对齐工作 + api_diff_output_path = os.path.join(tools_dir, "docs_mappings.json") + + with open(api_diff_output_path, "w", encoding="utf-8") as f: + json.dump(metas, f, ensure_ascii=False, indent=4) + + generate_alias_lines_from_paconvert(tools_dir, meta_dict) From 2c4d141bc954db215674926dd1d5781b351c1df0 Mon Sep 17 00:00:00 2001 From: hd9568 <2358440725@qq.com> Date: Fri, 19 Sep 2025 11:18:10 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=8D=A2=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../convert_from_pytorch/pytorch_api_mapping_cn.md | 12 ++++++++++++ .../tools/generate_mapping_files.py | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md b/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md index 54c6e054838..00d93dc27c7 100644 --- a/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md +++ b/docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md @@ -43,6 +43,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) + | 序号 | Pytorch 最新 release | Paddle develop | 备注 | |------|-------------------|---------------|------| | 1 | [torch.Tensor.bfloat16](https://pytorch.org/docs/stable/generated/torch.Tensor.bfloat16.html#torch.Tensor.bfloat16) | paddle.Tensor.bfloat16 | - | @@ -506,6 +507,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 459 | torch.Tensor.scatter | paddle.Tensor.scatter | - | | 460 | torch.Tensor.scatter_ | paddle.Tensor.scatter_ | - | | 461 | torch.scatter | paddle.scatter | - | + ## 2. 仅 API 调用方式不一致 **分类简介** @@ -514,6 +516,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) 包括:API 名称不同、API 路径不同、Tensor 类方法改成普通方法、Tensor 方法改成属性、Tensor 属性改成方法 等情况。 + | 序号 | Pytorch 最新 release | Paddle develop | 备注 | |------|-------------------|---------------|------| | 1 | [torch.Tensor.clamp_](https://pytorch.org/docs/stable/generated/torch.Tensor.clamp_.html?highlight=clamp_#torch.Tensor.clamp_) | [paddle.Tensor.clip_](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#id6) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.clamp_.md) | @@ -612,6 +615,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 94 | [torchvision.transforms.functional.pad](https://pytorch.org/vision/main/generated/torchvision.transforms.functional.pad.html) | [paddle.vision.transforms.pad](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/transforms/pad_cn.html) | - | | 95 | [torchvision.transforms.functional.to_grayscale](https://pytorch.org/vision/main/generated/torchvision.transforms.functional.to_grayscale.html?highlight=to_grayscale#torchvision.transforms.functional.to_grayscale) | [paddle.vision.transforms.to_grayscale](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/vision/transforms/to_grayscale_cn.html#to-grayscale) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.transforms.functional.to_grayscale.md) | | 96 | [torchvision.transforms.functional.vflip](https://pytorch.org/vision/main/generated/torchvision.transforms.functional.vflip.html) | [paddle.vision.transforms.vflip](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/vision/transforms/vflip_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.transforms.functional.vflip.md) | + ## 3. 仅参数名不一致 **分类简介** @@ -850,6 +854,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 226 | [torchvision.io.read_file](https://pytorch.org/vision/main/generated/torchvision.io.read_file.html) | [paddle.vision.ops.read_file](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/ops/read_file_cn.html#cn-api-paddle-vision-ops-read-file) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.io.read_file.md) | | 227 | [transformers.StoppingCriteriaList](https://github.com/huggingface/transformers/blob/d625294d79341662784495551abdf45e6cb9372f/src/transformers/generation/stopping_criteria.py#L503) | [paddlenlp.generation.StoppingCriteriaList](https://github.com/PaddlePaddle/PaddleNLP/blob/e336e78c338d2514ee6c937982ce5d8c960b85ff/paddlenlp/generation/stopping_criteria.py#L72) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.StoppingCriteriaList.md) | | 228 | [transformers.generation.LogitsProcessor](https://hf-mirror.com/docs/transformers/v4.42.0/en/internal/generation_utils#logitsprocessor) | [paddlenlp.generation.LogitsProcessor](https://github.com/PaddlePaddle/PaddleNLP/blob/e336e78c338d2514ee6c937982ce5d8c960b85ff/paddlenlp/generation/logits_process.py#L26) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.generation.LogitsProcessor.md) | + ## 4. paddle 参数更多 **分类简介** @@ -982,6 +987,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 120 | [torchvision.transforms.ToTensor](https://pytorch.org/vision/main/generated/torchvision.transforms.ToTensor.html?highlight=totensor#torchvision.transforms.ToTensor) | [paddle.vision.transforms.ToTensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/vision/transforms/ToTensor_cn.html#totensor) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.transforms.ToTensor.md) | | 121 | [torchvision.transforms.functional.to_tensor](https://pytorch.org/vision/main/generated/torchvision.transforms.functional.to_tensor.html) | [paddle.vision.transforms.to_tensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/vision/transforms/to_tensor_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.transforms.functional.to_tensor.md) | | 122 | [torchvision.ops.DeformConv2d](https://pytorch.org/vision/main/generated/torchvision.ops.DeformConv2d.html) | [paddle.vision.ops.DeformConv2D](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/ops/DeformConv2D_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.ops.DeformConv2d.md) | + ## 5. 参数默认值不一致 **分类简介** @@ -998,6 +1004,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 4 | [torch.alpha_dropout](https://pytorch.org/docs/master/generated/torch.nn.functional.alpha_dropout.html) | [paddle.nn.functional.alpha_dropout](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/functional/alpha_dropout_cn.html#alpha-dropout) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.alpha_dropout.md) | | 5 | [torch.rrelu](https://pytorch.org/docs/stable/generated/torch.nn.functional.rrelu.html#torch.nn.functional.rrelu) | [paddle.nn.functional.rrelu](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/nn/functional/rrelu_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.rrelu.md) | | 6 | [torch.cuda.amp.GradScaler](https://pytorch.org/docs/stable/amp.html#torch.cuda.amp.GradScaler) | [paddle.amp.GradScaler](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/amp/GradScaler_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/cuda/torch.cuda.amp.GradScaler.md) | + ## 6. torch 参数更多 **分类简介** @@ -1424,6 +1431,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 414 | [transformers.GenerationConfig](https://hf-mirror.com/docs/transformers/v4.42.0/en/main_classes/text_generation#transformers.GenerationConfig) | [paddlenlp.generation.GenerationConfig](https://github.com/PaddlePaddle/PaddleNLP/blob/e336e78c338d2514ee6c937982ce5d8c960b85ff/paddlenlp/generation/configuration_utils.py#L62) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.GenerationConfig.md) | | 415 | [transformers.AddedToken](https://github.com/huggingface/transformers/blob/d625294d79341662784495551abdf45e6cb9372f/src/transformers/tokenization_utils_base.py#L84) | [paddlenlp.transformers.AddedToken](https://github.com/PaddlePaddle/PaddleNLP/blob/e336e78c338d2514ee6c937982ce5d8c960b85ff/paddlenlp/transformers/tokenizer_utils_base.py#L48) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.AddedToken.md) | | 416 | [transformers.PretrainedConfig](https://hf-mirror.com/docs/transformers/v4.42.0/en/main_classes/configuration#transformers.PretrainedConfig) | [paddlenlp.transformers.PretrainedConfig](https://github.com/PaddlePaddle/PaddleNLP/blob/57000fa12ce67024238f0b56a6fde63c592c54ce/paddlenlp/transformers/configuration_utils.py#L317) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.PretrainedConfig.md) | + ## 7. 输入参数用法不一致 **分类简介** @@ -1504,6 +1512,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 68 | [torchvision.datasets.VOCDetection](https://pytorch.org/vision/main/generated/torchvision.datasets.VOCDetection.html) | [paddle.vision.datasets.VOC2012](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/datasets/VOC2012_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.datasets.VOCDetection.md) | | 69 | [torchvision.ops.roi_pool](https://pytorch.org/vision/main/generated/torchvision.ops.roi_pool.html) | [paddle.vision.ops.roi_pool](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/ops/roi_pool_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.ops.roi_pool.md) | | 70 | [torchvision.datasets.FashionMNIST](https://pytorch.org/vision/main/generated/torchvision.datasets.FashionMNIST.html) | [paddle.vision.datasets.FashionMNIST](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/datasets/FashionMNIST_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.datasets.FashionMNIST.md) | + ## 8. 输入参数类型不一致 **分类简介** @@ -1601,6 +1610,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 85 | [torchvision.models.mobilenet_v3_large](https://pytorch.org/vision/main/models/generated/torchvision.models.mobilenet_v3_large.html) | [paddle.vision.models.mobilenet_v3_large](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/models/mobilenet_v3_large_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.models.mobilenet_v3_large.md) | | 86 | [torchvision.models.mobilenet_v2](https://pytorch.org/vision/stable/models/generated/torchvision.models.mobilenet_v2.html) | [paddle.vision.models.mobilenet_v2](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/models/mobilenet_v2_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.models.mobilenet_v2.md) | | 87 | [torchvision.models.densenet121](https://pytorch.org/vision/main/models/generated/torchvision.models.densenet121.html) | [paddle.vision.models.densenet121](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/vision/models/densenet121_cn.html) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/torchvision/torchvision.models.densenet121.md) | + ## 9. 返回参数类型不一致 **分类简介** @@ -1640,6 +1650,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 27 | [torch.utils.data.default_collate](https://pytorch.org/docs/stable/data.html?highlight=default_collate#torch.utils.data.default_collate) | paddle.io.dataloader.collate.default_collate_fn | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/utils/torch.utils.data.default_collate.md) | | 28 | [transformers.PreTrainedModel.generate](https://github.com/huggingface/transformers/blob/0fdea8607d7e01eb0e38a1ebeb7feee30a22f0cf/src/transformers/generation/utils.py#L1567) | [paddlenlp.transformers.PreTrainedModel.generate](https://github.com/PaddlePaddle/PaddleNLP/blob/88d4b19bc6865fb28c11d2ce83d07c3b4b8dc423/paddlenlp/generation/utils.py#L604) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.PreTrainedModel.generate.md) | | 29 | [transformers.PreTrainedTokenizer.encode](https://hf-mirror.com/docs/transformers/v4.42.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizer.encode) | [paddlenlp.transformers.PreTrainedTokenizer.encode](https://github.com/PaddlePaddle/PaddleNLP/blob/88d4b19bc6865fb28c11d2ce83d07c3b4b8dc423/paddlenlp/transformers/tokenizer_utils_base.py#L2369) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.PreTrainedTokenizer.encode.md) | + ## 10. 组合替代实现 **分类简介** @@ -1822,6 +1833,7 @@ paddle.nn.Softplus(beta=0.5, threshold=15) | 170 | [transformers.PreTrainedModel](https://hf-mirror.com/docs/transformers/v4.42.0/en/main_classes/model#transformers.PreTrainedModel) | [paddlenlp.transformers.PreTrainedModel](https://github.com/PaddlePaddle/PaddleNLP/blob/e336e78c338d2514ee6c937982ce5d8c960b85ff/paddlenlp/transformers/model_utils.py#L843) | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.PreTrainedModel.md) | | 171 | [transformers.logging.get_logger](https://github.com/huggingface/transformers/blob/d625294d79341662784495551abdf45e6cb9372f/src/transformers/utils/logging.py#L147) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.logging.get_logger.md) | | 172 | [transformers.PreTrainedModel.post_init](https://hf-mirror.com/docs/transformers/v4.42.0/en/main_classes/model#transformers.PreTrainedModel.post_init) | - | [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference_third_party/transformers/transformers.PreTrainedModel.post_init.md) | + ## 11. 可删除 **分类简介** diff --git a/docs/guides/model_convert/convert_from_pytorch/tools/generate_mapping_files.py b/docs/guides/model_convert/convert_from_pytorch/tools/generate_mapping_files.py index dc57afc29d4..43c22509f03 100644 --- a/docs/guides/model_convert/convert_from_pytorch/tools/generate_mapping_files.py +++ b/docs/guides/model_convert/convert_from_pytorch/tools/generate_mapping_files.py @@ -434,7 +434,7 @@ def update_mapping_table( # 替换原内容中的表格(考虑可能有序号的标题) # 添加额外的换行符确保格式正确 pattern = rf"(## \d*\.?\s*{re.escape(category)}[\s\S]*?)(\| 序号 \| Pytorch 最新 release \| Paddle develop \| 备注 \|\n\|[-\| ]+\|\n)[\s\S]*?(?=## \d*\.?\s*|\Z)" - replacement = rf"\1{table_content_str}\n" + replacement = rf"\1{table_content_str}\n\n" return re.sub(pattern, replacement, md_content, flags=re.MULTILINE) @@ -459,7 +459,7 @@ def update_special_category_table(md_content, category, table_content): # 更精确的正则表达式,确保只匹配特定类别的表格 pattern = rf"(## \d*\.?\s*{re.escape(category)}[\s\S]*?)(\| 序号 \| Pytorch 最新 release \| Paddle develop \| 备注 \|\n\|[-\| ]+\|\n)[\s\S]*?(?=## \d*\.?\s*|\Z)" # 替换为:标题 + 新表格内容 - replacement = rf"\1\n{table_content}\n" + replacement = rf"\1{table_content}\n\n" return re.sub(pattern, replacement, md_content, flags=re.MULTILINE)