Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade pytorch-paddle mapping table generating process #6752

Merged
merged 3 commits into from
Jul 10, 2024

Conversation

RedContritio
Copy link
Contributor

@RedContritio RedContritio commented Jul 9, 2024

更新了 PyTorch-Paddle 映射目录的构建方式:

  • 以表为维护单位进行构建:
    • 不再以 api 为单位进行映射构建
    • 为降低维护成本,移除 REFERENCE-MAPPING-ITEM
    • 添加 REFERENCE-MAPPING-TABLE 宏,用于指定表格规则,用法为 REFERENCE-MAPPING-TABLE(prefix, max_depth=255)
    • api 与表格匹配时,优先匹配最长的前缀,如果前缀长度相同,按照表格出现顺序进行匹配。当指定深度时,匹配时检查深度是否小于 max_depthtorch.asin 深度为 1,torch.Tensor.asin 深度为 2,torch.nn.functional.adaptive_max_pool2d 深度为 3),如果检查失败则尝试匹配后续表格。
    • 每个表格内,所有 api 按照字典序排列
  • 其余宏仍然保留:
    • ALIAS-REFERENCE-ITEM:用于指定别名,该宏仍然保留,因为其数据依赖 PaConvertapi_alias_mapping.json 文件,因此手动维护更新;
    • NOT-IMPLEMENT-ITEM:用于构建尚未支持的 API,该宏仍然保留,因为尚未支持的 API 列表数据无法通过其他文件推导。
  • 更新构建方式前后对比:添加了 3 个遗漏的 API

本次更新后,该文件 docs/guides/model_convert/convert_from_pytorch/pytorch_api_mapping_cn.md 将不再需要手动维护其中的映射项,而是自动基于 api_difference 目录下的映射文档进行生成,从而确保能够展示所有内容,并避免出现失同步的现象。

Copy link

paddle-bot bot commented Jul 9, 2024

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

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 merged commit 8297ac3 into PaddlePaddle:develop Jul 10, 2024
2 checks passed
@RedContritio RedContritio deleted the update_mapping_index branch July 10, 2024 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants