Merged
fix(operation): Fix validshape of cat not correct #6289
lidongshengAdd on Sep 15
fix(operation): Fix validshape of cat not correct #6289
Merged
Merged fromtsungl4/pypto-opencat_9.2intocann/pypto9.2.0
Pull Request has been successfully merged by CANN-robot.
(Thank you for lidongsheng's contribution.)Sep 15 Created pull request, commit 7388e9e9
Sep 15 Associated issue: [Task|任务跟踪]: 新IR适配
atomgit-bot
Sep 15 Comments:
Sep 15 Comments:
变更摘要
本 PR 修复 Cat 算子结果张量 valid shape(动态 shape)计算不正确的问题(关联 issue #2559)。核心改动是:在 Tensor 上新增按轴获取 valid shape 的接口 GetValidShape(int axis)(tensor.h 声明、tensor.cpp 实现),并在 concat.cpp 的 Cat 函数中改为基于各输入张量的 GetValidShape(axis) 累加出结果轴上的动态大小,再通过 UpdateDynValidShape 写入结果的 valid shape,从而使拼接结果的动态 shape 信息得以正确保留,而不再只依赖静态 shape。
主要改动
- 新增
Tensor::GetValidShape(int axis)接口:在framework/include/tilefwk/tensor.h声明、framework/src/interface/tensor/tensor.cpp实现,支持负轴归一化与越界断言,且当动态 valid shape 为空时回退返回静态storage_->shape[axis]。 - 重构
Cat的轴尺寸计算:在concat.cpp中将原先的tensor.GetShape()[axis]改为tensor.GetShape(axis),并新增SymbolicScalar axisDynSize对各输入的GetValidShape(axis)累加,作为结果张量该轴的动态尺寸。 - 为结果张量写入 valid shape:
Cat中先取tensors[0].GetValidShape(),为空时用SymbolicScalar::FromConcrete(resultShape)兜底,然后将axisDynSize.Simplify()写入对应轴并调用GetStorage(false)->UpdateDynValidShape(validShape),使结果张量携带正确的动态 shape 信息;同时将offset初始化为按resultShape.size()而非原shapeSize构建。


Incorrect?
atomgit-bot
Sep 15 Comments:
Sep 15 Comments:
Sep 15 Added label: cann-cla/yes
CANN-robot
Sep 15 Comments:
Sep 15 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 |
|---|---|---|
| framework/include/tilefwk | ✅ 尹杰, gaoxiang618 (2/2) | ✅ 尹杰, gaoxiang618 (2/1) |
| framework/src/interface/operation | ✅ 尹杰, gaoxiang618 (2/2) | ✅ 尹杰 (1/1) |
| framework/src/interface/tensor | ✅ 尹杰, gaoxiang618 (2/2) | ✅ 尹杰, gaoxiang618 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


CANN-robot
Sep 15 Comments:
Sep 15 Comments:
Sep 15 Set xinweiliu,cam_bxh,dai-zhentao,lululu40888,shi-dingkun,gguuaanngg,codehjp423,gaoxiang618,wangzheng97,DCGDDD,syfeng,jason_yuan_ye,foundea,ym-HW,hw_zhangzhiqi,yinjie27_,congqiannan,zhangyuebing,gaoxingwang,zhiweiyuan,caodongdong,make_pto,zhoubotcam,linjiashu,wangbing110,WenboCodes as approver
Sep 15 Set xinweiliu,cam_bxh,dai-zhentao,lululu40888,shi-dingkun,gguuaanngg,codehjp423,gaoxiang618,wangzheng97,DCGDDD,syfeng,jason_yuan_ye,foundea,ym-HW,hw_zhangzhiqi,yinjie27_,congqiannan,zhangyuebing,gaoxingwang,zhiweiyuan,caodongdong,make_pto,zhoubotcam,linjiashu,wangbing110,WenboCodes as approver
Sep 15 Set xinweiliu,cam_bxh,dai-zhentao,shi-dingkun,gguuaanngg,gaoxiang618,DCGDDD,yinjie27_,make_pto,linjiashu as approver
Sep 15 Set xinweiliu,cam_bxh,dai-zhentao,shi-dingkun,gguuaanngg,gaoxiang618,DCGDDD,yinjie27_,make_pto,linjiashu as approver
lidongsheng
Sep 15 Comments:
Sep 15 Comments:
compile


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


Sep 15 Added label: ci-pipeline-running
Sep 15 Removed label: ci-pipeline-running
Sep 15 Added label: ci-pipeline-passed
Jie Yin
Sep 15 Comments:
Sep 15 Comments:
/approve


Sep 15 Added label: approved
gaoxiang618
Sep 15 Comments:
Sep 15 Comments:
/approve
/lgtm


Sep 15 Added label: lgtm
Sep 15 Merged pull request
Related Issue: #2559