From a036cc6d4bbd87bc9598f0322ba1746c7c73745e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gin=C3=A9s=20Hidalgo?= Date: Tue, 26 Oct 2021 13:50:32 -0400 Subject: [PATCH] Fixing bugs in ORT_NO_EXCEPTIONS (#9479) ORT_NO_EXCEPTIONS is not working after the latest changes in: onnxruntime/core/graph/function.cc onnxruntime/core/graph/graph.cc --- onnxruntime/core/graph/function.cc | 5 ++++- onnxruntime/core/graph/graph.cc | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/onnxruntime/core/graph/function.cc b/onnxruntime/core/graph/function.cc index a6fcada571..43a1638354 100644 --- a/onnxruntime/core/graph/function.cc +++ b/onnxruntime/core/graph/function.cc @@ -276,7 +276,10 @@ static void InitNestedModelLocalFunction(onnxruntime::Graph& graph, } ORT_CATCH(const std::exception& e) { LOGS(logger, WARNING) << "Function body initialization failed for Function '" - << onnx_function_proto.name() << "'. Error message " << e.what() + << onnx_function_proto.name() +#ifndef ORT_NO_EXCEPTIONS + << "'. Error message " << e.what() +#endif //ORT_NO_EXCEPTIONS << ". Execution will fail if ORT does not have a specialized kernel for this op"; // Return without using this function op's expansion. No need to fail just yet. // If ORT has a specialized kernel for this op then execution will proceed diff --git a/onnxruntime/core/graph/graph.cc b/onnxruntime/core/graph/graph.cc index 405a93bbb6..bf2f0d5b0f 100644 --- a/onnxruntime/core/graph/graph.cc +++ b/onnxruntime/core/graph/graph.cc @@ -2537,7 +2537,9 @@ void Graph::InitFunctionBodyForNode(Node& node) { ORT_CATCH(const std::exception& e) { LOGS(logger_, WARNING) << "Function body initialization failed for node '" << node.Name() << "' optype " << node.OpType() +#ifndef ORT_NO_EXCEPTIONS << ". Error message " << e.what() +#endif //ORT_NO_EXCEPTIONS << ". Execution will fail if ORT does not have a specialized kernel for this op"; // Return without using this function op's expansion. No need to fail just yet. // If ORT has a specialized kernel for this op then execution will proceed