Merged
fix: circular_pad_grad golden 支持 torch.Tensor 输入并对非法输入零值降级 #6873
tan_xinAdd on 11 days ago
fix: circular_pad_grad golden 支持 torch.Tensor 输入并对非法输入零值降级 #6873
Merged
tan_xinAdd on 11 days ago
tan_xinCollaborators
11 days ago

描述

完善 conversion/circular_pad_grad/tests/assets/golden.py 对 aclnn 通路 golden 的处理:

  1. 支持 torch.Tensor 输入:aclnn 通路 CPU host 侧对 torch 原生 dtype(float32/float16)以 torch.Tensor 传入、非原生 dtype(bfloat16)以 numpy 视图传入;circular_pad_grad_golden 与 _aclnn_circular_pad_grad_golden 均增加对 torch.Tensor 输入的支持(detach().cpu().numpy() 转换或直接透传给 torch 计算)。
  2. bfloat16 识别修正:dtype 判断由精确相等改为子串匹配("bfloat16" in origin_dtype),覆盖 torch dtype 字符串变体。
  3. 非法输入零值降级:新增 _aclnn_zero_fallback,当 golden 数学对非法输入(expected_error 用例,如 padding 非法)必然失败时,不再先行抛出 GOLDEN_FAILURE 中断流程,而是返回与输出容器同 shape/dtype 的零参考,让用例继续进入算子侧校验,由算子拒收产生证据。
  4. Spec 签名扩展:AclnnCircularPad2dBackwardSpec.golden / AclnnCircularPad3dBackwardSpec.golden 增加 gradInput 参数,并包裹 try/except 实现零值降级。

关联的Issue

关联 Issue #4302

测试

  • aclnn 通路 golden 用例:torch.Tensor 输入(float32/float16)与 numpy bfloat16 输入均验证。
  • expected_error 非法输入用例:golden 零值降级后进入算子侧校验,验证算子拒收行为。

文档更新

NA

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for tan_xin's contribution.)
Ttan_xinCollaborators
11 days ago Created pull request, commit 766f97b3
Ttan_xinCollaborators
11 days ago virtual merging failed, update merge request[project_id: 7649531, iid: 6873, target_commit_sha: 766f97b3fcd28426a15fae983f32e02060ba253b], message: MR has no commits
Ttan_xinCollaborators
11 days ago Force-pushed 95 commits:766f97b3-95 commits from branch master
Ttan_xinCollaborators
11 days ago virtual merging failed, update merge request[project_id: 7649531, iid: 6873, target_commit_sha: 766f97b3fcd28426a15fae983f32e02060ba253b], message: MR has no commits
CANN-robot
CANN-robotCollaborators
11 days ago Comments:

Warning

The PR commit(s) can not be got, please check it!

likedislike
CANN-robot
CANN-robotCollaborators
11 days ago 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
conversion/circular_pad_grad ✅ 汤平川, 宋恺 (2/2) ✅ 汤平川 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

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

likedislike
Ttan_xinCollaborators
11 days ago Pre merge succeeded (commit_id: 0aa8194477638e0b5432e0d3bc0ff806d306e800)
Ttan_xinCollaborators
11 days ago Pushed 1 commits:fd21e3bd-golden
Ttan_xinCollaborators
11 days ago Pre merge succeeded (commit_id: 0c09d860d6e9b6a862f9c59dd30f11cdf4563ee3)
CANN-robotCANN-robotCollaborators
11 days ago Added label: cann-cla/yes
CANN-robotCANN-robotCollaborators
11 days ago Set FelixTang7,yue-ma,zhou-qilong,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,zl_hw,songkai111,chenxingyu18,pingchuantang,llimwang,gubaocheng,andong_hw,xuejinghui,onanfield,zhanw_coding,clinglai0517 as approver
CANN-robotCANN-robotCollaborators
11 days ago Set FelixTang7,yue-ma,zhou-qilong,wangrui_,rxtfeng,loov1,zhangzijie,zl_hw,songkai111,chenxingyu18,pingchuantang,llimwang,gubaocheng,andong_hw,xuejinghui,onanfield,zhanw_coding,clinglai0517 as approver
tan_xinCollaborators
11 days ago Comments:

compile

likedislike
Ttan_xinCollaborators
11 days ago Pre merge succeeded (commit_id: c722824fabafd10cc55300b895715fe965c699e0)
CANN-robot
CANN-robotCollaborators
11 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
11 days ago Added label: ci-pipeline-running
Ttan_xinCollaborators
11 days ago Change title to "fix: circular_pad_grad golden 支持 torch.Tensor 输入并对非法输入零值降级", originally titled "fix: 完善circular_pad_grad aclnn golden对torch输入支持及非法输入零值降级".
Ttan_xinCollaborators
11 days ago Modify description of pull request
tan_xinCollaborators
11 days ago Comments:

compile

likedislike
CANN-robot
CANN-robotCollaborators
11 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
11 days ago Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
11 days ago Added label: ci-pipeline-failed
CANN-robotCANN-robotCollaborators
11 days ago Removed label: ci-pipeline-failed
CANN-robotCANN-robotCollaborators
11 days ago Added label: ci-pipeline-passed
TangPC
TangPCCollaborators
11 days ago Comments:

/lgtm
/approve

likedislike
CANN-robotCANN-robotCollaborators
11 days ago Added label: approved
songkai111Collaborators
11 days ago Comments:

/lgtm

likedislike
CANN-robotCANN-robotCollaborators
11 days ago Added label: lgtm
CANN-robotCANN-robotCollaborators
11 days ago Closed associated issue
CANN-robotCANN-robotCollaborators
11 days ago Merged pull request