Pytorch 2.1.0 与 Paddle develop API 映射表¶
本文梳理了 Pytorch 最新发行版(当前 v2.1.0) API 与 PaddlePaddle develop 版本 API 对应关系与差异分析。通过本文档,帮助开发者快速迁移 PyTorch 使用经验,完成模型的开发与调优。
贡献代码¶
欢迎你向我们贡献代码,关于如何编写 API 映射关系,为保证文档格式统一性与可读性,请严格参照 API 映射关系-格式与模板 来编写。
API 映射表目录¶
类别 | 简介 |
---|---|
torch.XX | 主要为torch.XX 类 API |
torch.nn.XX | 主要为torch.nn.XX 类 API |
torch.nn.functional.XX | 主要为torch.nn.functional.XX 类 API |
torch.nn.init.XX | 主要为torch.nn.init.XX 类 API |
torch.nn.utils.XX | 主要为torch.nn.utils.XX 类 API |
torch.nn.Module.XX | 主要为torch.nn.Module.XX 类 API |
torch.Tensor.XX | 主要为torch.Tensor.XX 类 API |
torch.autograd.XX | 主要为torch.autograd.XX 类 API |
torch.cuda.XX | 主要为torch.cuda.XX 类 API |
torch.distributed.XX | 主要为torch.distributed.XX 类 API |
torch.distributions.XX | 主要为torch.distributions.XX 类 API |
torch.fft.XX | 主要为torch.fft.XX 类 API |
torch.hub.XX | 主要为torch.hub.XX 类 API |
torch.linalg.XX | 主要为torch.linalg.XX 类 API |
torch.onnx.XX | 主要为torch.onnx.XX 类 API |
torch.profiler.XX | 主要为torch.profiler.XX 类 API |
torch.optim.XX | 主要为torch.optim.XX 类 API |
torch.sparse.XX | 主要为torch.sparse.XX 类 API |
其他 | 其他 API |
torch.XX API 映射列表¶
梳理了torch.XX
类 API 的 PyTorch-PaddlePaddle API 映射列表。
持续更新...
torch.nn.XX API 映射列表¶
梳理了torch.nn.XX
类 API 的 PyTorch-PaddlePaddle API 映射列表。
持续更新...
torch.nn.functional.XX API 映射列表¶
梳理了torch.nn.functional.XX
类 API 的 PyTorch-PaddlePaddle API 映射列表。
持续更新...
torch.Tensor.XX API 映射列表¶
梳理了torch.Tensor.XX
类 API 的 PyTorch-PaddlePaddle API 映射列表。
持续更新...
torch.nn.init.XX API 映射列表¶
梳理了torch.nn.init.XX
类 API 的 PyTorch-PaddlePaddle API 映射列表。
序号 | PyTorch API | PaddlePaddle API | 备注 |
---|---|---|---|
1 | torch.nn.init.calculate_gain |
paddle.nn.initializer.calculate_gain |
功能一致,参数完全一致,差异对比 |
2 | torch.nn.init.constant_ |
paddle.nn.initializer.Constant |
组合替代实现,差异对比 |
3 | torch.nn.init.dirac_ |
paddle.nn.initializer.Dirac |
组合替代实现,差异对比 |
4 | torch.nn.init.eye_ |
paddle.nn.initializer.Assign |
组合替代实现,差异对比 |
5 | torch.nn.init.kaiming_normal_ |
paddle.nn.initializer.KaimingNormal |
组合替代实现,差异对比 |
6 | torch.nn.init.kaiming_uniform_ |
paddle.nn.initializer.KaimingUniform |
组合替代实现,差异对比 |
7 | torch.nn.init.normal_ |
paddle.nn.initializer.Normal |
组合替代实现,差异对比 |
8 | torch.nn.init.ones_ |
paddle.nn.initializer.Constant |
组合替代实现,差异对比 |
9 | torch.nn.init.orthogonal_ |
paddle.nn.initializer.Orthogonal |
组合替代实现,差异对比 |
10 | torch.nn.init.uniform_ |
paddle.nn.initializer.Uniform |
组合替代实现,差异对比 |
11 | torch.nn.init.xavier_normal_ |
paddle.nn.initializer.XavierNormal |
组合替代实现,差异对比 |
12 | torch.nn.init.xavier_uniform_ |
paddle.nn.initializer.XavierUniform |
组合替代实现,差异对比 |
13 | torch.nn.init.zeros_ |
paddle.nn.initializer.Constant |
组合替代实现,差异对比 |
持续更新...
torch.nn.utils.XX API 映射列表¶
梳理了torch.nn.utils.XX
类 API 的 PyTorch-PaddlePaddle API 映射列表。
序号 | PyTorch API | PaddlePaddle API | 备注 |
---|---|---|---|
1 | torch.nn.utils.clip_grad_value_ |
paddle.nn.utils.clip_grad_value_ |
功能一致,参数完全一致,差异对比 |
2 | torch.nn.utils.remove_weight_norm |
paddle.nn.utils.remove_weight_norm |
功能一致,仅参数名不一致,差异对比 |
3 | torch.nn.utils.spectral_norm |
paddle.nn.utils.spectral_norm |
功能一致,仅参数名不一致,差异对比 |
4 | torch.nn.utils.weight_norm |
paddle.nn.utils.weight_norm |
功能一致,仅参数名不一致,差异对比 |
5 | torch.nn.utils.parametrize.is_parametrized |
功能缺失 | |
6 | torch.nn.utils.parameters_to_vector |
paddle.nn.utils.parameters_to_vector |
功能一致,参数完全一致,差异对比 |
7 | torch.nn.utils.vector_to_parameters |
paddle.nn.utils.vector_to_parameters |
功能一致,参数完全一致,差异对比 |
8 | torch.nn.utils.clip_grad_norm_ |
paddle.nn.utils.clip_grad_norm_ |
功能一致,参数完全一致,差异对比 |
9 | torch.nn.utils.parametrizations.spectral_norm |
paddle.nn.utils.spectral_norm |
功能一致,仅参数名不一致,差异对比 |
持续更新...
torch.nn.Module.XX API 映射列表¶
梳理了torch.nn.Module.XX
类 API 的 PyTorch-PaddlePaddle API 映射列表。
持续更新...
torch.autograd.XX API 映射列表¶
梳理了torch.autograd.XX
类 API 的 PyTorch-PaddlePaddle API 映射列表。
持续更新...
torch.cuda.XX API 映射列表¶
梳理了torch.cuda.XX
类 API 的 PyTorch-PaddlePaddle API 映射列表。
持续更新...
torch.distributed.XX API 映射列表¶
梳理了torch.distributed.XX
类 API 的 PyTorch-PaddlePaddle API 映射列表。
持续更新...
torch.distributions.XX API 映射列表¶
梳理了torch.distributions.XX
类 API 的 PyTorch-PaddlePaddle API 映射列表。
持续更新...
torch.fft.XX API 映射列表¶
梳理了torch.fft.XX
类 API 的 PyTorch-PaddlePaddle API 映射列表。
持续更新...
torch.hub.XX API 映射列表¶
梳理了torch.hub.XX
类 API 的 PyTorch-PaddlePaddle API 映射列表。
序号 | PyTorch API | PaddlePaddle API | 备注 |
---|---|---|---|
1 | torch.hub.get_dir |
功能缺失 | |
2 | torch.hub.set_dir |
功能缺失 | |
3 | torch.hub.download_url_to_file |
paddle.hub.download_url_to_file |
功能一致,torch 参数更多,差异对比 |
4 | torch.hub.help |
paddle.hub.help |
功能一致,torch 参数更多,差异对比 |
5 | torch.hub.list |
paddle.hub.list |
功能一致,torch 参数更多,差异对比 |
6 | torch.hub.load |
paddle.hub.load |
功能一致,torch 参数更多,差异对比 |
持续更新...
torch.linalg.XX API 映射列表¶
梳理了torch.linalg.XX
类 API 的 PyTorch-PaddlePaddle API 映射列表。
持续更新...
torch.onnx.XX API 映射列表¶
梳理了torch.onnx.XX
类 API 的 PyTorch-PaddlePaddle API 映射列表。
序号 | PyTorch API | PaddlePaddle API | 备注 |
---|---|---|---|
1 | torch.onnx.enable_log |
功能缺失 | |
2 | torch.onnx.disable_log |
功能缺失 | |
3 | torch.onnx.export |
paddle.onnx.export |
功能一致,torch 参数更多,差异对比 |
持续更新...
torch.optim.XX API 映射列表¶
梳理了torch.optim.XX
类 API 的 PyTorch-PaddlePaddle API 映射列表。
持续更新...
torch.profiler.XX API 映射列表¶
梳理了torch.profiler.XX
类 API 的 PyTorch-PaddlePaddle API 映射列表。
序号 | PyTorch API | PaddlePaddle API | 备注 |
---|---|---|---|
1 | torch.profiler.ProfilerActivity |
功能缺失 | |
2 | torch.profiler.ProfilerAction |
功能缺失 | |
3 | torch.profiler.profile |
paddle.profiler.Profiler |
功能一致,torch 参数更多,差异对比 |
4 | torch.profiler.schedule |
paddle.profiler.make_scheduler |
功能一致,仅参数名不一致,差异对比 |
持续更新...
torch.sparse.XX API 映射列表¶
梳理了torch.sparse.XX
类 API 的 PyTorch-PaddlePaddle API 映射列表。
序号 | PyTorch API | PaddlePaddle API | 备注 |
---|---|---|---|
1 | torch.sparse.addmm |
paddle.sparse.admm |
功能一致,仅参数名不一致,差异对比 |
2 | torch.sparse.mm |
paddle.sparse.matmul |
功能一致,仅参数名不一致,差异对比 |
3 | torch.sparse.softmax |
paddle.sparse.nn.functional.softmax |
功能一致,torch 参数更多,差异对比 |
4 | torch.sparse.sum |
功能缺失 | |
5 | torch.sparse.sampled_addmm |
功能缺失 |
持续更新...
其他类 API 映射列表¶
梳理了其他类 API 的 PyTorch-PaddlePaddle API 映射列表。
持续更新...