Pull Request已成功合入, 合并人@CANN-robot
(感谢 zl_hw 的贡献)变更摘要
本 PR 主要围绕 scatter 类算子和 LambApplyOptimizerAssign 算子进行修正。在 scatter_div、scatter_max、scatter_min、scatter_mul、scatter_list 的算子定义中,为各输入输出补加了 AutoContiguous(),用于统一处理非连续张量。同时,LambApplyOptimizerAssign 的 InferShape4LambApplyOptimizerAssign 推断逻辑与 tiling 对齐:明确 inputv 与 inputm 承载动量更新结果且形状必须一致,grad 与 input3 只能向上广播进动量形状,输出形状由 inputv/inputm 决定,并同步补充了相应单元测试。
主要改动
scatter类算子补充AutoContiguous():在scatter_div_def.cpp、scatter_max_def.cpp、scatter_min_def.cpp、scatter_mul_def.cpp中为var、indices、updates等输入输出统一追加.AutoContiguous(),使这些算子支持非连续输入。scatter_list补充AutoContiguous():在scatter_list_def.cpp的 910b、310p 及 kirin 三套配置中,为var、indice、updates、mask输入输出统一追加.AutoContiguous(),覆盖不同平台的算子定义。LambApplyOptimizerAssign推断逻辑与 tiling 对齐:在lamb_apply_optimizer_assign_infershape.cpp中新增INPUT3_IDX,要求inputv与inputm形状一致,并改为校验grad、input3能广播进动量形状,最终将output0、outputv、outputm的形状统一设置为动量形状。- 补充
LambApplyOptimizerAssign推断单元测试:在test_lamb_apply_optimizer_assign_infershape.cpp中新增RunInferShape辅助函数,并新增测试覆盖「动量形状决定输出形状」「grad大于动量形状被拒收」「input3大于动量形状被拒收」「inputv/inputm形状不一致被拒收」等场景。


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.
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 |
|---|---|---|
| */*/README.md | ✅ 陈娇, 汤平川 (2/2) | ✅ 陈娇 (1/1) |
| */*/docs/acl*.md | ✅ 陈娇, 汤平川 (2/2) | ✅ 陈娇 (1/1) |
| */*/op_host/*_def.cpp | ✅ 王永光, 汤平川 (2/2) | ✅ 王永光 (1/1) |
| docs | ✅ 陈娇, 汤平川 (2/2) | ✅ 陈娇 (1/1) |
| optim | ✅ 陈风, 汤平川 (2/2) | ✅ 陈风, 汤平川 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
zl_hw, thanks for your pull request. All authors of the commits have signed the CLA. 👍


流水线任务触发成功
任务链接 [de8a040bd27647aebf0627fb03dbac22][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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_report_lcov | ✅ SUCCESS | >>>>> |
[2026-08-17 22:07:17] CI执行结束


流水线任务触发成功
任务链接 [ff618f5d737548b4ac00c0ab48498b6e][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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-17 21:52:43] CI执行结束


/lgtm
/approve


/lgtm
/approve


/approve


描述
长尾算子问题优化:scatter 类补 AutoContiguous;LambApplyOptimizerAssign infershape 与 tiling 对齐;foreach inplace 与 ScatterList 资料订正
关联的Issue
https://gitcode.com/cann/ops-nn/issues/4865
测试
不涉及
文档更新
README
类型标签
AI/Agent生成声明