已合并
fix(operation): Fix validshape of cat not correct #6289
lidongsheng创建于 9月15日
fix(operation): Fix validshape of cat not correct #6289
已合并
lidongsheng创建于 9月15日
lidongsheng
lidongsheng成员
9月15日

Related Issue: #2559

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 lidongsheng 的贡献)
lidongshenglidongsheng成员
9月15日 创建了 pull request,commit 7388e9e9
lidongshenglidongsheng成员
9月15日 关联了issue:[Task|任务跟踪]: 新IR适配
atomgit-bot
atomgit-bot
9月15日 评论:

变更摘要

本 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
不准确?
atomgit-bot
atomgit-bot
9月15日 评论:

代码审查

✅ 未发现问题

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

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-robot成员
9月15日 评论:

CLA Signature Pass

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

likedislike
CANN-robotCANN-robot成员
9月15日 将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设为评审人
CANN-robotCANN-robot成员
9月15日 将xinweiliu,cam_bxh,dai-zhentao,shi-dingkun,gguuaanngg,gaoxiang618,DCGDDD,yinjie27_,make_pto,linjiashu设为审查人
lidongsheng
lidongsheng成员
9月15日 评论:

compile

likedislike
lidongshenglidongsheng成员
9月15日 预合并成功(commit_id: 000b145087e1cdbe6f912a241786d5c8b67743d7)
CANN-robot
CANN-robot成员
9月15日 评论:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robot成员
9月15日 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
9月15日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
9月15日 添加了label:ci-pipeline-passed
Jie Yin
Jie Yin成员
9月15日 评论:

/approve

likedislike
CANN-robotCANN-robot成员
9月15日 添加了label:approved
gaoxiang618
gaoxiang618成员
9月15日 评论:

/approve
/lgtm

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