已合并
update: 更新文件 matmul_custom.cpp #534
update: 更新文件 matmul_custom.cpp #534
已合并
chenmingyu创建于 8月5日
chenmingyu
chenmingyu成员
8月5日

描述

关联的Issue

测试

文档更新

类型标签

其他信息

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

变更摘要

该 PR 修复了矩阵乘法算子 matmul_custom 中 InferShape 和 InferDataType 的推导逻辑,使其正确反映矩阵乘法(A: [M, K] × B: [K, N] → C: [M, N])的输出形状,并将输出数据类型固定为 FP32。

主要改动

  • InferShape 输出形状推导修正:原先仅将输出形状设为输入 0 的形状,现改为以输入 0 形状为基础,再将输出第二维设为输入 1 的第二维(y_shape->SetDim(1, b_shape->GetDim(1))),正确表达 M×N 的输出形状。
  • InferDataType 输出类型固定为 FP32:原先从输入 0 继承数据类型,现改为直接设置 context->SetOutputDataType(0, ge::DT_FLOAT),确保输出类型确定。
  • 变量命名与注释优化:将 x1_shape 重命名为 a_shape、b_shape,并添加了维度注释(// a: [M, K]、// b: [K, N]、// c: [M, N]),提升代码可读性。
likedislike
不准确?
atomgit-bot
atomgit-bot
8月5日 评论:

代码审查

✅ 未发现问题

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

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-cann/cann-learning-hub ✅ waimaidaole, fuyangchenghu (2/2) ✅ waimaidaole (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)
likedislike
CANN-robot
CANN-robot成员
8月5日 评论:

CLA Signature Pass

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

likedislike
chenmingyuchenmingyu成员
8月5日 关联了issue:[Course-Feedback|课程反馈]: 04.03 Matmul参考答案InferShape/InferDataType错误(输出误用输入a的shape与dtype)
meme成员
8月5日 评论:

/approve
/lgtm

likedislike
CANN-robotCANN-robot成员
8月5日 添加了label:approved
fuyangchenghu成员
8月6日 评论:

/lgtm

likedislike
CANN-robotCANN-robot成员
8月6日 添加了label:lgtm
CANN-robotCANN-robot成员
8月6日 合入了pull request