Merged
docs(matrix_inverse): 修正 aclnnInverse out dtype 约束 #14386
docs(matrix_inverse): 修正 aclnnInverse out dtype 约束 #14386
Merged
weikeAdd on 8 days ago
weike
weikeCollaborators
8 days ago

描述

aclnnInverse 不要求 out 与 self 严格同 dtype;它要求 out 属于支持范围,并且可由 self 转换。

修改中英文接口资料:

  • 修正 out 的使用说明为:数据类型需要是 self 可转换的数据类型,shape 需要与 self 一致;
  • 对齐公开头文件,补充 BFLOAT16、COMPLEX64、COMPLEX128 输出类型,并补充 self 的复数类型;
  • 将错误场景由“self 和 out 数据类型不同”改为“out 的数据类型不是 self 可转换的”。

关联的Issue

https://gitcode.com/cann/ops-nn/issues/7880

测试

文档更新

更新 index/matrix_inverse/docs/aclnnInverse.md 和 index/matrix_inverse/docs/aclnnInverse_en.md。

类型标签

AI/Agent生成声明

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for weike's contribution.)
weikeweikeCollaborators
8 days ago Created pull request, commit 3665b06e
weikeweikeCollaborators
8 days ago Associated issue: [Bug-Report|缺陷反馈]: aclnnInverse 对 out 与 self 的 dtype 不一致不做校验(只查可否 cast),fp32→fp16/bf16 静默降精度返回 0
atomgit-bot
atomgit-bot
8 days ago Comments:

变更摘要

本 PR 修复 matrix_inverse 算子中 aclnnInverse 接口对输出 dtype 校验过于宽松的问题。原实现仅通过 OP_CHECK_RESULT_DTYPE_CAST_FAILED 校验 self 是否可转换为 out 的 dtype,导致 FP32 的 self 搭配 FP16/BF16/DOUBLE 的 out 会被静默接受并以降精度方式执行,与接口资料中“out 的 dtype 需与 self 一致”的要求不符。本次将该校验替换为严格的同 dtype 检查,并补充对应的异常场景单元测试。

主要改动

  • dtype 校验规则收紧:在 index/matrix_inverse/op_host/op_api/aclnn_inverse.cpp 的 CheckDtypeValid 中,将 cast 可行性检查 OP_CHECK_RESULT_DTYPE_CAST_FAILED(self->GetDataType(), out->GetDataType(), return false) 替换为 OP_CHECK_DTYPE_NOT_SAME(self, out, return false),要求 out 与 self 的 dtype 完全一致,否则返回参数错误。
  • 合法路径保持不变:支持列表检查 OP_CHECK_DTYPE_NOT_SUPPORT 与 shape 等其余校验未作调整,同 dtype 的 FLOAT、FLOAT16、DOUBLE 等路径行为不受影响。
  • 新增回归用例:在 index/matrix_inverse/tests/ut/op_host/test_aclnn_inverse.cpp 中新增 abnormal_self_out_dtype_not_same 测试,遍历 ACL_FLOAT16、ACL_BF16、ACL_DOUBLE 三种 out 类型搭配 FP32 self,断言均返回 ACLNN_ERR_PARAM_INVALID。
  • 文件格式补充:aclnn_inverse.cpp 末尾补充了缺失的换行符,仅格式层面调整。

🧩 本次 Review 已使用自定义 Skill:

likedislike
Incorrect?
atomgit-bot
atomgit-bot
8 days ago Comments:

代码审查

✅ 未发现问题


🧩 本次 Review 已使用自定义 Skill:

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
8 days ago Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
8 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
*/*/docs/acl*.md ✅ 陈兴宇, 杨露 (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

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

likedislike
CANN-robotCANN-robotCollaborators
8 days ago Set zengjuan,u010470851,chenfeng61,chaotang233,kevin_huang1234,crystalhu,yangyang016,fanqirui,wangrui_,su-yueming,yourealize,chenqi317,wang-xing001,liubo75,tangweiwei2,chenxingyu18,pingchuantang,qianzehong as approver
12 event messages are collapsed here。 See more
weikeweikeCollaborators
8 days ago Modify description of pull request
weike
weikeCollaborators
8 days ago Comments:

compile

likedislike
weikeweikeCollaborators
8 days ago Pre merge succeeded (commit_id: 9300d094aeeabc878181326c082c896c781276dc)
CANN-robot
CANN-robotCollaborators
8 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
8 days ago Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
8 days ago Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
8 days ago Added label: ci-pipeline-passed
chenxingyu18
chenxingyu18Collaborators
8 days ago Comments:

/lgtm
/approve

likedislike
yuning_chen
yuning_chenCollaborators
8 days ago Comments:

您好,pr合入已准备就绪,请尽快联系committer进行检视,谢谢!
@yangyang016 @su-yueming @wang-xing001 @fanqirui @gitee-duhuiping @fengying555682 @caiwenwen @yanglu-1 @lwx1255555

likedislike
yanglu-1
yanglu-1Collaborators
8 days ago Comments:

/lgtm
/approve

likedislike
CANN-robot
CANN-robotCollaborators
8 days ago Comments:

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
/approve: 陈兴宇

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