Pull Request has been successfully merged by CANN-robot.
(Thank you for 陈思's contribution.)变更摘要
本 PR 修复 optim/apply_came_part4 算子中图原型与算子原型的参数名不一致问题:将算子原型定义中的输入/输出名称(param_in/r_in/c_in、param_out/r_out/c_out)统一改为与图原型一致的 param/r/c,并同步更新 ascend350、ascend950 两个平台的 binary 配置以及测试侧 golden 实现中的参数绑定方式。
主要改动
- 算子原型 I/O 名称统一:
apply_came_part4_def.cpp中Input由param_in、r_in、c_in改为param、r、c,Output由param_out、r_out、c_out改为param、r、c,数据类型、格式与REQUIRED约束保持不变。 - binary 配置输入名称同步:
config/ascend350/apply_came_part4_binary.json与config/ascend950/apply_came_part4_binary.json中 fp32/float16/bf16 三个 bin 的 inputs 和 outputs 名称同步改为param、r、c,与算子原型保持一致。 - 可选输入
sum_r在输入列表中的位置调整:两份 binary 配置中将可选输入sum_r从index7 移到末尾index10,sum_u_r、sum_u_c、sum_u_rc的索引相应前移为 7、8、9,global_shape保持index11。 - golden 计算接口改为按 GE 输入名显式接收参数:
tests/assets/golden.py中_ApplyCamePart4Compose.__init__不再保存kwargs,__call__改为以param、m、r、c、weight_decay、lr、beta3、sum_u_r、sum_u_c、sum_u_rc、sum_r、global_shape等具名参数接收输入,并删除了不再使用的_to_numpy_for_golden。 - golden 数值流程明确化:
__call__内统一转为float32计算,r/c输出先按低精度舍入得到,再参与rc与param_out的更新计算,最终返回[param_out, r_out, c_out]三个结果。
🧩 本次 Review 已使用自定义 Skill:




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.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| */*/op_host/*_def.cpp | ✅ 汤磊, 陈琦, 汤平川 (3/2) | ✅ 汤磊 (1/1) |
| optim | ✅ 汤平川, 陈琦 (2/2) | ✅ 汤平川 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
chensi79, thanks for your pull request. All authors of the commits have signed the CLA. 👍


✅ LGTM - apply_came_part4 输入顺序修复 (sum_r index 调整)
接口变更:
- sum_r: index 7 → 10 (optional 参数后移)
- sum_u_r/sum_u_c/sum_u_rc: index 8/9/10 → 7/8/9 (前移)
- 输入/输出命名简化:param_in → param, r_in → r, param_out → param
golden.py 修复:
- 新增 denom 有效性检查 (finite + > 0)
- 拒绝 NaN/Inf/负数传递给精度比较器
- _checked_param_update() 新增验证
影响:调用方需按新 index 传参 (sum_r 从第 8 个参数移到第 11 个)
推荐批准。
/approve


Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


描述
修复 ApplyCamePart4 的 OpDef、GE 原型和二进制配置之间的参数声明不一致,并补全参考实现的数值异常检查。
param/r/c。sum_u_r/sum_u_c/sum_u_rc对应 index 7/8/9,可选输入sum_r对应 index 10,global_shape对应 index 11;同步 kernel 入口注释。sum_r、global_shape。denom <= 0、非有限 denom、非正或非有限归一化 rc、非有限 param 输出抛出ValueError,避免 NaN/Inf 进入精度比较。有效输入按 kernel 的倒数乘法路径计算,param 更新使用舍入后的 r_out/c_out。关联的Issue
关联 Issue:#8118
https://gitcode.com/cann/ops-nn/issues/8118
测试
git diff --check通过。文档更新
更新 kernel 入口参数顺序注释及 golden 的数值域说明。
类型标签
AI/Agent生成声明