已关闭
[Bug-Report|缺陷反馈][PR#1975] InferShape异常返回缺少ERROR日志 #1244
su-yueming创建于  4月14日关闭于  6月15日
su-yueming成员
4月14日 创建

本Issue报告PR#1975检视发现的InferShape日志规范问题。

问题描述

InferShape函数在异常返回前缺少OP_LOGE日志,无法定位问题原因。

问题位置

文件:atanh_infershape.cpp
行号:31-33, 35-37

问题代码

static ge::graphStatus InferShape4Atanh(gert::InferShapeContext* context)
{
const gert::Shape* inputShape = context->GetInputShape(0);
if (inputShape == nullptr) {
return ge::GRAPH_FAILED; // 缺少ERROR日志
}

gert::Shape* outputShape = context->GetOutputShape(0);
if (outputShape == nullptr) {
    return ge::GRAPH_FAILED;  // 缺少ERROR日志
}

*outputShape = *inputShape;
return ge::GRAPH_SUCCESS;

}

规范引用

review_checklist.md 10.3:异常返回前必须OP_LOGE。

影响分析

无法定位是哪个指针为nullptr,调试效率低。

建议修复

使用OP_CHECK_NULL_WITH_CONTEXT宏替代手动判空:
OP_CHECK_NULL_WITH_CONTEXT(context, inputShape);
OP_CHECK_NULL_WITH_CONTEXT(context, outputShape);

发现来源

PR: #1975 (ops-math/atanh)
检视时间: 2026-04-14

likedislike
Ssu-yueming成员
4月14日 修改标题为 “[Bug-Report|缺陷反馈][PR#1975] InferShape异常返回缺少ERROR日志”,原标题为“[Bug-Report|缺陷反馈][PR#1973] TilingData类型截断风险”
Ssu-yueming成员
4月14日 修改了issue 的描述
sunchun成员
4月15日 评论:

/assign @chenxingyu18

likedislike
CANN-robotCANN-robot成员
4月15日 将 chenxingyu18 设为负责人
sunchun成员
4月25日 评论:
likedislike
CANN-robot
CANN-robot成员
4月25日 评论:

Notice

This issue can not be assigned to hw-zhangpanpan. Please try to assign to the repository members.

likedislike
CANN-robotCANN-robot成员
6月15日 关闭了 issue
CANN-robotCANN-robot成员
6月15日 添加了label:resolved