已合并
fix inplace_apply_keras_momentum 注册图模式接口修复 #8877
fix inplace_apply_keras_momentum 注册图模式接口修复 #8877
已合并
Davon创建于 8月18日
Davon成员
8月18日

描述

这是算子安装/注册问题一算子opinfo已注册(能找到算子),但 op_proto的infer_datatype函数缺失或 .so未加

关联的Issue

#4893

测试

文档更新

类型标签

AI/Agent生成声明

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 Davon 的贡献)
DDavon成员
8月18日 创建了 pull request,commit 1733ae7d
atomgit-bot
atomgit-bot
8月18日 评论:

变更摘要

该 PR 修复 InplaceApplyKerasMomentum 算子的数据类型推导:将 dtype 推导注册方式从算子 shape 注册(IMPL_OP_INFERSHAPE)调整为 graph 级别的 dtype 推断注册(IMPL_OP),并修正了 accum 输出的 dtype 推导逻辑——此前 accum 输出 dtype 错误地取自输入 var,现改为取自输入 accum 自身的 dtype。同时更新了对应的单测以覆盖新的推导逻辑。

主要改动

  • 注册 graph 级别 dtype 推断: 将注册宏由 IMPL_OP_INFERSHAPE(InplaceApplyKerasMomentum).InferDataType(...) 改为 IMPL_OP(InplaceApplyKerasMomentum).InferDataType(...),并把文件重命名为 inplace_apply_keras_momentum_graph_infer.cpp,使该算子注册为 graph dtype inference。
  • 修正 accum 输出 dtype 推导: 在 InferDataType4InplaceApplyKerasMomentum 中,将 SetOutputDataType(ACCUM_INDEX, context->GetInputDataType(VAR_INDEX)) 改为 context->GetInputDataType(ACCUM_INDEX),即 accum 输出 dtype 与输入 accum 保持一致,而非沿用 var 的 dtype。
  • 清理无用引用: 移除不再使用的头文件包含(exe_graph/runtime/inferDataType_context.h、op_common/log/log.h),并将 using namespace ge; 移入 namespace ops 内部。
  • 同步更新单元测试: 测试中的 InferDataType4InplaceApplyKerasMomentum 扩展为接收 var/accum/lr/grad/momentum 五个输入的 dtype,返回值改为 {inputVarDtype, inputAccumDtype};测试说明明确 lr/momentum 固定为 FP32、不参与输出 dtype 推导,并更新了 FP32/FP16/BF16 用例的断言。
likedislike
不准确?
atomgit-bot
atomgit-bot
8月18日 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
8月18日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
8月18日 评论:

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
optim ✅ 於欣洁, 刘波 (2/2) ✅ 於欣洁 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

Davon14272, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robot
CANN-robot成员
8月18日 评论:

CLA Signature Pass

Davon14272, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robot成员
8月18日 将zengjuan,chenfeng61,chaotang233,crystalhu,yu-xinjie62,yangyang016,fanqirui,su-yueming,chenqi317,wang-xing001,liubo75,tangweiwei2,pingchuantang,qianzehong设为评审人
CANN-robotCANN-robot成员
8月18日 将chenfeng61,yu-xinjie62,su-yueming,wang-xing001,pingchuantang,qianzehong设为审查人
Davon成员
8月18日 评论:

compile

likedislike
DDavon成员
8月18日 预合并成功(commit_id: b8c2288f9e134dcb5c4544c13efa651840ce515d)
DDavon成员
8月18日 修改了pull request 的描述
CANN-robotCANN-robot成员
8月18日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
8月18日 评论:

流水线任务触发成功
任务链接 [9a334eea889d4481b37c21a4db621df3][流水线指导]

任务名称状态日志下载链接
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-18 18:18:34]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
8月18日 评论:

流水线任务触发成功
任务链接 [d838328746f74dfa81a29263ee9c7f89][流水线指导]

任务名称状态日志下载链接
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 ❌ FAILED >>>>> >>>>>
SCA ✅ SUCCESS >>>>>
likedislike
DDavon成员
8月18日 修改了pull request 的描述
此处折叠了8条事件消息 查看更多
CANN-robotCANN-robot成员
8月18日 添加了label:cann-cla/yes
Davon成员
8月18日 评论:

compile

likedislike
DDavon成员
8月18日 预合并成功(commit_id: 96fba227487822f90e6c769de2ebb8cd58b32490)
CANN-robotCANN-robot成员
8月18日 删除了label:ci-pipeline-failedapi-check-pass
CANN-robotCANN-robot成员
8月18日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
8月18日 评论:

流水线任务触发成功
任务链接 [bf875b4d00ee4b2287ca893e3f09d824][流水线指导]

任务名称状态日志下载链接
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-18 18:36:00]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
8月18日 评论:

流水线任务触发成功
任务链接 [1d87c607339243a0ba2512a26864498a][流水线指导]

任务名称状态日志下载链接
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-18 18:26:58]    CI执行结束

likedislike
CANN-robotCANN-robot成员
8月18日 添加了label:api-check-pass
CANN-robotCANN-robot成员
8月18日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
8月18日 添加了label:ci-pipeline-passed
DDavon成员
8月18日 修改标题为 “fix inplace_apply_keras_momentum 注册图模式接口修复”,原标题为“fix(inplace_apply_keras_momentum): register graph dtype inference”
liubo75成员
8月18日 评论:

/lgtm
/approve

likedislike
於欣洁成员
8月18日 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
8月18日 添加了label:lgtmapproved
CANN-robotCANN-robot成员
8月18日 关闭了关联的issue
CANN-robotCANN-robot成员
8月18日 合入了pull request