From: 박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 Date: Mon, 25 Nov 2019 01:41:13 +0000 (+0900) Subject: [moco-pass] Refine error with oops (#9153) X-Git-Tag: submit/tizen/20191205.083104~157 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=51ba8da6f78f558db0f8f2cd37467d920fdcaabf;p=platform%2Fcore%2Fml%2Fnnfw.git [moco-pass] Refine error with oops (#9153) This will refine error message using oops Signed-off-by: SaeHie Park --- diff --git a/compiler/moco/pass/CMakeLists.txt b/compiler/moco/pass/CMakeLists.txt index fb6252c..14a2dfd 100644 --- a/compiler/moco/pass/CMakeLists.txt +++ b/compiler/moco/pass/CMakeLists.txt @@ -8,4 +8,5 @@ target_link_libraries(moco_pass PUBLIC logo_core) target_link_libraries(moco_pass PUBLIC moco_lang) target_link_libraries(moco_pass PRIVATE moco_support) target_link_libraries(moco_pass PRIVATE stdex) +target_link_libraries(moco_pass PRIVATE oops) install(TARGETS moco_pass DESTINATION lib) diff --git a/compiler/moco/pass/src/Passes/ResolveConstantShape.cpp b/compiler/moco/pass/src/Passes/ResolveConstantShape.cpp index 83fb823..2a1323f 100644 --- a/compiler/moco/pass/src/Passes/ResolveConstantShape.cpp +++ b/compiler/moco/pass/src/Passes/ResolveConstantShape.cpp @@ -24,6 +24,8 @@ #include +#include + #include namespace @@ -86,13 +88,16 @@ bool resolve_constant_shape(loco::Graph *graph, moco::TFShape *shape_node) for (uint32_t axis = 0; axis < shape_rank; ++axis) { int32_t dim = (int32_t)input_tensor_shape.dim(axis).value(); - assert(dim > 0); + if (!(dim > 0)) + { + throw oops::UserExn("Invalid input shape", shape_node->name()); + } const_node->at(axis) = dim; } } else { - throw std::runtime_error("ResolveConstantShape: Not supported output data type"); + throw oops::UserExn("Unsupported data type", shape_node->name()); } // replace