Merged
fix(operation): Fix validshape of cat not correct #6289
lidongshengAdd on Sep 15
fix(operation): Fix validshape of cat not correct #6289
Merged
lidongshengAdd on Sep 15
lidongsheng
lidongshengCollaborators
Sep 15

Related Issue: #2559

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for lidongsheng's contribution.)
lidongshenglidongshengCollaborators
Sep 15 Created pull request, commit 7388e9e9
lidongshenglidongshengCollaborators
Sep 15 Associated issue: [Task|任务跟踪]: 新IR适配
atomgit-bot
atomgit-bot
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 构建。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Sep 15 Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Sep 15 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
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 /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)
likedislike
CANN-robot
CANN-robotCollaborators
Sep 15 Comments:

CLA Signature Pass

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

likedislike
CANN-robotCANN-robotCollaborators
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
CANN-robotCANN-robotCollaborators
Sep 15 Set xinweiliu,cam_bxh,dai-zhentao,shi-dingkun,gguuaanngg,gaoxiang618,DCGDDD,yinjie27_,make_pto,linjiashu as approver
lidongsheng
lidongshengCollaborators
Sep 15 Comments:

compile

likedislike
lidongshenglidongshengCollaborators
Sep 15 Pre merge succeeded (commit_id: 000b145087e1cdbe6f912a241786d5c8b67743d7)
CANN-robot
CANN-robotCollaborators
Sep 15 Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
Sep 15 Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 15 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 15 Added label: ci-pipeline-passed
Jie Yin
Jie YinCollaborators
Sep 15 Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
Sep 15 Added label: approved
gaoxiang618
gaoxiang618Collaborators
Sep 15 Comments:

/approve
/lgtm

likedislike
CANN-robotCANN-robotCollaborators
Sep 15 Added label: lgtm
CANN-robotCANN-robotCollaborators
Sep 15 Merged pull request