Pull Request已成功合入, 合并人@ascend-robot
(感谢 Kuteriod 的贡献)Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-Ascend/pytorch | ✅ chuboning, liangsongwei (2/2) | ✅ chuboning (1/1) |
| test | ✅ chuboning, liangsongwei (2/2) | ✅ chuboning (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
wangzhenwu, thanks for your pull request. All authors of the commits have signed the CLA. 👍


compile


问题/功能描述
本次PR主要包含三部分内容,旨在提升NPU算子ONNX导出功能的正确性和接口一致性。首先,激活了五个NPU自定义算子(多头注意力、格式转换、LSTM单元、LSTM网络和GRU网络)的ONNX导出测试用例,以验证其导出路径的有效性。其次,对torch_npu.npu_format_cast函数的API签名进行了优化,将可选参数customize_dtype明确为仅关键字参数,以提升调用清晰度和安全性。最后,修复了_NPUFormatCastOP类forward方法的参数定义,使其与相关符号图方法和包装函数保持一致,确保算子在前向传播、符号图构建及用户调用层面的接口统一。
修改方案描述
修改方案涉及三个文件。在测试文件中,移除了五个测试方法(test_wrapper_npu_multi_head_attention等)的@unittest.skip装饰器,使其能够正常执行并验证ONNX模型文件的生成。在JSON配置文件中,将torch_npu.npu_format_cast的函数签名从(self, acl_format, customize_dtype=None)调整为(self, acl_format, *, customize_dtype=None),强制customize_dtype必须以关键字参数形式传递。在算子实现文件中,将_NPUFormatCastOP.forward方法的参数从通用的*args, **kwargs明确指定为(self, acl_format, customize_dtype=None),并与对应的symbolic方法及包装函数对齐,同时将包装函数中的customize_dtype也改为仅关键字参数。


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_X86 | ✅ | >>> |
| Build_ARM | ✅ | >>> | |
| Build_LibTorch_x86 | ✅ | >>> | |
| Build_X86_torchair | 🛑 | >>> | |
| Build_ARM_torchair | 🛑 | >>> | |
| Build_ARM_inductor | 🛑 | >>> | |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | CodeCheck | ✅ | >>> |
| check_error | ✅ | >>> | |
| 开源片段检查 | SCA | ✅ | >>> |
| 开发者测试 | UT_X86_Part_01 | 🛑 | >>> |
| UT_X86_Part_02 | 🛑 | >>> | |
| UT_ARM_A3_Part_01 | 🛑 | >>> | |
| UT_ARM_A3_Part_02 | 🛑 | >>> | |
| UT_DIST_X86_Part_01 | 🛑 | >>> | |
| UT_DIST_X86_Part_02 | 🛑 | >>> | |
| UT_DIST_X86_Part_03 | 🛑 | >>> | |
| UT_DIST_X86_Part_04 | 🛑 | >>> | |
| UT_inductor_Part_01 | 🛑 | >>> | |
| UT_inductor_Part_02 | 🛑 | >>> | |
| UT_inductor_Part_03 | 🛑 | >>> | |
| UT_inductor_Part_04 | 🛑 | >>> | |
| UT_ARM_A2_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Part_02 | ✅ | >>> | |
| 流水线 | PR-pipeline_pytorch | ✅ | >>> |


/lgtm


Review Guide
This pull-request passes review.
Committers who wrote a comment of /approve are: chuboning.
Reviewers who wrote a comment of /lgtm are: chuboning, liangsongwei.


【合入来源】
【修改方案】
【资料变更】
【接口变更】
【功能验证】
【CheckList】