Skip to content

Commit 6d41065

Browse files
authored
Run lintrunner and fix formatting issues (#836)
1 parent c7204c5 commit 6d41065

File tree

4 files changed

+16
-22
lines changed

4 files changed

+16
-22
lines changed

onnxruntime/core/providers/openvino/backend_manager.cc

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
"\nModel failed to compile on NPU. Enable CPU fallback or try another device.\n" :
176-
"\nModel needs to be recompiled\n";
174+
std::string suffix = session_context_.so_disable_cpu_ep_fallback ? "\nModel failed to compile on NPU. Enable CPU fallback or try another device.\n" : "\nModel 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-
"\nModel failed to compile on NPU. Enable CPU fallback or try another device.\n" :
192-
"\nModel needs to be recompiled\n";
188+
std::string suffix = session_context_.so_disable_cpu_ep_fallback ? "\nModel failed to compile on NPU. Enable CPU fallback or try another device.\n" : "\nModel 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 = "\nModel failed to compile on NPU. Enable CPU fallback or try another device.\n" ;
899+
std::string suffix = "\nModel 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
}

onnxruntime/core/providers/openvino/ov_interface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
// Usage: #if OPENVINO_VERSION_AT_LEAST(2025, 3)
2626
// Falls back to 0 if OPENVINO_VERSION_MAJOR/MINOR are not defined.
2727
#if defined(OPENVINO_VERSION_MAJOR) && defined(OPENVINO_VERSION_MINOR)
28-
#define OPENVINO_VERSION_AT_LEAST(major, minor) \
29-
((OPENVINO_VERSION_MAJOR > (major)) || \
28+
#define OPENVINO_VERSION_AT_LEAST(major, minor) \
29+
((OPENVINO_VERSION_MAJOR > (major)) || \
3030
(OPENVINO_VERSION_MAJOR == (major) && OPENVINO_VERSION_MINOR >= (minor)))
3131
#else
3232
#define OPENVINO_VERSION_AT_LEAST(major, minor) 0

onnxruntime/test/providers/openvino/openvino_ep_ext_init.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ auto ProbeDevice(const std::string& device) {
5252
}
5353
return is_present[device];
5454
}
55-
} // namespace detail
55+
} // namespace
5656

5757
namespace onnxruntime {
5858
namespace test {
@@ -62,7 +62,7 @@ TEST_P(OVEP_ExtInit_Tests, DISABLED_ModelFromExtInit) {
6262
const auto& device = GetParam();
6363
if (!ProbeDevice(device))
6464
GTEST_SKIP() << device + " is not available on this machine";
65-
65+
6666
// Model and weights file paths
6767
const std::string model_path = "ovep_ext_init_test.onnx";
6868
const std::string weights_path = "ovep_ext_init_test.onnx.data";
@@ -174,7 +174,7 @@ TEST_P(OVEP_ExtInit_Tests, DISABLED_ModelFromExtInit) {
174174
Ort::SessionOptions session_options;
175175
session_options.AddConfigEntry(kOrtSessionOptionsDisableCPUEPFallback, "1");
176176
session_options.SetIntraOpNumThreads(1);
177-
std::unordered_map<std::string, std::string> ov_options = { {"device_type", device } };
177+
std::unordered_map<std::string, std::string> ov_options = {{"device_type", device}};
178178
session_options.AppendExecutionProvider_OpenVINO_V2(ov_options);
179179
session_options.AddExternalInitializersFromFilesInMemory(names_path, buffers, buffer_sizes);
180180

onnxruntime/test/unittest_util/checkers.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ struct TensorCheck<uint16_t> {
383383
void operator()(const Tensor& expected,
384384
const Tensor& actual,
385385
const ValidateOutputParams& params,
386-
const std::string& ) const {
386+
const std::string&) const {
387387
const bool has_abs_err = params.absolute_error.has_value();
388388
const bool has_rel_err = params.relative_error.has_value();
389389

0 commit comments

Comments
 (0)