Closed
SoftplusGrad 动态 Rank 广播推导失败 #6842
KaranocaVeAdd on  Oct 19Closed at  29 days ago
KaranocaVe
KaranocaVe
Oct 19 Create

SoftplusGrad 动态 Rank 广播推导失败

现象

SoftplusGrad 的 README 声明 gradients 与 features 支持 NumPy 风格广播,输出 shape 为广播结果;算子定义同时开启 DynamicRank。当前 Host InferShape 先复制 gradients 的 shape,再逐维合并 features。当输入 shape 为 unknown rank [-2] 和已知 rank [2,3] 时,unknown rank 会参与普通维度比较,导致广播 helper 返回失败。

证据与结论

  • 源码固定为 cann/ops-nn 提交 ae873b119fb5499c41a6893f920171551fb0a197。
  • README 明确写有 NumPy 风格广播契约;算子注册设置 DynamicRankSupportFlag(true)。
  • 在 [-2] 与 [2,3] 输入上,轻量 C++ harness 调用了真实 InferShapeSoftplusGrad。基线返回 GRAPH_FAILED,并在失败前把输出形状扩成 [ -2, 0 ]。
  • unknown rank 无法在编译期证明与已知 rank 维度不兼容;正确的保守推导应成功并输出 unknown rank [-2],等待后续动态信息确定结果。

修复范围

若任一输入为 unknown rank,直接将输出标为 unknown rank 并成功返回。新增 Host UT 覆盖该广播组合;其余已知 rank 的逐维广播校验不变。

验证

  • InferShape 失败已由真实 Host InferShape 函数的基线和修复后对照复现;没有据此推断设备执行行为。

关联 PR: https://gitcode.com/cann/ops-nn/merge_requests/12210

likedislike
KaranocaVeKaranocaVe
Oct 19 Associated pull request
KaranocaVeKaranocaVe
Oct 19 Modify description of issue
yuning_chenyuning_chenCollaborators
Oct 19 Assign KaranocaVe as responsible person
CANN-robotCANN-robotCollaborators
29 days ago Close issue
CANN-robotCANN-robotCollaborators
28 days ago Added label: resolved