From 3182a7bde042e4211ee4d779ce411763ca00d51e Mon Sep 17 00:00:00 2001 From: Andrii Staikov Date: Mon, 30 Sep 2024 11:10:55 +0200 Subject: [PATCH 1/8] [TRANSFORMATIONS] Remove usages of legacy names in transformations Remove usages of deprecated legacy names in transformations. - Tickets: * CVS-153733 --- .../op_conversions/convert_maxpool_downgrade.cpp | 4 ---- .../op_conversions/convert_nms9_to_nms_ie_internal.cpp | 6 ------ 2 files changed, 10 deletions(-) diff --git a/src/common/transformations/src/transformations/op_conversions/convert_maxpool_downgrade.cpp b/src/common/transformations/src/transformations/op_conversions/convert_maxpool_downgrade.cpp index 0e0865b3845f48..f53ca367fc6050 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_maxpool_downgrade.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_maxpool_downgrade.cpp @@ -48,10 +48,6 @@ ov::pass::ConvertMaxPool8ToMaxPool1::ConvertMaxPool8ToMaxPool1() { maxpool_v8_node->get_rounding_type(), maxpool_v8_node->get_auto_pad()); - OPENVINO_SUPPRESS_DEPRECATED_START - auto out_name = ov::op::util::create_ie_output_name(maxpool_v8_node->output(0)); - OPENVINO_SUPPRESS_DEPRECATED_END - maxpool_v1_node->set_friendly_name(maxpool_v8_node->get_friendly_name()); maxpool_v8_node->output(0).replace(maxpool_v1_node->output(0)); ov::copy_runtime_info(maxpool_v8_node, maxpool_v1_node); diff --git a/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp b/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp index c4c31c1fc230bd..5ad8f42c87ed4e 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp @@ -109,18 +109,12 @@ ov::pass::ConvertNMS9ToNMSIEInternal::ConvertNMS9ToNMSIEInternal() { Output output_0 = nms_legacy->output(0); if (nms_9->output(0).get_element_type() != output_0.get_element_type()) { output_0 = std::make_shared(output_0, nms_9->output(0).get_element_type()); - OPENVINO_SUPPRESS_DEPRECATED_START - output_0.get_node_shared_ptr()->set_friendly_name(op::util::create_ie_output_name(nms_9->output(0))); - OPENVINO_SUPPRESS_DEPRECATED_END new_ops.emplace_back(output_0.get_node_shared_ptr()); } Output output_2 = nms_legacy->output(2); if (nms_9->output(2).get_element_type() != output_2.get_element_type()) { output_2 = std::make_shared(output_2, nms_9->output(2).get_element_type()); - OPENVINO_SUPPRESS_DEPRECATED_START - output_2.get_node_shared_ptr()->set_friendly_name(op::util::create_ie_output_name(nms_9->output(2))); - OPENVINO_SUPPRESS_DEPRECATED_END new_ops.emplace_back(output_2.get_node_shared_ptr()); } From c04fff4c6eb2b272d79436bd7c38421bfd531b95 Mon Sep 17 00:00:00 2001 From: Andrii Staikov Date: Mon, 30 Sep 2024 11:41:38 +0200 Subject: [PATCH 2/8] handle the remaining files --- .../include/transformations/utils/utils.hpp | 31 ------------------- src/inference/src/dev/icompiled_model.cpp | 26 ++++++++++++++-- src/inference/src/model_reader.cpp | 28 ++++++++++++++--- 3 files changed, 46 insertions(+), 39 deletions(-) diff --git a/src/common/transformations/include/transformations/utils/utils.hpp b/src/common/transformations/include/transformations/utils/utils.hpp index 6bcc50e29b3733..5543dd234ff2b3 100644 --- a/src/common/transformations/include/transformations/utils/utils.hpp +++ b/src/common/transformations/include/transformations/utils/utils.hpp @@ -62,37 +62,6 @@ inline bool has_decompression_converts(const std::shared_ptr& f return false; } -OPENVINO_DEPRECATED("Plugins should use ov::ISyncInferRequest::find_port") -inline std::string create_ie_output_name(const Output& output) { - const auto& prev_layer = output.get_node_shared_ptr(); - auto out_name = prev_layer->get_friendly_name(); - if (prev_layer->get_output_size() != 1) { - out_name += "." + std::to_string(output.get_index()); - } - return out_name; -} - -OPENVINO_DEPRECATED("Plugins should use ov::ISyncInferRequest::find_port") -inline std::string create_ie_output_name(const Output& output) { - OPENVINO_SUPPRESS_DEPRECATED_START - return create_ie_output_name(ov::Output(output.get_node(), output.get_index())); - OPENVINO_SUPPRESS_DEPRECATED_END -} - -OPENVINO_DEPRECATED("Plugins should use ov::ISyncInferRequest::find_port") -inline std::string get_ie_output_name(const Output& output) { - OPENVINO_SUPPRESS_DEPRECATED_START - return create_ie_output_name(output); - OPENVINO_SUPPRESS_DEPRECATED_END -} - -OPENVINO_DEPRECATED("Plugins should use ov::ISyncInferRequest::find_port") -inline std::string get_ie_output_name(const Output& output) { - OPENVINO_SUPPRESS_DEPRECATED_START - return get_ie_output_name(ov::Output(output.get_node(), output.get_index())); - OPENVINO_SUPPRESS_DEPRECATED_END -} - /** * \brief Convert epsilon value from double to float type. * diff --git a/src/inference/src/dev/icompiled_model.cpp b/src/inference/src/dev/icompiled_model.cpp index b1cbedac1632ab..844ffbac00af0d 100644 --- a/src/inference/src/dev/icompiled_model.cpp +++ b/src/inference/src/dev/icompiled_model.cpp @@ -10,6 +10,28 @@ #include "openvino/runtime/properties.hpp" #include "transformations/utils/utils.hpp" +// These deperecated functions are moved here as static to facilitate for IR v10 +static inline std::string create_ie_output_name(const ov::Output& output) { + std::string out_name; + OPENVINO_SUPPRESS_DEPRECATED_START + auto tensor_name = ov::descriptor::get_ov_tensor_legacy_name(output.get_tensor()); + OPENVINO_SUPPRESS_DEPRECATED_END + if (!tensor_name.empty()) { + out_name = std::move(tensor_name); + } else { + const auto& prev_layer = output.get_node_shared_ptr(); + out_name = prev_layer->get_friendly_name(); + if (prev_layer->get_output_size() != 1) { + out_name += "." + std::to_string(output.get_index()); + } + } + return out_name; +} + +static inline std::string create_ie_output_name(const ov::Output& output) { + return create_ie_output_name(ov::Output(output.get_node(), output.get_index())); +} + ov::ICompiledModel::ICompiledModel(const std::shared_ptr& model, const std::shared_ptr& plugin, const std::shared_ptr& task_executor, @@ -77,9 +99,7 @@ ov::ICompiledModel::ICompiledModel(const std::shared_ptr& model for (const auto& result : model->get_results()) { auto fake_param = std::make_shared(result->get_output_element_type(0), result->get_output_partial_shape(0)); - OPENVINO_SUPPRESS_DEPRECATED_START - const std::string res_name = ov::op::util::create_ie_output_name(result->input_value(0)); - OPENVINO_SUPPRESS_DEPRECATED_END + const std::string res_name = create_ie_output_name(result->input_value(0)); fake_param->set_friendly_name(res_name); fake_param->set_element_type(result->get_element_type()); fake_param->validate_and_infer_types(); diff --git a/src/inference/src/model_reader.cpp b/src/inference/src/model_reader.cpp index aaf620ea0f803a..b545253ecc6ade 100644 --- a/src/inference/src/model_reader.cpp +++ b/src/inference/src/model_reader.cpp @@ -14,6 +14,28 @@ #include "transformations/utils/utils.hpp" namespace { +// These deperecated functions are moved here as static to facilitate for IR v10 +static inline std::string create_ie_output_name(const ov::Output& output) { + std::string out_name; + OPENVINO_SUPPRESS_DEPRECATED_START + auto tensor_name = ov::descriptor::get_ov_tensor_legacy_name(output.get_tensor()); + OPENVINO_SUPPRESS_DEPRECATED_END + if (!tensor_name.empty()) { + out_name = std::move(tensor_name); + } else { + const auto& prev_layer = output.get_node_shared_ptr(); + out_name = prev_layer->get_friendly_name(); + if (prev_layer->get_output_size() != 1) { + out_name += "." + std::to_string(output.get_index()); + } + } + return out_name; +} + +static inline std::string create_ie_output_name(const ov::Output& output) { + return create_ie_output_name(ov::Output(output.get_node(), output.get_index())); +} + ov::element::Type to_legacy_type(const ov::element::Type& legacy_type, bool input) { if (input) { return legacy_type == ov::element::f16 ? ov::element::f32 : legacy_type; @@ -76,11 +98,7 @@ void update_v10_model(std::shared_ptr& model, bool frontendMode = fal // we need to add operation names as tensor names for inputs and outputs { for (const auto& result : model->get_results()) { - OPENVINO_SUPPRESS_DEPRECATED_START - // Note, upon removal of 'create_ie_output_name', just move it to this file as a local function - // we still need to add operation names as tensor names for outputs for IR v10 - auto res_name = ov::op::util::create_ie_output_name(result->input_value(0)); - OPENVINO_SUPPRESS_DEPRECATED_END + auto res_name = create_ie_output_name(result->input_value(0)); OPENVINO_ASSERT(leaf_names.find(res_name) == leaf_names.end() || result->output(0).get_names().find(res_name) != result->output(0).get_names().end(), "Model operation names have collisions with tensor names.", From fc1141772655c6ae2fcfb8120647c088355f3281 Mon Sep 17 00:00:00 2001 From: Andrii Staikov Date: Tue, 12 Nov 2024 12:54:05 +0100 Subject: [PATCH 3/8] update create_ie_output_name() --- src/inference/src/dev/icompiled_model.cpp | 16 ++++------------ src/inference/src/model_reader.cpp | 16 ++++------------ 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/inference/src/dev/icompiled_model.cpp b/src/inference/src/dev/icompiled_model.cpp index 844ffbac00af0d..6ddcc247265e1f 100644 --- a/src/inference/src/dev/icompiled_model.cpp +++ b/src/inference/src/dev/icompiled_model.cpp @@ -12,18 +12,10 @@ // These deperecated functions are moved here as static to facilitate for IR v10 static inline std::string create_ie_output_name(const ov::Output& output) { - std::string out_name; - OPENVINO_SUPPRESS_DEPRECATED_START - auto tensor_name = ov::descriptor::get_ov_tensor_legacy_name(output.get_tensor()); - OPENVINO_SUPPRESS_DEPRECATED_END - if (!tensor_name.empty()) { - out_name = std::move(tensor_name); - } else { - const auto& prev_layer = output.get_node_shared_ptr(); - out_name = prev_layer->get_friendly_name(); - if (prev_layer->get_output_size() != 1) { - out_name += "." + std::to_string(output.get_index()); - } + const auto& prev_layer = output.get_node_shared_ptr(); + auto out_name = prev_layer->get_friendly_name(); + if (prev_layer->get_output_size() != 1) { + out_name += "." + std::to_string(output.get_index()); } return out_name; } diff --git a/src/inference/src/model_reader.cpp b/src/inference/src/model_reader.cpp index b545253ecc6ade..60050072d3fa31 100644 --- a/src/inference/src/model_reader.cpp +++ b/src/inference/src/model_reader.cpp @@ -16,18 +16,10 @@ namespace { // These deperecated functions are moved here as static to facilitate for IR v10 static inline std::string create_ie_output_name(const ov::Output& output) { - std::string out_name; - OPENVINO_SUPPRESS_DEPRECATED_START - auto tensor_name = ov::descriptor::get_ov_tensor_legacy_name(output.get_tensor()); - OPENVINO_SUPPRESS_DEPRECATED_END - if (!tensor_name.empty()) { - out_name = std::move(tensor_name); - } else { - const auto& prev_layer = output.get_node_shared_ptr(); - out_name = prev_layer->get_friendly_name(); - if (prev_layer->get_output_size() != 1) { - out_name += "." + std::to_string(output.get_index()); - } + const auto& prev_layer = output.get_node_shared_ptr(); + auto out_name = prev_layer->get_friendly_name(); + if (prev_layer->get_output_size() != 1) { + out_name += "." + std::to_string(output.get_index()); } return out_name; } From 7b998157a302d1ab791aad1bdc2b6827aca5392e Mon Sep 17 00:00:00 2001 From: Andrii Staikov Date: Tue, 12 Nov 2024 13:38:59 +0100 Subject: [PATCH 4/8] use friendly name --- .../op_conversions/convert_nms9_to_nms_ie_internal.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp b/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp index 5ad8f42c87ed4e..4f0feb5a23e1c5 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp @@ -109,12 +109,16 @@ ov::pass::ConvertNMS9ToNMSIEInternal::ConvertNMS9ToNMSIEInternal() { Output output_0 = nms_legacy->output(0); if (nms_9->output(0).get_element_type() != output_0.get_element_type()) { output_0 = std::make_shared(output_0, nms_9->output(0).get_element_type()); + output_0.get_node_shared_ptr()->set_friendly_name(nms_9->output(0).get_node_shared_ptr()->get_friendly_name() + + "." + std::to_string(output_0.get_index())); new_ops.emplace_back(output_0.get_node_shared_ptr()); } Output output_2 = nms_legacy->output(2); if (nms_9->output(2).get_element_type() != output_2.get_element_type()) { output_2 = std::make_shared(output_2, nms_9->output(2).get_element_type()); + output_2.get_node_shared_ptr()->set_friendly_name(nms_9->output(2).get_node_shared_ptr()->get_friendly_name() + + "." + std::to_string(output_2.get_index())); new_ops.emplace_back(output_2.get_node_shared_ptr()); } From bee461f04e5fd7256d94657199c8ad1be74b8a7d Mon Sep 17 00:00:00 2001 From: Andrii Staikov Date: Tue, 12 Nov 2024 13:54:23 +0100 Subject: [PATCH 5/8] code style --- .../op_conversions/convert_nms9_to_nms_ie_internal.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp b/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp index 4f0feb5a23e1c5..3e3932a2e7f201 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp @@ -109,16 +109,18 @@ ov::pass::ConvertNMS9ToNMSIEInternal::ConvertNMS9ToNMSIEInternal() { Output output_0 = nms_legacy->output(0); if (nms_9->output(0).get_element_type() != output_0.get_element_type()) { output_0 = std::make_shared(output_0, nms_9->output(0).get_element_type()); - output_0.get_node_shared_ptr()->set_friendly_name(nms_9->output(0).get_node_shared_ptr()->get_friendly_name() - + "." + std::to_string(output_0.get_index())); + output_0.get_node_shared_ptr()->set_friendly_name( + nms_9->output(0).get_node_shared_ptr()->get_friendly_name() + "." + + std::to_string(output_0.get_index())); new_ops.emplace_back(output_0.get_node_shared_ptr()); } Output output_2 = nms_legacy->output(2); if (nms_9->output(2).get_element_type() != output_2.get_element_type()) { output_2 = std::make_shared(output_2, nms_9->output(2).get_element_type()); - output_2.get_node_shared_ptr()->set_friendly_name(nms_9->output(2).get_node_shared_ptr()->get_friendly_name() - + "." + std::to_string(output_2.get_index())); + output_2.get_node_shared_ptr()->set_friendly_name( + nms_9->output(2).get_node_shared_ptr()->get_friendly_name() + "." + + std::to_string(output_2.get_index())); new_ops.emplace_back(output_2.get_node_shared_ptr()); } From fa2b46f2423c9953940f0fa40521943cc9705015 Mon Sep 17 00:00:00 2001 From: Andrii Staikov Date: Tue, 12 Nov 2024 19:43:44 +0100 Subject: [PATCH 6/8] removed functions --- .../convert_nms9_to_nms_ie_internal.cpp | 6 ++++-- src/inference/src/dev/icompiled_model.cpp | 20 +++++-------------- src/inference/src/model_reader.cpp | 19 ++++-------------- 3 files changed, 13 insertions(+), 32 deletions(-) diff --git a/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp b/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp index 3e3932a2e7f201..da3bf6e4dc94a6 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp @@ -110,7 +110,8 @@ ov::pass::ConvertNMS9ToNMSIEInternal::ConvertNMS9ToNMSIEInternal() { if (nms_9->output(0).get_element_type() != output_0.get_element_type()) { output_0 = std::make_shared(output_0, nms_9->output(0).get_element_type()); output_0.get_node_shared_ptr()->set_friendly_name( - nms_9->output(0).get_node_shared_ptr()->get_friendly_name() + "." + + nms_9->output(0).get_node_shared_ptr()->get_friendly_name() + + std::string(nms_9->output(0).get_node_shared_ptr()->get_output_size() != 1 ? "." : "") + std::to_string(output_0.get_index())); new_ops.emplace_back(output_0.get_node_shared_ptr()); } @@ -119,7 +120,8 @@ ov::pass::ConvertNMS9ToNMSIEInternal::ConvertNMS9ToNMSIEInternal() { if (nms_9->output(2).get_element_type() != output_2.get_element_type()) { output_2 = std::make_shared(output_2, nms_9->output(2).get_element_type()); output_2.get_node_shared_ptr()->set_friendly_name( - nms_9->output(2).get_node_shared_ptr()->get_friendly_name() + "." + + nms_9->output(2).get_node_shared_ptr()->get_friendly_name() + + std::string(nms_9->output(2).get_node_shared_ptr()->get_output_size() != 1 ? "." : "") + std::to_string(output_2.get_index())); new_ops.emplace_back(output_2.get_node_shared_ptr()); } diff --git a/src/inference/src/dev/icompiled_model.cpp b/src/inference/src/dev/icompiled_model.cpp index 6ddcc247265e1f..9fb29df0c100d4 100644 --- a/src/inference/src/dev/icompiled_model.cpp +++ b/src/inference/src/dev/icompiled_model.cpp @@ -10,20 +10,6 @@ #include "openvino/runtime/properties.hpp" #include "transformations/utils/utils.hpp" -// These deperecated functions are moved here as static to facilitate for IR v10 -static inline std::string create_ie_output_name(const ov::Output& output) { - const auto& prev_layer = output.get_node_shared_ptr(); - auto out_name = prev_layer->get_friendly_name(); - if (prev_layer->get_output_size() != 1) { - out_name += "." + std::to_string(output.get_index()); - } - return out_name; -} - -static inline std::string create_ie_output_name(const ov::Output& output) { - return create_ie_output_name(ov::Output(output.get_node(), output.get_index())); -} - ov::ICompiledModel::ICompiledModel(const std::shared_ptr& model, const std::shared_ptr& plugin, const std::shared_ptr& task_executor, @@ -91,7 +77,11 @@ ov::ICompiledModel::ICompiledModel(const std::shared_ptr& model for (const auto& result : model->get_results()) { auto fake_param = std::make_shared(result->get_output_element_type(0), result->get_output_partial_shape(0)); - const std::string res_name = create_ie_output_name(result->input_value(0)); + auto prev_layer = result->input_value(0).get_node_shared_ptr(); + const std::string res_name = prev_layer->get_friendly_name() + + std::string(prev_layer->get_output_size() != 1 ? "." : "") + + std::to_string(result->input_value(0).get_index()); + fake_param->set_friendly_name(res_name); fake_param->set_element_type(result->get_element_type()); fake_param->validate_and_infer_types(); diff --git a/src/inference/src/model_reader.cpp b/src/inference/src/model_reader.cpp index 60050072d3fa31..cf3148de4fbb6a 100644 --- a/src/inference/src/model_reader.cpp +++ b/src/inference/src/model_reader.cpp @@ -14,20 +14,6 @@ #include "transformations/utils/utils.hpp" namespace { -// These deperecated functions are moved here as static to facilitate for IR v10 -static inline std::string create_ie_output_name(const ov::Output& output) { - const auto& prev_layer = output.get_node_shared_ptr(); - auto out_name = prev_layer->get_friendly_name(); - if (prev_layer->get_output_size() != 1) { - out_name += "." + std::to_string(output.get_index()); - } - return out_name; -} - -static inline std::string create_ie_output_name(const ov::Output& output) { - return create_ie_output_name(ov::Output(output.get_node(), output.get_index())); -} - ov::element::Type to_legacy_type(const ov::element::Type& legacy_type, bool input) { if (input) { return legacy_type == ov::element::f16 ? ov::element::f32 : legacy_type; @@ -90,7 +76,10 @@ void update_v10_model(std::shared_ptr& model, bool frontendMode = fal // we need to add operation names as tensor names for inputs and outputs { for (const auto& result : model->get_results()) { - auto res_name = create_ie_output_name(result->input_value(0)); + auto prev_layer = result->input_value(0).get_node_shared_ptr(); + const std::string res_name = prev_layer->get_friendly_name() + + std::string(prev_layer->get_output_size() != 1 ? "." : "") + + std::to_string(result->input_value(0).get_index()); OPENVINO_ASSERT(leaf_names.find(res_name) == leaf_names.end() || result->output(0).get_names().find(res_name) != result->output(0).get_names().end(), "Model operation names have collisions with tensor names.", From d64f911a6b5ccbba974d51933f4123b97a2dcc11 Mon Sep 17 00:00:00 2001 From: Andrii Staikov Date: Fri, 15 Nov 2024 11:36:42 +0100 Subject: [PATCH 7/8] fix tests --- .../op_conversions/convert_nms9_to_nms_ie_internal.cpp | 6 ++---- src/inference/src/dev/icompiled_model.cpp | 3 +-- src/inference/src/model_reader.cpp | 3 +-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp b/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp index da3bf6e4dc94a6..010355823386a5 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp @@ -111,8 +111,7 @@ ov::pass::ConvertNMS9ToNMSIEInternal::ConvertNMS9ToNMSIEInternal() { output_0 = std::make_shared(output_0, nms_9->output(0).get_element_type()); output_0.get_node_shared_ptr()->set_friendly_name( nms_9->output(0).get_node_shared_ptr()->get_friendly_name() + - std::string(nms_9->output(0).get_node_shared_ptr()->get_output_size() != 1 ? "." : "") + - std::to_string(output_0.get_index())); + std::string(nms_9->output(0).get_node_shared_ptr()->get_output_size() != 1 ? "." + std::to_string(output_0.get_index()) : "")); new_ops.emplace_back(output_0.get_node_shared_ptr()); } @@ -121,8 +120,7 @@ ov::pass::ConvertNMS9ToNMSIEInternal::ConvertNMS9ToNMSIEInternal() { output_2 = std::make_shared(output_2, nms_9->output(2).get_element_type()); output_2.get_node_shared_ptr()->set_friendly_name( nms_9->output(2).get_node_shared_ptr()->get_friendly_name() + - std::string(nms_9->output(2).get_node_shared_ptr()->get_output_size() != 1 ? "." : "") + - std::to_string(output_2.get_index())); + std::string(nms_9->output(2).get_node_shared_ptr()->get_output_size() != 1 ? "." + std::to_string(output_2.get_index()) : "")); new_ops.emplace_back(output_2.get_node_shared_ptr()); } diff --git a/src/inference/src/dev/icompiled_model.cpp b/src/inference/src/dev/icompiled_model.cpp index 9fb29df0c100d4..89369c02dcddff 100644 --- a/src/inference/src/dev/icompiled_model.cpp +++ b/src/inference/src/dev/icompiled_model.cpp @@ -79,8 +79,7 @@ ov::ICompiledModel::ICompiledModel(const std::shared_ptr& model result->get_output_partial_shape(0)); auto prev_layer = result->input_value(0).get_node_shared_ptr(); const std::string res_name = prev_layer->get_friendly_name() + - std::string(prev_layer->get_output_size() != 1 ? "." : "") + - std::to_string(result->input_value(0).get_index()); + std::string(prev_layer->get_output_size() != 1 ? "." + std::to_string(result->input_value(0).get_index()) : ""); fake_param->set_friendly_name(res_name); fake_param->set_element_type(result->get_element_type()); diff --git a/src/inference/src/model_reader.cpp b/src/inference/src/model_reader.cpp index cf3148de4fbb6a..09c2098c618ad4 100644 --- a/src/inference/src/model_reader.cpp +++ b/src/inference/src/model_reader.cpp @@ -78,8 +78,7 @@ void update_v10_model(std::shared_ptr& model, bool frontendMode = fal for (const auto& result : model->get_results()) { auto prev_layer = result->input_value(0).get_node_shared_ptr(); const std::string res_name = prev_layer->get_friendly_name() + - std::string(prev_layer->get_output_size() != 1 ? "." : "") + - std::to_string(result->input_value(0).get_index()); + std::string(prev_layer->get_output_size() != 1 ? "." + std::to_string(result->input_value(0).get_index()) : ""); OPENVINO_ASSERT(leaf_names.find(res_name) == leaf_names.end() || result->output(0).get_names().find(res_name) != result->output(0).get_names().end(), "Model operation names have collisions with tensor names.", From a735a270143bae5d92381cfd4c0de5c192ee827a Mon Sep 17 00:00:00 2001 From: Andrii Staikov Date: Fri, 15 Nov 2024 11:46:58 +0100 Subject: [PATCH 8/8] code style --- .../op_conversions/convert_nms9_to_nms_ie_internal.cpp | 8 ++++++-- src/inference/src/dev/icompiled_model.cpp | 4 +++- src/inference/src/model_reader.cpp | 4 +++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp b/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp index 010355823386a5..4c235889b1a45d 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_nms9_to_nms_ie_internal.cpp @@ -111,7 +111,9 @@ ov::pass::ConvertNMS9ToNMSIEInternal::ConvertNMS9ToNMSIEInternal() { output_0 = std::make_shared(output_0, nms_9->output(0).get_element_type()); output_0.get_node_shared_ptr()->set_friendly_name( nms_9->output(0).get_node_shared_ptr()->get_friendly_name() + - std::string(nms_9->output(0).get_node_shared_ptr()->get_output_size() != 1 ? "." + std::to_string(output_0.get_index()) : "")); + std::string(nms_9->output(0).get_node_shared_ptr()->get_output_size() != 1 + ? "." + std::to_string(output_0.get_index()) + : "")); new_ops.emplace_back(output_0.get_node_shared_ptr()); } @@ -120,7 +122,9 @@ ov::pass::ConvertNMS9ToNMSIEInternal::ConvertNMS9ToNMSIEInternal() { output_2 = std::make_shared(output_2, nms_9->output(2).get_element_type()); output_2.get_node_shared_ptr()->set_friendly_name( nms_9->output(2).get_node_shared_ptr()->get_friendly_name() + - std::string(nms_9->output(2).get_node_shared_ptr()->get_output_size() != 1 ? "." + std::to_string(output_2.get_index()) : "")); + std::string(nms_9->output(2).get_node_shared_ptr()->get_output_size() != 1 + ? "." + std::to_string(output_2.get_index()) + : "")); new_ops.emplace_back(output_2.get_node_shared_ptr()); } diff --git a/src/inference/src/dev/icompiled_model.cpp b/src/inference/src/dev/icompiled_model.cpp index 89369c02dcddff..25d3a5c28fadeb 100644 --- a/src/inference/src/dev/icompiled_model.cpp +++ b/src/inference/src/dev/icompiled_model.cpp @@ -79,7 +79,9 @@ ov::ICompiledModel::ICompiledModel(const std::shared_ptr& model result->get_output_partial_shape(0)); auto prev_layer = result->input_value(0).get_node_shared_ptr(); const std::string res_name = prev_layer->get_friendly_name() + - std::string(prev_layer->get_output_size() != 1 ? "." + std::to_string(result->input_value(0).get_index()) : ""); + std::string(prev_layer->get_output_size() != 1 + ? "." + std::to_string(result->input_value(0).get_index()) + : ""); fake_param->set_friendly_name(res_name); fake_param->set_element_type(result->get_element_type()); diff --git a/src/inference/src/model_reader.cpp b/src/inference/src/model_reader.cpp index 09c2098c618ad4..3b771f2100b07d 100644 --- a/src/inference/src/model_reader.cpp +++ b/src/inference/src/model_reader.cpp @@ -78,7 +78,9 @@ void update_v10_model(std::shared_ptr& model, bool frontendMode = fal for (const auto& result : model->get_results()) { auto prev_layer = result->input_value(0).get_node_shared_ptr(); const std::string res_name = prev_layer->get_friendly_name() + - std::string(prev_layer->get_output_size() != 1 ? "." + std::to_string(result->input_value(0).get_index()) : ""); + std::string(prev_layer->get_output_size() != 1 + ? "." + std::to_string(result->input_value(0).get_index()) + : ""); OPENVINO_ASSERT(leaf_names.find(res_name) == leaf_names.end() || result->output(0).get_names().find(res_name) != result->output(0).get_names().end(), "Model operation names have collisions with tensor names.",