已合并
fix(tensor): clarify view rank mismatch assert message #6606
HuYiSheng创建于 9月22日
fix(tensor): clarify view rank mismatch assert message #6606
已合并
HuYiSheng创建于 9月22日
HuYiSheng
HuYiSheng成员
9月22日

背景

PyPTO 编译期/运行时报错信息缺少源码定位与修复建议(11 算子批次共性问题的最高成本项)。其中报错点 1:pypto.view 做 rank 变化(4D→5D、2D→3D)时,F21003 断言仅输出裸数字:

ASSERT FAILED: ErrCode: F21003! Enum: FeError::INVALID_VAL
Their sizes actually are 4 and 5

不说明"谁的 4、谁的 5"、不说 view 不支持改 rank、无修复建议,agent/用户单次定位耗时 5–20 分钟。

改动概览

1 file changed, 2 insertions(+), 1 deletion(-)
文件 位置 改动
framework/src/interface/tensor/logical_tensor.cpp GetViewValidShape() :558 重写 FE_ASSERT 消息体(旧文案 "Their sizes actually are N and M" 为全仓唯一触发点)

断言条件、错误码(F21003)、抛异常机制、控制流均未改动,纯诊断信息增强,行为零变化。

修改后消息:

View rank mismatch: input tensor rank is 4, view shape rank is 5. pypto.view cannot
change tensor rank; use pypto.unsqueeze to add a dimension.
likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 HuYiSheng 的贡献)
HuYiShengHuYiSheng成员
9月22日 创建了 pull request,commit d393b19b
HuYiShengHuYiSheng成员
9月22日 关联了issue:[Bug-Report|缺陷反馈]:【易用性】PyPTO 框架的编译期/运行时报错信息缺少源码定位与修复建议
atomgit-bot
atomgit-bot
9月22日 评论:

变更摘要

本 PR 针对 pypto.view 在 rank 变化(如 4D→5D、2D→3D)时报错信息不明确的问题,对 framework/src/interface/tensor/logical_tensor.cpp 中 GetViewValidShape() 的 FE_ASSERT 诊断文案进行重写。改动仅在 FeError::INVALID_VAL(错误码 F21003)断言的输出消息层面,断言条件、错误码、抛异常机制与控制流均保持不变,属于纯诊断信息增强,运行时行为无变化。

主要改动

  • 重写 GetViewValidShape() 的断言消息体:将原先仅输出裸数字的 "Their sizes actually are N and M" 替换为带语义的 "View rank mismatch: ..." 文案,明确提示 rank 不匹配。
  • 标注两个 rank 的具体归属:新消息分别以 input tensor rank 与 view shape rank 区分 validShape.size() 和 viewShape.size(),避免用户无法判断哪个数字对应哪一方。
  • 补充修复建议:新消息说明 pypto.view 不能改变张量 rank,并提示改用 pypto.unsqueeze 增加维度,帮助用户/agent 快速定位与修复。
likedislike
不准确?
atomgit-bot
atomgit-bot
9月22日 评论:

代码审查

✅ 未发现问题

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

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
9.2.0 ✅ gcw_kUomxQ2l, DCGDDD (2/2) ✅ gcw_kUomxQ2l (1/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robotCANN-robot成员
9月22日 将xinweiliu,cam_bxh,dai-zhentao,TianXL,lululu40888,shi-dingkun,gguuaanngg,codehjp423,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gaoxiang618,wangzheng97,DCGDDD,syfeng,jason_yuan_ye,foundea,ym-HW,hw_zhangzhiqi,yinjie27_,congqiannan,zhangyuebing,tsungl4,gaoxingwang,zhiweiyuan,caodongdong,make_pto,zhoubotcam,linjiashu,wangbing110,gcw_kUomxQ2l,Andy-lb,WenboCodes设为评审人
CANN-robotCANN-robot成员
9月22日 将TianXL,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gcw_kUomxQ2l,Andy-lb设为审查人
杨旭
杨旭成员
9月22日 评论:

/lgtm

likedislike
HuYiSheng
HuYiSheng成员
9月22日 评论:

/compile

likedislike
HuYiShengHuYiSheng成员
9月22日 预合并成功(commit_id: 0b55282479710a4e11a777e1de585a1405a15c69)
CANN-robot
CANN-robot成员
9月22日 评论:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robot成员
9月22日 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
9月22日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
9月22日 添加了label:ci-pipeline-failed
HuYiSheng
HuYiSheng成员
9月22日 评论:

/compile

likedislike
CANN-robot
CANN-robot成员
9月22日 评论:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robot成员
9月22日 删除了label:ci-pipeline-failed
CANN-robotCANN-robot成员
9月22日 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
9月22日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
9月22日 添加了label:ci-pipeline-passed
liulun0308
liulun0308成员
9月22日 评论:

/approve

likedislike
CANN-robotCANN-robot成员
9月22日 添加了label:lgtmapproved
CANN-robotCANN-robot成员
9月22日 合入了pull request