已合并
fix(tensor): clarify view rank mismatch assert message #6606
HuYiSheng创建于 9月22日
fix(tensor): clarify view rank mismatch assert message #6606
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 HuYiSheng 的贡献)9月22日 关联了issue:[Bug-Report|缺陷反馈]:【易用性】PyPTO 框架的编译期/运行时报错信息缺少源码定位与修复建议
atomgit-bot
9月22日 评论:
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 快速定位与修复。


不准确?
atomgit-bot
9月22日 评论:
9月22日 评论:
9月22日 添加了label:cann-cla/yes
CANN-robot
9月22日 评论:
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
/approveor/lgtm- Commenting
/approveimplies 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. 👍


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设为评审人
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设为评审人
9月22日 将TianXL,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gcw_kUomxQ2l,Andy-lb设为审查人
杨旭
9月22日 评论:
9月22日 评论:
/lgtm


HuYiSheng
9月22日 评论:
9月22日 评论:
/compile


9月22日 预合并成功(commit_id: 0b55282479710a4e11a777e1de585a1405a15c69)
CANN-robot
9月22日 评论:
9月22日 评论:
| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


9月22日 添加了label:ci-pipeline-running
9月22日 删除了label:ci-pipeline-running
9月22日 添加了label:ci-pipeline-failed
HuYiSheng
9月22日 评论:
9月22日 评论:
/compile


CANN-robot
9月22日 评论:
9月22日 评论:
| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


9月22日 删除了label:ci-pipeline-failed
9月22日 添加了label:ci-pipeline-running
9月22日 删除了label:ci-pipeline-running
9月22日 添加了label:ci-pipeline-passed
liulun0308
9月22日 评论:
9月22日 评论:
/approve


9月22日 添加了label:lgtmapproved
9月22日 合入了pull request
背景
PyPTO 编译期/运行时报错信息缺少源码定位与修复建议(11 算子批次共性问题的最高成本项)。其中报错点 1:
pypto.view做 rank 变化(4D→5D、2D→3D)时,F21003 断言仅输出裸数字:不说明"谁的 4、谁的 5"、不说 view 不支持改 rank、无修复建议,agent/用户单次定位耗时 5–20 分钟。
改动概览
framework/src/interface/tensor/logical_tensor.cppGetViewValidShape():558"Their sizes actually are N and M"为全仓唯一触发点)断言条件、错误码(F21003)、抛异常机制、控制流均未改动,纯诊断信息增强,行为零变化。
修改后消息: