@@ -85,7 +85,7 @@ BackendManager::BackendManager(SessionContext& session_context,
8585 subgraph_context_.subgraph_name = fused_node.Name ();
8686
8787 if (ModelHasSymbolicInputDims (subgraph)) {
88- subgraph_context_.has_dynamic_input_shape = true ;
88+ subgraph_context_.has_dynamic_input_shape = true ;
8989 }
9090
9191 ptr_stream_t model_stream;
@@ -171,9 +171,7 @@ BackendManager::BackendManager(SessionContext& session_context,
171171 exception_str.find (" intel_npu" ) != std::string::npos) {
172172 // Handle NPU device related errors
173173#ifndef NDEBUG
174- std::string suffix = session_context_.so_disable_cpu_ep_fallback ?
175- " \n Model failed to compile on NPU. Enable CPU fallback or try another device.\n " :
176- " \n Model needs to be recompiled\n " ;
174+ std::string suffix = session_context_.so_disable_cpu_ep_fallback ? " \n Model failed to compile on NPU. Enable CPU fallback or try another device.\n " : " \n Model needs to be recompiled\n " ;
177175 ORT_THROW (exception_str + suffix);
178176#else
179177 std::string error_message = " UNKNOWN NPU ERROR" ;
@@ -187,9 +185,7 @@ BackendManager::BackendManager(SessionContext& session_context,
187185 if (std::regex_search (exception_str, matches, error_code_pattern)) {
188186 error_code = matches[0 ];
189187 }
190- std::string suffix = session_context_.so_disable_cpu_ep_fallback ?
191- " \n Model failed to compile on NPU. Enable CPU fallback or try another device.\n " :
192- " \n Model needs to be recompiled\n " ;
188+ std::string suffix = session_context_.so_disable_cpu_ep_fallback ? " \n Model failed to compile on NPU. Enable CPU fallback or try another device.\n " : " \n Model needs to be recompiled\n " ;
193189 throw std::runtime_error (error_message + " , " + error_code + suffix);
194190#endif
195191 } else {
@@ -645,12 +641,11 @@ BackendManager::GetModelProtoFromFusedNode(const onnxruntime::Node& fused_node,
645641 const bool include_initializer_data_in_proto = true ;
646642#endif
647643
648-
649644 auto model = subgraph.CreateModel (logger);
650645 auto model_proto = model->ToProto ();
651646 model_proto->set_ir_version (ONNX_NAMESPACE::Version::IR_VERSION);
652- subgraph.ToProto (*model_proto->mutable_graph (), /* include_initializers*/ true ,
653- /* include_outer_scope_args*/ true , /* execution_order*/ 0 , /* include_initializer_data*/ include_initializer_data_in_proto);
647+ subgraph.ToProto (*model_proto->mutable_graph (), /* include_initializers*/ true ,
648+ /* include_outer_scope_args*/ true , /* execution_order*/ 0 , /* include_initializer_data*/ include_initializer_data_in_proto);
654649
655650 print_model_proto_duration ();
656651
@@ -684,9 +679,9 @@ BackendManager::GetModelProtoFromFusedNode(const onnxruntime::Node& fused_node,
684679 << " , data_type: " << src_init->data_type ()
685680 << " , raw_data size: " << src_init->raw_data ().size ();
686681 if (src_init->raw_data ().size () > 0 )
687- SetExternalDataFields (proto_init, src_init->raw_data ().data (), src_init->raw_data ().size ());
682+ SetExternalDataFields (proto_init, src_init->raw_data ().data (), src_init->raw_data ().size ());
688683 else
689- LOGS (logger, VERBOSE) << " Initializer has empty raw_data: skipping initializer '" << src_init->name () << " '..." ;
684+ LOGS (logger, VERBOSE) << " Initializer has empty raw_data: skipping initializer '" << src_init->name () << " '..." ;
690685 } else if (onnxruntime::utils::HasExternalDataInMemory (*src_init)) {
691686 auto it_ext = external_initializers_offset_and_length.find (name);
692687 if (it_ext == external_initializers_offset_and_length.end ()) {
@@ -889,7 +884,7 @@ void BackendManager::Compute(OrtKernelContext* context) {
889884 }
890885 } else {
891886 std::string exception_str = ex.what ();
892- if (session_context_.so_disable_cpu_ep_fallback ){
887+ if (session_context_.so_disable_cpu_ep_fallback ) {
893888 std::string error_message = " UNKNOWN NPU ERROR" ;
894889 std::string error_code = " code 0x0" ;
895890 std::regex error_message_pattern (R"( \bZE_\w*\b)" );
@@ -901,10 +896,9 @@ void BackendManager::Compute(OrtKernelContext* context) {
901896 if (std::regex_search (exception_str, matches, error_code_pattern)) {
902897 error_code = matches[0 ];
903898 }
904- std::string suffix = " \n Model failed to compile on NPU. Enable CPU fallback or try another device.\n " ;
899+ std::string suffix = " \n Model failed to compile on NPU. Enable CPU fallback or try another device.\n " ;
905900 throw std::runtime_error (error_message + " , " + error_code + suffix);
906- }
907- else {
901+ } else {
908902 ORT_THROW (exception_str);
909903 }
910904 }
0 commit comments