From a28a0004b474fafda30d3ddee8c3b914d076121e Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Thu, 8 Feb 2024 14:51:35 +0400 Subject: [PATCH] Deprecated functions to operate with legacy port names (#22717) ### Details: - Such names are created as `operation_name.` which are not needed in OpenVINO 2.0, because it's legacy behavior. - Plugins should migrate to `ov::ISyncInferRequest::find_port` which can return index and port type (input or output) and work with this index (if required) instead of port **_legacy_** names. --- .../include/transformations/utils/utils.hpp | 10 ++++++++++ .../convert_matrix_nms_to_matrix_nms_ie.cpp | 4 ++++ .../op_conversions/convert_maxpool_downgrade.cpp | 2 ++ .../convert_multiclass_nms_to_multiclass_nms_ie.cpp | 4 ++++ .../op_conversions/convert_nms9_to_nms_ie_internal.cpp | 4 ++++ .../convert_nms_rotated_to_nms_ie_internal.cpp | 4 ++++ .../op_conversions/convert_nms_to_nms_ie_internal.cpp | 4 ++++ src/inference/src/dev/icompiled_model.cpp | 2 ++ src/inference/src/model_reader.cpp | 4 ++++ 9 files changed, 38 insertions(+) diff --git a/src/common/transformations/include/transformations/utils/utils.hpp b/src/common/transformations/include/transformations/utils/utils.hpp index b6f4c853c5cb3a..627323387c87ec 100644 --- a/src/common/transformations/include/transformations/utils/utils.hpp +++ b/src/common/transformations/include/transformations/utils/utils.hpp @@ -60,6 +60,7 @@ 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) { std::string out_name; OPENVINO_SUPPRESS_DEPRECATED_START @@ -77,16 +78,25 @@ inline std::string create_ie_output_name(const Output& output) { 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 } /** diff --git a/src/common/transformations/src/transformations/op_conversions/convert_matrix_nms_to_matrix_nms_ie.cpp b/src/common/transformations/src/transformations/op_conversions/convert_matrix_nms_to_matrix_nms_ie.cpp index 3eb1c89aa029f8..278022cab8098b 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_matrix_nms_to_matrix_nms_ie.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_matrix_nms_to_matrix_nms_ie.cpp @@ -46,13 +46,17 @@ ov::pass::ConvertMatrixNmsToMatrixNmsIE::ConvertMatrixNmsToMatrixNmsIE(bool forc if (nms->output(1).get_element_type() != output_1.get_element_type()) { output_1 = std::make_shared(output_1, nms->output(1).get_element_type()); + OPENVINO_SUPPRESS_DEPRECATED_START output_1.get_node_shared_ptr()->set_friendly_name(op::util::create_ie_output_name(nms->output(1))); + OPENVINO_SUPPRESS_DEPRECATED_END new_ops.emplace_back(output_1.get_node_shared_ptr()); } if (nms->output(2).get_element_type() != output_2.get_element_type()) { output_2 = std::make_shared(output_2, nms->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->output(2))); + OPENVINO_SUPPRESS_DEPRECATED_END new_ops.emplace_back(output_2.get_node_shared_ptr()); } 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 9b86701ee6777a..a6f756ac05acd5 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 @@ -37,7 +37,9 @@ 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)); diff --git a/src/common/transformations/src/transformations/op_conversions/convert_multiclass_nms_to_multiclass_nms_ie.cpp b/src/common/transformations/src/transformations/op_conversions/convert_multiclass_nms_to_multiclass_nms_ie.cpp index d81b328b444c7e..a1d05ce66d8e8b 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_multiclass_nms_to_multiclass_nms_ie.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_multiclass_nms_to_multiclass_nms_ie.cpp @@ -60,13 +60,17 @@ pass::ConvertMulticlassNmsToMulticlassNmsIE::ConvertMulticlassNmsToMulticlassNms if (nms->output(1).get_element_type() != output_1.get_element_type()) { output_1 = std::make_shared(output_1, nms->output(1).get_element_type()); + OPENVINO_SUPPRESS_DEPRECATED_START output_1.get_node_shared_ptr()->set_friendly_name(op::util::create_ie_output_name(nms->output(1))); + OPENVINO_SUPPRESS_DEPRECATED_END new_ops.emplace_back(output_1.get_node_shared_ptr()); } if (nms->output(2).get_element_type() != output_2.get_element_type()) { output_2 = std::make_shared(output_2, nms->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->output(2))); + OPENVINO_SUPPRESS_DEPRECATED_END new_ops.emplace_back(output_2.get_node_shared_ptr()); } 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 c8f998de8ec779..925907b4e0edc5 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,14 +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()); + 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()); } diff --git a/src/common/transformations/src/transformations/op_conversions/convert_nms_rotated_to_nms_ie_internal.cpp b/src/common/transformations/src/transformations/op_conversions/convert_nms_rotated_to_nms_ie_internal.cpp index b3040cda132852..f175caa31925aa 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_nms_rotated_to_nms_ie_internal.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_nms_rotated_to_nms_ie_internal.cpp @@ -87,14 +87,18 @@ ov::pass::ConvertNMSRotatedToNMSIEInternal::ConvertNMSRotatedToNMSIEInternal() { Output output_0 = nms_legacy->output(0); if (nms_rotated->output(0).get_element_type() != output_0.get_element_type()) { output_0 = std::make_shared(output_0, nms_rotated->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_rotated->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_rotated->output(2).get_element_type() != output_2.get_element_type()) { output_2 = std::make_shared(output_2, nms_rotated->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_rotated->output(2))); + OPENVINO_SUPPRESS_DEPRECATED_END new_ops.emplace_back(output_2.get_node_shared_ptr()); } diff --git a/src/common/transformations/src/transformations/op_conversions/convert_nms_to_nms_ie_internal.cpp b/src/common/transformations/src/transformations/op_conversions/convert_nms_to_nms_ie_internal.cpp index 2a7081bc8cf499..fd85f2403e6750 100644 --- a/src/common/transformations/src/transformations/op_conversions/convert_nms_to_nms_ie_internal.cpp +++ b/src/common/transformations/src/transformations/op_conversions/convert_nms_to_nms_ie_internal.cpp @@ -108,14 +108,18 @@ ov::pass::ConvertNMSToNMSIEInternal::ConvertNMSToNMSIEInternal() { Output output_0 = nms_legacy->output(0); if (nms_5->output(0).get_element_type() != output_0.get_element_type()) { output_0 = std::make_shared(output_0, nms_5->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_5->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_5->output(2).get_element_type() != output_2.get_element_type()) { output_2 = std::make_shared(output_2, nms_5->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_5->output(2))); + OPENVINO_SUPPRESS_DEPRECATED_END 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 80d2491697af43..d4e91b296074d4 100644 --- a/src/inference/src/dev/icompiled_model.cpp +++ b/src/inference/src/dev/icompiled_model.cpp @@ -77,7 +77,9 @@ 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 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 2b3110720a0dad..7a615955b80c1f 100644 --- a/src/inference/src/model_reader.cpp +++ b/src/inference/src/model_reader.cpp @@ -76,7 +76,11 @@ 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 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.",