Skip to content

Conversation

@LittleHeroZZZX
Copy link
Contributor

@LittleHeroZZZX LittleHeroZZZX commented Jan 27, 2026

本 PR 重构差异文档目录生成工具(产物 pytorch_api_mapping_cn.md)中获取 Paddle 和 Torch API 的方式。由原本的硬编码规则修改为从 Sphinx 的编译产物直接获取,url 链接准确率更高且可以有效规避 URL 不存在的问题。

缺失文档的 API 列表

API 名称 所属包
fairscale.nn.model_parallel.initialize.get_model_parallel_rank fairscale
fairscale.nn.model_parallel.initialize.get_model_parallel_world_size fairscale
flash_attn.__version__.split flash_attn
'bicubic' paddle
'bilinear' paddle
'box' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'DEFAULT' paddle
'gray' paddle
'hamming' paddle
'IMAGENET1K_FEATURES' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V1' paddle
'IMAGENET1K_V2' paddle
'IMAGENET1K_V2' paddle
'IMAGENET1K_V2' paddle
'IMAGENET1K_V2' paddle
'IMAGENET1K_V2' paddle
'IMAGENET1K_V2' paddle
'IMAGENET1K_V2' paddle
'IMAGENET1K_V2' paddle
'IMAGENET1K_V2' paddle
'lanczos' paddle
'nearest' paddle
'nearest_exact' paddle
paddle.__version__ paddle
paddle.__version__.split paddle
paddle.__version__.split paddle
paddle.adaptive_avg_pool1d paddle
paddle.amp.autocast paddle
paddle.asarray paddle
paddle.autograd.PyLayer.forward paddle
paddle.autograd.PyLayerContext.mark_non_differentiable paddle
paddle.autograd.PyLayerContext.save_for_backward paddle
paddle.autograd.PyLayerContext.saved_tensor paddle
paddle.autograd.PyLayerContext.set_materialize_grads paddle
paddle.bfloat16 paddle
paddle.BFloat16Tensor paddle
paddle.blackman_window paddle
paddle.bool paddle
paddle.BoolTensor paddle
paddle.ByteTensor paddle
paddle.cfloat paddle
paddle.CharTensor paddle
paddle.compat.allclose paddle
paddle.compat.equal paddle
paddle.compat.nn.AvgPool1d paddle
paddle.compat.nn.AvgPool2d paddle
paddle.compat.nn.AvgPool3d paddle
paddle.compat.nn.functional.scaled_dot_product_attention paddle
paddle.compat.nn.functional.unfold paddle
paddle.compat.nn.MultiheadAttention paddle
paddle.compat.nn.Softmax paddle
paddle.compat.seed paddle
paddle.compat.unique paddle
paddle.complex128 paddle
paddle.complex64 paddle
paddle.conv1d paddle
paddle.conv2d paddle
paddle.conv3d paddle
paddle.core.is_compiled_with_nccl paddle
paddle.cuda.amp.autocast paddle
paddle.cuda.amp.autocast_mode.autocast paddle
paddle.cuda.BFloat16Tensor paddle
paddle.cuda.BoolTensor paddle
paddle.cuda.ByteTensor paddle
paddle.cuda.CharTensor paddle
paddle.cuda.DoubleTensor paddle
paddle.cuda.Event paddle
paddle.cuda.FloatTensor paddle
paddle.cuda.get_device_name paddle
paddle.cuda.HalfTensor paddle
paddle.cuda.IntTensor paddle
paddle.cuda.ipc_collect paddle
paddle.cuda.is_bf16_supported paddle
paddle.cuda.is_current_stream_capturing paddle
paddle.cuda.LongTensor paddle
paddle.cuda.max_memory_reserved paddle
paddle.cuda.nvtx.range_pop paddle
paddle.cuda.nvtx.range_push paddle
paddle.cuda.set_stream paddle
paddle.cuda.ShortTensor paddle
paddle.cuda.stream paddle
paddle.cuda.StreamContext paddle
paddle.device paddle
paddle.distributed.batch_isend_irecv paddle
paddle.distributed.fleet.base.topology._HYBRID_PARALLEL_GROUP._mp_degree paddle
paddle.distributed.fleet.base.topology._HYBRID_PARALLEL_GROUP.get_model_parallel_rank paddle
paddle.distributed.ReduceOp.MAX paddle
paddle.distributed.ReduceOp.Mpaddle paddle
paddle.distributed.ReduceOp.PROD paddle
paddle.distributed.ReduceOp.SUM paddle
paddle.distribution.constraint.Constraint paddle
paddle.distribution.Distribution.log_prob paddle
paddle.double paddle
paddle.DoubleTensor paddle
paddle.dtype paddle
paddle.e paddle
paddle.float16 paddle
paddle.float32 paddle
paddle.float64 paddle
paddle.float8_e4m3fn paddle
paddle.FloatTensor paddle
paddle.from_numpy paddle
paddle.functional.atleast_1d paddle
paddle.functional.atleast_2d paddle
paddle.functional.atleast_3d paddle
paddle.functional.broadcast_shapes paddle
paddle.functional.einsum paddle
paddle.functional.meshgrid paddle
paddle.functional.norm paddle
paddle.functional.split paddle
paddle.functional.unique_consecutive paddle
paddle.ge paddle
paddle.Generator paddle
paddle.get_device paddle
paddle.get_device paddle
paddle.greater paddle
paddle.group_norm paddle
paddle.HalfTensor paddle
paddle.hamming_window paddle
paddle.inf paddle
paddle.int16 paddle
paddle.int32 paddle
paddle.int64 paddle
paddle.int8 paddle
paddle.IntTensor paddle
paddle.io.dataloader.collate.default_collate_fn paddle
paddle.layer_norm paddle
paddle.le paddle
paddle.long paddle
paddle.LongTensor paddle
paddle.lt paddle
paddle.manual_seed paddle
paddle.nan paddle
paddle.ne paddle
paddle.newaxis paddle
paddle.nn paddle
paddle.nn.AdaptiveAvgPool1d paddle
paddle.nn.AdaptiveAvgPool2d paddle
paddle.nn.AdaptiveAvgPool3d paddle
paddle.nn.AdaptiveMaxPool1d paddle
paddle.nn.AdaptiveMaxPool2d paddle
paddle.nn.AdaptiveMaxPool3d paddle
paddle.nn.attention._cur_sdpa_kernel_backends paddle
paddle.nn.attention.sdpa_kernel paddle
paddle.nn.attention.SDPBackend paddle
paddle.nn.attention.SDPBackend.EFFICIENT_ATTENTION paddle
paddle.nn.attention.SDPBackend.ERROR paddle
paddle.nn.attention.SDPBackend.FLASH_ATTENTION paddle
paddle.nn.attention.SDPBackend.MATH paddle
paddle.nn.CircularPad1d paddle
paddle.nn.CircularPad2d paddle
paddle.nn.CircularPad3d paddle
paddle.nn.ConstantPad1d paddle
paddle.nn.ConstantPad2d paddle
paddle.nn.ConstantPad3d paddle
paddle.nn.Conv1d paddle
paddle.nn.Conv2d paddle
paddle.nn.Conv3d paddle
paddle.nn.functional.tanh paddle
paddle.nn.HuberLoss paddle
paddle.nn.LPPool1d paddle
paddle.nn.LPPool2d paddle
paddle.nn.MaxUnpool1d paddle
paddle.nn.MaxUnpool2d paddle
paddle.nn.MaxUnpool3d paddle
paddle.nn.Module.add_module paddle
paddle.nn.Module.apply paddle
paddle.nn.Module.bfloat16 paddle
paddle.nn.Module.buffers paddle
paddle.nn.Module.children paddle
paddle.nn.Module.cpu paddle
paddle.nn.Module.cuda paddle
paddle.nn.Module.double paddle
paddle.nn.Module.eval paddle
paddle.nn.Module.float paddle
paddle.nn.Module.get_buffer paddle
paddle.nn.Module.get_parameter paddle
paddle.nn.Module.get_submodule paddle
paddle.nn.Module.half paddle
paddle.nn.Module.load_state_dict paddle
paddle.nn.Module.modules paddle
paddle.nn.Module.named_buffers paddle
paddle.nn.Module.named_children paddle
paddle.nn.Module.named_modules paddle
paddle.nn.Module.named_parameters paddle
paddle.nn.Module.parameters paddle
paddle.nn.Module.register_buffer paddle
paddle.nn.Module.register_module paddle
paddle.nn.Module.register_parameter paddle
paddle.nn.Module.requires_grad_ paddle
paddle.nn.Module.state_dict paddle
paddle.nn.Module.to paddle
paddle.nn.Module.type paddle
paddle.nn.Module.xpu paddle
paddle.nn.Module.zero_grad paddle
paddle.nn.Parameter paddle
paddle.nn.ReflectionPad1d paddle
paddle.nn.ReflectionPad2d paddle
paddle.nn.ReflectionPad3d paddle
paddle.nn.ReplicationPad1d paddle
paddle.nn.ReplicationPad2d paddle
paddle.nn.ReplicationPad3d paddle
paddle.nn.SiLU paddle
paddle.nn.UpsamplingBilinear2d paddle
paddle.nn.UpsamplingNearest2d paddle
paddle.nn.ZeroPad1d paddle
paddle.nn.ZeroPad2d paddle
paddle.nn.ZeroPad3d paddle
paddle.norm paddle
paddle.optimizer.Optimizer._add_param_group paddle
paddle.optimizer.Optimizer.load_state_dict paddle
paddle.optimizer.Optimizer.state_dict paddle
paddle.paddle.int32 paddle
paddle.pi paddle
paddle.scatter_add paddle
paddle.scatter_reduce paddle
paddle.ShortTensor paddle
paddle.sigmoid paddle
paddle.special.expm1 paddle
paddle.special.i1 paddle
paddle.special.i1e paddle
paddle.Tensor.__add__ paddle
paddle.Tensor.__and__ paddle
paddle.Tensor.__array__ paddle
paddle.Tensor.__bool__ paddle
paddle.Tensor.__deepcopy__ paddle
paddle.Tensor.__eq__ paddle
paddle.Tensor.__floordiv__ paddle
paddle.Tensor.__format__ paddle
paddle.Tensor.__ge__ paddle
paddle.Tensor.__getitem__ paddle
paddle.Tensor.__gt__ paddle
paddle.Tensor.__index__ paddle
paddle.Tensor.__int__ paddle
paddle.Tensor.__invert__ paddle
paddle.Tensor.__ior__ paddle
paddle.Tensor.__le__ paddle
paddle.Tensor.__len__ paddle
paddle.Tensor.__lt__ paddle
paddle.Tensor.__mul__ paddle
paddle.Tensor.__ne__ paddle
paddle.Tensor.__neg__ paddle
paddle.Tensor.__not__ paddle
paddle.Tensor.__or__ paddle
paddle.Tensor.__pow__ paddle
paddle.Tensor.__radd__ paddle
paddle.Tensor.__reduce_ex__ paddle
paddle.Tensor.__rmul__ paddle
paddle.Tensor.__rpow__ paddle
paddle.Tensor.__rsub__ paddle
paddle.Tensor.__rtruediv__ paddle
paddle.Tensor.__setitem__ paddle
paddle.Tensor.__sub__ paddle
paddle.Tensor.__xor__ paddle
paddle.Tensor.abs_ paddle
paddle.Tensor.acos_ paddle
paddle.Tensor.acosh paddle
paddle.Tensor.acosh_ paddle
paddle.Tensor.asin_ paddle
paddle.Tensor.asinh paddle
paddle.Tensor.asinh_ paddle
paddle.Tensor.atan_ paddle
paddle.Tensor.atanh paddle
paddle.Tensor.atanh_ paddle
paddle.Tensor.baddbmm paddle
paddle.Tensor.bitwise_not_ paddle
paddle.Tensor.bitwise_or_ paddle
paddle.Tensor.cholesky_inverse paddle
paddle.Tensor.clamp_ paddle
paddle.Tensor.coalesce paddle
paddle.Tensor.copy_ paddle
paddle.Tensor.corrcoef paddle
paddle.Tensor.cos_ paddle
paddle.Tensor.cosh_ paddle
paddle.Tensor.cumprod paddle
paddle.Tensor.cumprod_ paddle
paddle.Tensor.device paddle
paddle.Tensor.diag paddle
paddle.Tensor.diag_embed paddle
paddle.Tensor.diagflat paddle
paddle.Tensor.digamma_ paddle
paddle.Tensor.div paddle
paddle.Tensor.div_ paddle
paddle.Tensor.divide_ paddle
paddle.Tensor.eq paddle
paddle.Tensor.erfinv_ paddle
paddle.Tensor.expm1 paddle
paddle.Tensor.frac_ paddle
paddle.Tensor.ge paddle
paddle.Tensor.greater paddle
paddle.Tensor.gt paddle
paddle.Tensor.i0_ paddle
paddle.Tensor.index_add_ paddle
paddle.Tensor.index_put_ paddle
paddle.Tensor.inverse paddle
paddle.Tensor.istft paddle
paddle.Tensor.le paddle
paddle.Tensor.lgamma_ paddle
paddle.Tensor.log_ paddle
paddle.Tensor.log10_ paddle
paddle.Tensor.log1p_ paddle
paddle.Tensor.log2_ paddle
paddle.Tensor.logit_ paddle
paddle.Tensor.lt paddle
paddle.Tensor.lu paddle
paddle.Tensor.moveaxis paddle
paddle.Tensor.moveaxis paddle
paddle.Tensor.msort paddle
paddle.Tensor.mT paddle
paddle.Tensor.mul paddle
paddle.Tensor.multigammaln paddle
paddle.Tensor.multigammaln_ paddle
paddle.Tensor.multinomial paddle
paddle.Tensor.multiply_ paddle
paddle.Tensor.nan_to_num_ paddle
paddle.Tensor.narrow paddle
paddle.Tensor.ne paddle
paddle.Tensor.neg_ paddle
paddle.Tensor.neg_ paddle
paddle.Tensor.normal_ paddle
paddle.Tensor.pinv paddle
paddle.Tensor.polygamma_ paddle
paddle.Tensor.requires_grad_ paddle
paddle.Tensor.sigmoid paddle
paddle.Tensor.sigmoid_ paddle
paddle.Tensor.sin_ paddle
paddle.Tensor.sinc paddle
paddle.Tensor.sinc_ paddle
paddle.Tensor.sinh_ paddle
paddle.Tensor.size paddle
paddle.Tensor.size paddle
paddle.Tensor.size paddle
paddle.Tensor.size paddle
paddle.Tensor.split_with_sizes paddle
paddle.Tensor.stride paddle
paddle.Tensor.T paddle
paddle.Tensor.t_ paddle
paddle.Tensor.tan paddle
paddle.Tensor.tan_ paddle
paddle.Tensor.to_dense paddle
paddle.Tensor.to_sparse_coo paddle
paddle.Tensor.tril paddle
paddle.Tensor.tril_ paddle
paddle.Tensor.triu paddle
paddle.Tensor.triu_ paddle
paddle.Tensor.true_divide paddle
paddle.Tensor.trunc_ paddle
paddle.Tensor.trunc_ paddle
paddle.testing.assert_close paddle
paddle.uint8 paddle
paddle.utils.cpp_extension.BuildExtension paddle
paddle.utils.cpp_extension.BuildExtension.with_options paddle
paddle.utils.cpp_extension.CUDA_HOME paddle
paddleformers.generation.GenerationConfig paddle
paddleformers.generation.LogitsProcessorList paddle
paddleformers.generation.StoppingCriteriaList paddle
paddleformers.trainer.utils.add_start_docstrings_to_model_forward paddle
paddleformers.transformers.AddedToken paddle
paddleformers.transformers.model_outputs.BaseModelOutput paddle
paddleformers.transformers.model_outputs.BaseModelOutputWithPast paddle
paddleformers.transformers.model_outputs.CausalLMOutputWithPast paddle
paddleformers.transformers.PretrainedConfig paddle
'rgb' paddle
torch.distributed.ReduceOp.Mtorch paddle
'unchanged' paddle
paddle.nn.Module.trapaddle torch
torch.__version__ torch
torch.__version__.split torch
torch.abs_ torch
torch.adaptive_avg_pool1d torch
torch.amp.autocast torch
torch.autograd.enable_grad torch
torch.autograd.function.FunctionCtx torch
torch.autograd.function.FunctionCtx.saved_tensors torch
torch.bfloat16 torch
torch.BFloat16Tensor torch
torch.bool torch
torch.BoolTensor torch
torch.ByteTensor torch
torch.cfloat torch
torch.CharTensor torch
torch.complex128 torch
torch.complex64 torch
torch.conv1d torch
torch.conv2d torch
torch.conv3d torch
torch.cuda.BFloat16Tensor torch
torch.cuda.BoolTensor torch
torch.cuda.ByteTensor torch
torch.cuda.CharTensor torch
torch.cuda.DoubleTensor torch
torch.cuda.empty_cache torch
torch.cuda.FloatTensor torch
torch.cuda.HalfTensor torch
torch.cuda.IntTensor torch
torch.cuda.LongTensor torch
torch.cuda.max_memory_allocated torch
torch.cuda.max_memory_reserved torch
torch.cuda.mem_get_info torch
torch.cuda.memory_allocated torch
torch.cuda.memory_reserved torch
torch.cuda.reset_max_memory_allocated torch
torch.cuda.reset_max_memory_cached torch
torch.cuda.reset_peak_memory_stats torch
torch.cuda.ShortTensor torch
torch.distributed.ReduceOp.MAX torch
torch.distributed.ReduceOp.PRODUCT torch
torch.distributed.ReduceOp.SUM torch
torch.double torch
torch.DoubleTensor torch
torch.e torch
torch.finfo torch
torch.float16 torch
torch.float32 torch
torch.float64 torch
torch.float8_e4m3fn torch
torch.FloatTensor torch
torch.get_autocast_gpu_dtype torch
torch.get_device torch
torch.group_norm torch
torch.HalfTensor torch
torch.index_put torch
torch.inf torch
torch.int16 torch
torch.int32 torch
torch.int64 torch
torch.int8 torch
torch.IntTensor torch
torch.is_autocast_enabled torch
torch.is_inference torch
torch.layer_norm torch
torch.long torch
torch.LongTensor torch
torch.nan torch
torch.newaxis torch
torch.nn.attention._cur_sdpa_kernel_backends torch
torch.nn.attention.SDPBackend.EFFICIENT_ATTENTION torch
torch.nn.attention.SDPBackend.ERROR torch
torch.nn.attention.SDPBackend.FLASH_ATTENTION torch
torch.nn.attention.SDPBackend.MATH torch
torch.nn.init._calculate_fan_in_and_fan_out torch
torch.nn.Parameter torch
torch.pi torch
torch.ShortTensor torch
torch.Tensor.__add__ torch
torch.Tensor.__and__ torch
torch.Tensor.__array__ torch
torch.Tensor.__bool__ torch
torch.Tensor.__deepcopy__ torch
torch.Tensor.__eq__ torch
torch.Tensor.__floordiv__ torch
torch.Tensor.__format__ torch
torch.Tensor.__ge__ torch
torch.Tensor.__getitem__ torch
torch.Tensor.__gt__ torch
torch.Tensor.__index__ torch
torch.Tensor.__int__ torch
torch.Tensor.__invert__ torch
torch.Tensor.__ior__ torch
torch.Tensor.__le__ torch
torch.Tensor.__len__ torch
torch.Tensor.__lt__ torch
torch.Tensor.__mul__ torch
torch.Tensor.__ne__ torch
torch.Tensor.__neg__ torch
torch.Tensor.__not__ torch
torch.Tensor.__or__ torch
torch.Tensor.__pow__ torch
torch.Tensor.__radd__ torch
torch.Tensor.__reduce_ex__ torch
torch.Tensor.__rmul__ torch
torch.Tensor.__rpow__ torch
torch.Tensor.__rsub__ torch
torch.Tensor.__rtruediv__ torch
torch.Tensor.__setitem__ torch
torch.Tensor.__sub__ torch
torch.Tensor.__xor__ torch
torch.Tensor.data torch
torch.Tensor.dtype torch
torch.Tensor.split_with_sizes torch
torch.torch.int32 torch
torch.uint8 torch
torch.utils.cpp_extension.BuildExtension.with_options torch
torch.utils.cpp_extension.CUDA_HOME torch
torchvision.io.ImageReadMode.GRAY torchvision
torchvision.io.ImageReadMode.RGB torchvision
torchvision.io.ImageReadMode.UNCHANGED torchvision
torchvision.models.AlexNet_Weights.DEFAULT torchvision
torchvision.models.AlexNet_Weights.IMAGENET1K_V1 torchvision
torchvision.models.DenseNet121_Weights.DEFAULT torchvision
torchvision.models.DenseNet121_Weights.IMAGENET1K_V1 torchvision
torchvision.models.DenseNet161_Weights.DEFAULT torchvision
torchvision.models.DenseNet161_Weights.IMAGENET1K_V1 torchvision
torchvision.models.DenseNet169_Weights.DEFAULT torchvision
torchvision.models.DenseNet169_Weights.IMAGENET1K_V1 torchvision
torchvision.models.DenseNet201_Weights.DEFAULT torchvision
torchvision.models.DenseNet201_Weights.IMAGENET1K_V1 torchvision
torchvision.models.GoogLeNet_Weights.DEFAULT torchvision
torchvision.models.GoogLeNet_Weights.IMAGENET1K_V1 torchvision
torchvision.models.Inception_V3_Weights.DEFAULT torchvision
torchvision.models.Inception_V3_Weights.IMAGENET1K_V1 torchvision
torchvision.models.MobileNet_V2_Weights.DEFAULT torchvision
torchvision.models.MobileNet_V2_Weights.IMAGENET1K_V1 torchvision
torchvision.models.MobileNet_V2_Weights.IMAGENET1K_V2 torchvision
torchvision.models.MobileNet_V3_Large_Weights.DEFAULT torchvision
torchvision.models.MobileNet_V3_Large_Weights.IMAGENET1K_V1 torchvision
torchvision.models.MobileNet_V3_Large_Weights.IMAGENET1K_V2 torchvision
torchvision.models.MobileNet_V3_Small_Weights.DEFAULT torchvision
torchvision.models.MobileNet_V3_Small_Weights.IMAGENET1K_V1 torchvision
torchvision.models.MobileNet_V3_Small_Weights.IMAGENET1K_V2 torchvision
torchvision.models.ResNet101_64x4d_Weights.DEFAULT torchvision
torchvision.models.ResNet101_64x4d_Weights.IMAGENET1K_V1 torchvision
torchvision.models.ResNet101_Weights.DEFAULT torchvision
torchvision.models.ResNet101_Weights.IMAGENET1K_V1 torchvision
torchvision.models.ResNet101_Weights.IMAGENET1K_V2 torchvision
torchvision.models.ResNet152_Weights.DEFAULT torchvision
torchvision.models.ResNet152_Weights.IMAGENET1K_V1 torchvision
torchvision.models.ResNet152_Weights.IMAGENET1K_V2 torchvision
torchvision.models.ResNet18_Weights.DEFAULT torchvision
torchvision.models.ResNet18_Weights.IMAGENET1K_V1 torchvision
torchvision.models.ResNet34_Weights.DEFAULT torchvision
torchvision.models.ResNet34_Weights.IMAGENET1K_V1 torchvision
torchvision.models.ResNet50_Weights.DEFAULT torchvision
torchvision.models.ResNet50_Weights.IMAGENET1K_V1 torchvision
torchvision.models.ResNet50_Weights.IMAGENET1K_V2 torchvision
torchvision.models.ResNeXt50_32X4D_Weights.DEFAULT torchvision
torchvision.models.ResNeXt50_32X4D_Weights.IMAGENET1K_V1 torchvision
torchvision.models.ResNeXt50_32X4D_Weights.IMAGENET1K_V2 torchvision
torchvision.models.ShuffleNet_V2_X0_5_Weights.DEFAULT torchvision
torchvision.models.ShuffleNet_V2_X0_5_Weights.IMAGENET1K_V1 torchvision
torchvision.models.ShuffleNet_V2_X1_0_Weights.DEFAULT torchvision
torchvision.models.ShuffleNet_V2_X1_0_Weights.IMAGENET1K_V1 torchvision
torchvision.models.ShuffleNet_V2_X1_5_Weights.DEFAULT torchvision
torchvision.models.ShuffleNet_V2_X1_5_Weights.IMAGENET1K_V1 torchvision
torchvision.models.ShuffleNet_V2_X2_0_Weights.DEFAULT torchvision
torchvision.models.ShuffleNet_V2_X2_0_Weights.IMAGENET1K_V1 torchvision
torchvision.models.SqueezeNet1_0_Weights.DEFAULT torchvision
torchvision.models.SqueezeNet1_0_Weights.IMAGENET1K_V1 torchvision
torchvision.models.SqueezeNet1_1_Weights.DEFAULT torchvision
torchvision.models.SqueezeNet1_1_Weights.IMAGENET1K_V1 torchvision
torchvision.models.VGG11_BN_Weights.DEFAULT torchvision
torchvision.models.VGG11_BN_Weights.IMAGENET1K_V1 torchvision
torchvision.models.VGG11_Weights.DEFAULT torchvision
torchvision.models.VGG11_Weights.IMAGENET1K_V1 torchvision
torchvision.models.VGG13_BN_Weights.DEFAULT torchvision
torchvision.models.VGG13_BN_Weights.IMAGENET1K_V1 torchvision
torchvision.models.VGG13_Weights.DEFAULT torchvision
torchvision.models.VGG13_Weights.IMAGENET1K_V1 torchvision
torchvision.models.VGG16_BN_Weights.DEFAULT torchvision
torchvision.models.VGG16_BN_Weights.IMAGENET1K_V1 torchvision
torchvision.models.VGG16_Weights.DEFAULT torchvision
torchvision.models.VGG16_Weights.IMAGENET1K_FEATURES torchvision
torchvision.models.VGG16_Weights.IMAGENET1K_V1 torchvision
torchvision.models.VGG19_BN_Weights.DEFAULT torchvision
torchvision.models.VGG19_BN_Weights.IMAGENET1K_V1 torchvision
torchvision.models.VGG19_Weights.DEFAULT torchvision
torchvision.models.VGG19_Weights.IMAGENET1K_V1 torchvision
torchvision.models.Wide_ResNet101_2_Weights.DEFAULT torchvision
torchvision.models.Wide_ResNet101_2_Weights.IMAGENET1K_V1 torchvision
torchvision.models.Wide_ResNet101_2_Weights.IMAGENET1K_V2 torchvision
torchvision.models.Wide_ResNet50_2_Weights.DEFAULT torchvision
torchvision.models.Wide_ResNet50_2_Weights.IMAGENET1K_V1 torchvision
torchvision.models.Wide_ResNet50_2_Weights.IMAGENET1K_V2 torchvision
torchvision.transforms.InterpolationMode.BICUBIC torchvision
torchvision.transforms.InterpolationMode.BILINEAR torchvision
torchvision.transforms.InterpolationMode.BOX torchvision
torchvision.transforms.InterpolationMode.HAMMING torchvision
torchvision.transforms.InterpolationMode.LANCZOS torchvision
torchvision.transforms.InterpolationMode.NEAREST torchvision
torchvision.transforms.InterpolationMode.NEAREST_EXACT torchvision
transformers.AddedToken transformers
transformers.generation.utils.GenerateOutput transformers
transformers.PretrainedConfig transformers
transformers.PreTrainedTokenizer transformers
transformers.PreTrainedTokenizer transformers

* Split the monolithic `utils.py` into a modular `utils/` package structure.
* Add `api_url_parser.py` to implement a unified URL parser for PyTorch and Paddle APIs using `sphobjinv`.
* Update import paths in scripts like `generate_pytorch_api_mapping.py` to adapt to the new module structure.
* Remove duplicate Tensor API entries (`clear_gradient`, `clone`, `data_ptr`) from the documentation.
* Improve `extract_no_need_convert_list` to support both `api_mapping.json` and `attribute_mapping.json`.
Copilot AI review requested due to automatic review settings January 27, 2026 10:40
@paddle-bot
Copy link

paddle-bot bot commented Jan 27, 2026

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-7701.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html
预览工具的更多说明,请参考:飞桨文档预览工具

@github-actions
Copy link

github-actions bot commented Jan 27, 2026

📚 本次 PR 文档预览链接(点击展开)
ℹ️ 预览提醒
请等待 Docs-NEW 流水线运行完成后再点击预览链接,否则可能会看到旧版本内容或遇到链接无法访问的情况。

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

本 PR 重构了 PyTorch→Paddle API 映射文档工具中 API 文档链接的获取方式,引入基于 Sphinx objects.inv 的 URL 解析器,并将原 utils.py 拆分为包结构以便扩展维护。

Changes:

  • 将部分 API URL 生成逻辑重构为基于 Sphinx inventory(objects.inv)解析,新增 api_url_parser 模块
  • tools/utils.py 拆分为 tools/utils/ 包,并更新相关脚本的导入路径
  • 调整 validate_pytorch_api_mapping.py 默认映射文档路径为相对路径;同时修改了 Tensor__upper_cn.rst 的部分章节内容

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
docs/guides/model_convert/convert_from_pytorch/tools/validate_pytorch_api_mapping.py 默认映射文档路径由硬编码绝对路径改为基于 __file__ 的相对路径。
docs/guides/model_convert/convert_from_pytorch/tools/validate_api_difference_consistency.py 更新工具函数导入路径以匹配新的 utils/ 包结构。
docs/guides/model_convert/convert_from_pytorch/tools/generate_pytorch_api_mapping.py 更新工具函数导入路径,间接接入新的 URL 解析能力。
docs/guides/model_convert/convert_from_pytorch/tools/utils/utils.py 新的工具函数集合,新增通过 parser 获取 Torch/Paddle API URL 的入口。
docs/guides/model_convert/convert_from_pytorch/tools/utils/api_url_parser.py 新增:从 Sphinx inventory 解析 API→URL 的核心实现(Torch/Paddle)。
docs/guides/model_convert/convert_from_pytorch/tools/utils/init.py 新增:utils 包导出定义。
docs/guides/model_convert/convert_from_pytorch/tools/utils.py 删除:原单文件工具库。
docs/api/paddle/Tensor__upper_cn.rst 删除/调整若干 Tensor API 小节内容(与工具重构并列出现在同一 PR)。

Comment on lines 364 to 368


clone()
:::::::::

返回:克隆的新的 Tensor

返回类型:Tensor

**代码示例**
COPY-FROM: paddle.Tensor.clone



retain_grads()
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

该 PR 描述主要是重构差异文档工具的 URL 解析方式,但这里同时删除了 Tensor API 文档中的若干小节(如 clone() 相关内容)。这会影响生成的 API 文档与 objects.inv 内容,建议在 PR 描述里补充此处改动的动机/关联性,避免后续维护者误解为无关修改。

Copilot uses AI. Check for mistakes.
Comment on lines 364 to 368


clone()
:::::::::

返回:克隆的新的 Tensor

返回类型:Tensor

**代码示例**
COPY-FROM: paddle.Tensor.clone



retain_grads()
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里删除了 clone() 小节(原内容包含 COPY-FROM: paddle.Tensor.clone 示例)。目前文件后文仍保留另一份 clone() 文档且示例为手写代码,删除这段会导致示例不再通过 COPY-FROM 与英文 docstring 同步。建议保留单一入口并优先使用 COPY-FROM 的示例(必要时删去后文重复小节或把后文示例改为 COPY-FROM)。

Copilot uses AI. Check for mistakes.
Comment on lines 449 to 453


data_ptr()
:::::::::

返回:返回本 Tensor 第一个元素的数据地址。

返回类型:int

**代码示例**
COPY-FROM: paddle.Tensor.data_ptr





get_strides()
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里删除了 data_ptr() 小节及其 COPY-FROM: paddle.Tensor.data_ptr 示例;当前文件后文仍存在 data_ptr() 说明,但已不包含“代码示例/COPY-FROM”,会导致该 API 的示例缺失且与仓库 API 文档规范不一致。建议将示例保留并合并到唯一的 data_ptr() 小节中(优先 COPY-FROM)。

Copilot uses AI. Check for mistakes.
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:
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except block directly handles BaseException.

Suggested change
except:
except Exception:

Copilot uses AI. Check for mistakes.
- Replace `get_pytorch_url` and `get_paddle_url` with unified `get_url` function
- Add `get_url` to utils module exports for broader accessibility
- Simplify URL retrieval logic in mapping table generators
- Ensure consistent handling of escaped underscores across all API names
- Rename utils.py to api_utils.py for better clarity of its purpose
- Update __init__.py to expose all utility functions from api_utils
- Adjust import statements in dependent scripts to use the new module structure
- Maintains all existing functionality while improving code organization
Copy link
Collaborator

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhwesky2010 zhwesky2010 changed the title refactor(docs): refactor URL parsing module in doc tools refactor(docs): refactor URL parsing module in pytorch mapping doc Jan 29, 2026
Copy link
Collaborator

@sunzhongkai588 sunzhongkai588 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sunzhongkai588 sunzhongkai588 merged commit 2e73594 into PaddlePaddle:develop Jan 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants