Skip to content

Conversation

@LittleHeroZZZX
Copy link
Contributor

@LittleHeroZZZX LittleHeroZZZX commented Jan 20, 2026

PR Docs

本 PR 将 NO_NEED_CONVERT APIs 收入 api_mapping 统一管理,并更名为 ChangePrefixMatcher

PR APIs

具体包括:

  • 以原 GLOBAL_VAR.NO_NEED_CONVERT 为标准,将对应 API 在 api_mapping.json 中的条目统一注册为无需转换
  • GLOBAL_VAR.NO_NEED_CONVERT 从硬编码修改为 从 api_mapping.json 动态生成
  • NoNeedConvertMatcher 更名为ChangePrefixMatcher

Docs 仓工具需要配套修改,关联PR PaddlePaddle/docs#7683

Note
https://github.com/PaddlePaddle/Paddle/pull/77431/changes 引入 Broken 更新,本 PR 固定 Paddle 为 0119 以测试 CI

@paddle-bot
Copy link

paddle-bot bot commented Jan 20, 2026

Thanks for your contribution!

The NO_NEED_CONVERT_LIST in global_var.py contained numerous duplicate and unnecessary entries, which made the list difficult to maintain and review. This commit cleans up the list by removing all redundant items, leaving only the essential entries that are genuinely required. The cleanup improves code clarity and reduces potential confusion when managing the conversion exclusions.
- Rename NoNeedConvertMatcher class to ChangePrefixMatcher in api_matcher.py
- Update API mapping in CONTRIBUTING.md to reflect matcher name change
- Update references in global_var.py and basic_transformer.py
@LittleHeroZZZX LittleHeroZZZX changed the title [NO REVIEW][TEST CI]Add no_need_convert apis from global var to api_mapping.json [Tools] Migrate NO_NEED_CONVERT to api_mapping.json and rename matcher class Jan 20, 2026
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.

  1. torch.fft.fftfreq这个能用ChangePrefixMatcher吗
  2. GlobalManager.NO_NEED_CONVERT_LIST这个名单不再需要了,后面直接改api_mappin.json就行。GlobalManager.NO_NEED_CONVERT_LIST这些其他位置代码也都移除了,这个概念以后就不需要了
  3. 目前优先级NO_NEED_CONVERT_LIST>ALIAS_MAPPING>API_MAPPING,移除NO_NEED_CONVERT_LIST后会导致ALIAS优先生效,因此需要清理ALIAS_MAPPING,API_MAPPING中的key不应该在ALIAS_MAPPING中出现。
  4. 为了确保ChangePrefixMatcher真正实现了『API完全一致』效果,单测基类APIBase里还得增强下,检查转换完后的代码必须有self.pytorch_api[1:](类方法为self.pytorch_api[-1]),防止被别名替换了。

@LittleHeroZZZX
Copy link
Contributor Author

torch.fft.fftfreq这个能用ChangePrefixMatcher吗

可以,rfftfreq 和 fftfreq 都可以

GlobalManager.NO_NEED_CONVERT_LIST这个名单不再需要了,后面直接改api_mappin.json就行。GlobalManager.NO_NEED_CONVERT_LIST这些其他位置代码也都移除了,这个概念以后就不需要了
目前优先级NO_NEED_CONVERT_LIST>ALIAS_MAPPING>API_MAPPING,移除NO_NEED_CONVERT_LIST后会导致ALIAS优先生效,因此需要清理ALIAS_MAPPING,API_MAPPING中的key不应该在ALIAS_MAPPING中出现。

Done

为了确保ChangePrefixMatcher真正实现了『API完全一致』效果,单测基类APIBase里还得增强下,检查转换完后的代码必须有self.pytorch_api1:,防止被别名替换了。

下个 commit 再提, BTW 这个链接访问不了

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.

2 participants