Merged
fix(tensor): clarify view rank mismatch assert message #6606
HuYiShengAdd on Sep 22
fix(tensor): clarify view rank mismatch assert message #6606
Merged
Merged fromHuYiSheng01/Hys_pypto9.2.0intocann/pypto9.2.0
Pull Request has been successfully merged by CANN-robot.
(Thank you for HuYiSheng's contribution.)Sep 22 Associated issue: [Bug-Report|缺陷反馈]:【易用性】PyPTO 框架的编译期/运行时报错信息缺少源码定位与修复建议
atomgit-bot
Sep 22 Comments:
Sep 22 Comments:
变更摘要
本 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 快速定位与修复。


Incorrect?
atomgit-bot
Sep 22 Comments:
Sep 22 Comments:
Sep 22 Added label: cann-cla/yes
CANN-robot
Sep 22 Comments:
Sep 22 Comments:
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. 👍


Sep 22 Set 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 as approver
Sep 22 Set 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 as approver
Sep 22 Set TianXL,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gcw_kUomxQ2l,Andy-lb as approver
Sep 22 Set TianXL,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gcw_kUomxQ2l,Andy-lb as approver
杨旭
Sep 22 Comments:
Sep 22 Comments:
/lgtm


HuYiSheng
Sep 22 Comments:
Sep 22 Comments:
/compile


Sep 22 Pre merge succeeded (commit_id: 0b55282479710a4e11a777e1de585a1405a15c69)
CANN-robot
Sep 22 Comments:
Sep 22 Comments:
| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


Sep 22 Added label: ci-pipeline-running
Sep 22 Removed label: ci-pipeline-running
Sep 22 Added label: ci-pipeline-failed
HuYiSheng
Sep 22 Comments:
Sep 22 Comments:
/compile


CANN-robot
Sep 22 Comments:
Sep 22 Comments:
| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


Sep 22 Removed label: ci-pipeline-failed
Sep 22 Added label: ci-pipeline-running
Sep 22 Removed label: ci-pipeline-running
Sep 22 Added label: ci-pipeline-passed
liulun0308
Sep 22 Comments:
Sep 22 Comments:
/approve


Sep 22 Added label: lgtmapproved
Sep 22 Merged 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)、抛异常机制、控制流均未改动,纯诊断信息增强,行为零变化。
修改后消息: