From cf166f01e0c48356eb55c3acf4f77f9fdfb1a23d Mon Sep 17 00:00:00 2001 From: wangxiaoxin-sherie Date: Wed, 13 Mar 2024 14:31:34 +0800 Subject: [PATCH] fix clean code. --- ads/common/ops/kernels/op_host/dynamic_scatter.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ads/common/ops/kernels/op_host/dynamic_scatter.cpp b/ads/common/ops/kernels/op_host/dynamic_scatter.cpp index f6e15676..71f2c716 100644 --- a/ads/common/ops/kernels/op_host/dynamic_scatter.cpp +++ b/ads/common/ops/kernels/op_host/dynamic_scatter.cpp @@ -123,8 +123,12 @@ ge::graphStatus DynamicScatterTiling::Init() } coreNum = GetNeedCoreNum(coreNum); ascendcPlatform.GetCoreMemSize(platform_ascendc::CoreMemType::UB, ubSizePlatForm); - - const char* reduceTypePtr = tilingContext->GetAttrs()->GetAttrPointer(DIM_INDEX0); + + auto attrs = tilingContext->GetAttrs(); + if (attrs == nullptr) { + return ge::GRAPH_FAILED; + } + const char* reduceTypePtr = attrs->GetAttrPointer(DIM_INDEX0); std::string reduceType(reduceTypePtr); if (reduceType != "max" && reduceType != "sum") { return ge::GRAPH_PARAM_INVALID; -- Gitee