Pull Request已成功合入, 合并人@CANN-robot
(感谢 raoliang_sac 的贡献)变更摘要
本次变更对 norm/in_infer_v2/tests/assets/golden.py 进行 TestSpec 规范升级:引入 __spec__ 注册机制使 kernel 与 GEIR 共用 in_infer_v2 算子键和 INInferV2KernelSpec;核心计算改为 Promote 感知的 Torch CPU true-value 路径,保留框架传入的 FP64 输入而不再强制窄化为 FP32;新增独立的 _INInferV2Compose third-party 组合类以对齐 arch35 kernel 的 FP32 运算顺序;删除无真实接口支撑的 ACLNN golden 注册;同时保留兼容旧加载器的 __golden__ 入口并与 TestSpec 复用同一计算核心。
主要改动
- 引入
__spec__TestSpec 注册与INInferV2KernelSpec类:新增__spec__ = {"in_infer_v2": "INInferV2KernelSpec"}注册,INInferV2KernelSpec聚合了golden、third_party、tolerance三个字段,统一 kernel/GEIR 的测试规格入口。 - 删除 ACLNN golden 注册:从
__golden__字典中移除"aclnn"条目,删除aclnn_in_infer_v2_golden函数,并在文件末尾注释说明该算子配置为ACLNNTYPE aclnn_exclude,无真实接口支撑。 - 计算核心改为 Promote 感知的 dtype 策略:新增
_reference_dtype函数,通过torch.promote_types自动选择至少 FP32 且保留更宽浮点类型(如 FP64)的计算精度;_compute函数改用to(dtype=compute_dtype)替代旧版强制to(torch.float32),不再丢失框架 Promote 传入的高精度输入。 - 新增
_INInferV2Compose独立 Torch third-party 组合类:按 arch35 kernel 的 FP32 运算顺序实现(先算scale = gamma / sqrt(var+eps),再逐元素乘加),仅接受 FP16/FP32 的 x 输入,并配置了_TOL字典为 FP16 和 FP32 提供cross_checkL1 容差。 - 重构输入/输出适配层:新增
_as_tensor、_stat_matrix、_numpy_outputs、_kernel_golden等辅助函数,将旧版in_infer_v2_golden抽稀为对_kernel_golden的委托调用,_resolve_epsilon支持新旧属性格式兼容,in_infer_v2_golden作为兼容旧加载器的__golden__入口保留。


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 |
|---|---|---|
| norm | ✅ 刘波, 唐玮玮, 汤平川 (3/2) | ✅ 汤平川 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


compile


流水线任务触发成功
任务链接 [eea3c232d77a49c1938d145e0fb87845][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Pre | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_950_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_950_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_classify | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_mobile_station_9030_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test_ophost | ✅ SUCCESS | ||
| UT_Test_opapi | ✅ SUCCESS | ||
| UT_Test_kernel | ✅ SUCCESS | ||
| UT_Test_opgraph | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> | |
| UT_Test_harmony-infer-chs-nn | ✅ SUCCESS | ||
| UT_Test_harmony-infer-chs-nn-1 | ✅ SUCCESS | ||
| UT_Test_harmony-infer-cpro-nn | ✅ SUCCESS | ||
| UT_Test_report_lcov | ⚠️ WARNING | >>>>> |
[2026-08-11 09:35:12] CI执行结束


流水线任务触发成功
任务链接 [1f0fb86609854d27b2941a44d12920c9][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_precommit | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> |
[2026-08-11 09:20:25] CI执行结束


/lgtm
/approve


/lgtm
/approve


描述
本次仅更新
norm/in_infer_v2/tests/assets/golden.py:__spec__TestSpec 注册,kernel 与 GEIR 共用in_infer_v2算子键和 Spec。cross_check容差。__golden__,并与 TestSpec 复用同一计算核心。ACLNNTYPE aclnn_exclude,不新增 ACLNN 或 e2e 通路。关联的Issue
关联 Issue #4684:https://gitcode.com/cann/ops-nn/issues/4684
测试
pre-commit run --files norm/in_infer_v2/tests/assets/golden.py:通过。文档更新
无,本次仅更新 golden 测试资产。
类型标签
AI/Agent生成声明