已合并
fix issues with npu_format_cast function parameters #32693
Kuteriod创建于 3月30日
fix issues with npu_format_cast function parameters #32693
已合并
Kuteriod创建于 3月30日
Kuteriod
Kuteriod成员
3月30日

【合入来源】

如有社区issue,请关联issue链接
请勿携带内部流程信息(需求链接、问题单、内部issue等)

【修改方案】

请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列
如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容)

【资料变更】

请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及”

【接口变更】

请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及”
torch_npu.npu_format_cast参数声明与调用方式统一为关键字参数形式:(self, acl_format, *, customize_dtype=None)。同步调整ONNX wrapper相关测试调用,取消跳过相关测试用例:test_wrapper_npu_multi_head_attention,test_wrapper_npu_format_cast,test_wrapper_npu_gru,test_wrapper_npu_lstm,test_wrapper_npu_lstm_cell

【功能验证】

说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤
新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图

【CheckList】

PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 Kuteriod 的贡献)
KuteriodKuteriod成员
3月30日 创建了 pull request,commit 64c28818
ascend-robotascend-robot成员
3月30日 添加了label:stat/needs-squash
ascend-robot
ascend-robot成员
3月30日 评论:

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 /approve or /lgtm
  • Commenting /approve implies 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. 👍

likedislike
ascend-robotascend-robot成员
3月30日 添加了label:ascend-cla/yes
Kuteriod
Kuteriod成员
3月30日 评论:

compile

likedislike
ascend-robotascend-robot成员
3月30日 添加了label:ci-pipeline-running
AtlasAccount
AtlasAccount成员
3月30日 评论:

问题/功能描述

本次PR主要包含三部分内容,旨在提升NPU算子ONNX导出功能的正确性和接口一致性。首先,激活了五个NPU自定义算子(多头注意力、格式转换、LSTM单元、LSTM网络和GRU网络)的ONNX导出测试用例,以验证其导出路径的有效性。其次,对torch_npu.npu_format_cast函数的API签名进行了优化,将可选参数customize_dtype明确为仅关键字参数,以提升调用清晰度和安全性。最后,修复了_NPUFormatCastOPforward方法的参数定义,使其与相关符号图方法和包装函数保持一致,确保算子在前向传播、符号图构建及用户调用层面的接口统一。

修改方案描述

修改方案涉及三个文件。在测试文件中,移除了五个测试方法(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也改为仅关键字参数。

likedislike
ascend-robotascend-robot成员
3月30日 删除了label:ci-pipeline-running
ascend-robotascend-robot成员
3月30日 添加了label:ci-pipeline-failed
ascend-robotascend-robot成员
3月30日 删除了label:ci-pipeline-failed
ascend-robotascend-robot成员
3月30日 添加了label:ci-pipeline-running
ascend-robotascend-robot成员
3月30日 删除了label:ci-pipeline-running
ascend-robotascend-robot成员
3月30日 添加了label:ci-pipeline-passed
ascend-robot
ascend-robot成员
3月30日 评论:
流水线 PR-pipeline_pytorch#13276 (重试第1次)已完成
阶段 任务名 状态 详情
编译构建 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 >>>
likedislike
KuteriodKuteriod成员
3月31日 修改了pull request 的描述
梁松伟
梁松伟成员
3月31日 评论:

/lgtm

likedislike
chuboning成员
3月31日 评论:

/approve

likedislike
ascend-robotascend-robot成员
3月31日 添加了label:approvedlgtm
ascend-robot
ascend-robot成员
3月31日 评论:

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.

likedislike
ascend-robotascend-robot成员
3月31日 合入了pull request