From 98497331aca5b81537caedee22abeffc4102d301 Mon Sep 17 00:00:00 2001 From: Andrii Staikov Date: Wed, 20 Mar 2024 16:10:28 +0330 Subject: [PATCH 1/3] [TRANSFORMATIONS] Remove use of legacy names from transformations API function create_ie_output_name() and get_ie_output_name() are deprecated in a28a0004b474 ("Deprecated functions to operate with legacy port names (#22717)") Remove usages of create_ie_output_name() in Transformations Ticket: CVS-132087 Signed-off-by: Andrii Staikov andrii.staikov@intel.com --- .../src/transformations/control_flow/unroll_if.cpp | 6 ------ .../control_flow/unroll_tensor_iterator.cpp | 4 ---- .../convert_matrix_nms_to_matrix_nms_ie.cpp | 6 ------ .../op_conversions/convert_maxpool_downgrade.cpp | 8 -------- .../convert_multiclass_nms_to_multiclass_nms_ie.cpp | 6 ------ .../op_conversions/convert_nms9_to_nms_ie_internal.cpp | 6 ------ .../convert_nms_rotated_to_nms_ie_internal.cpp | 6 ------ .../op_conversions/convert_nms_to_nms_ie_internal.cpp | 6 ------ 8 files changed, 48 deletions(-) diff --git a/src/common/transformations/src/transformations/control_flow/unroll_if.cpp b/src/common/transformations/src/transformations/control_flow/unroll_if.cpp index 18b95538bcbe3f..361feb1108c975 100644 --- a/src/common/transformations/src/transformations/control_flow/unroll_if.cpp +++ b/src/common/transformations/src/transformations/control_flow/unroll_if.cpp @@ -56,12 +56,6 @@ bool ov::pass::UnrollIf::run_on_model(const std::shared_ptr& f) { std::shared_ptr result = body->get_results()[output_desc->m_body_value_index]; const auto& in_value = result->input_value(0); - // set output name to Tensor to store it for openvino to cnn conversion - OPENVINO_SUPPRESS_DEPRECATED_START - ov::descriptor::set_ov_tensor_legacy_name( - in_value.get_tensor(), - op::util::create_ie_output_name(if_node->output(output_desc->m_output_index))); - OPENVINO_SUPPRESS_DEPRECATED_END for (const auto& input : if_node->output(output_desc->m_output_index).get_target_inputs()) { input.replace_source_output(result->get_input_source_output(0)); } diff --git a/src/common/transformations/src/transformations/control_flow/unroll_tensor_iterator.cpp b/src/common/transformations/src/transformations/control_flow/unroll_tensor_iterator.cpp index e807115c94ff3f..6efbf51e1e3914 100644 --- a/src/common/transformations/src/transformations/control_flow/unroll_tensor_iterator.cpp +++ b/src/common/transformations/src/transformations/control_flow/unroll_tensor_iterator.cpp @@ -123,10 +123,6 @@ bool ov::pass::UnrollTensorIterator::run_on_model(const std::shared_ptr& target_inp) { return ov::as_type(target_inp.get_node()) != nullptr; })) { - OPENVINO_SUPPRESS_DEPRECATED_START - ov::descriptor::set_ov_tensor_legacy_name(insert_to.get_tensor(), - ov::op::util::create_ie_output_name(ti_output)); - 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 e04a25e2373b2e..c416ca6da27e66 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,17 +46,11 @@ 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 fe390af3cd8f02..38ed429b68f39e 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,19 +37,11 @@ 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); maxpool_v8_node->clear_control_dependencies(); - OPENVINO_SUPPRESS_DEPRECATED_START - ov::descriptor::set_ov_tensor_legacy_name(maxpool_v1_node->output(0).get_tensor(), out_name); - OPENVINO_SUPPRESS_DEPRECATED_END - return true; }; 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 730788b2c4c8f4..8938333d69be73 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,17 +60,11 @@ 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 d97500a652c4ea..03d187783316f8 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()); } 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 39833c645f7fff..1da24df80ee2a7 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,18 +87,12 @@ 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 be45d9940272ad..ba41f7812fe593 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,18 +108,12 @@ 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()); } From 4d51526eeef8160d546a850e7de0f4b394404912 Mon Sep 17 00:00:00 2001 From: Andrii Staikov Date: Wed, 20 Mar 2024 16:33:58 +0330 Subject: [PATCH 2/3] fix unused variable --- .../src/transformations/control_flow/unroll_if.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/common/transformations/src/transformations/control_flow/unroll_if.cpp b/src/common/transformations/src/transformations/control_flow/unroll_if.cpp index 361feb1108c975..089e88ae918134 100644 --- a/src/common/transformations/src/transformations/control_flow/unroll_if.cpp +++ b/src/common/transformations/src/transformations/control_flow/unroll_if.cpp @@ -54,7 +54,6 @@ bool ov::pass::UnrollIf::run_on_model(const std::shared_ptr& f) { } for (const auto& output_desc : output_descriptions) { std::shared_ptr result = body->get_results()[output_desc->m_body_value_index]; - const auto& in_value = result->input_value(0); for (const auto& input : if_node->output(output_desc->m_output_index).get_target_inputs()) { input.replace_source_output(result->get_input_source_output(0)); From 85eb7ee0e1dd14f7a4c51feae71f32a98523d9ef Mon Sep 17 00:00:00 2001 From: Andrii Staikov Date: Thu, 21 Mar 2024 22:23:05 +0330 Subject: [PATCH 3/3] getting back transformations present in NPU --- src/common/snippets/src/op/subgraph.cpp | 6 --- .../control_flow/unroll_if.cpp | 7 +++ .../control_flow/unroll_tensor_iterator.cpp | 4 ++ .../convert_maxpool_downgrade.cpp | 8 ++++ .../convert_nms9_to_nms_ie_internal.cpp | 6 +++ .../convert_nms_to_nms_ie_internal_test.cpp | 46 ------------------- 6 files changed, 25 insertions(+), 52 deletions(-) diff --git a/src/common/snippets/src/op/subgraph.cpp b/src/common/snippets/src/op/subgraph.cpp index 70224751f1f810..fa32b77e027423 100644 --- a/src/common/snippets/src/op/subgraph.cpp +++ b/src/common/snippets/src/op/subgraph.cpp @@ -257,16 +257,10 @@ auto Subgraph::wrap_node_as_subgraph(const std::shared_ptr& node) -> s } void Subgraph::fill_empty_output_names(const Output& target_output_node, const Output& replacement_output_node) { - OPENVINO_SUPPRESS_DEPRECATED_START auto& out_tensor = target_output_node.get_tensor(); - const std::string new_name = ov::op::util::get_ie_output_name(replacement_output_node); - if (ov::descriptor::get_ov_tensor_legacy_name(out_tensor).empty()) { - ov::descriptor::set_ov_tensor_legacy_name(out_tensor, new_name); - } if (!replacement_output_node.get_names().empty()) { out_tensor.set_names(replacement_output_node.get_names()); } - OPENVINO_SUPPRESS_DEPRECATED_END } auto Subgraph::constant_input_should_be_inside_body(const std::shared_ptr& node) -> bool { diff --git a/src/common/transformations/src/transformations/control_flow/unroll_if.cpp b/src/common/transformations/src/transformations/control_flow/unroll_if.cpp index 089e88ae918134..18b95538bcbe3f 100644 --- a/src/common/transformations/src/transformations/control_flow/unroll_if.cpp +++ b/src/common/transformations/src/transformations/control_flow/unroll_if.cpp @@ -54,7 +54,14 @@ bool ov::pass::UnrollIf::run_on_model(const std::shared_ptr& f) { } for (const auto& output_desc : output_descriptions) { std::shared_ptr result = body->get_results()[output_desc->m_body_value_index]; + const auto& in_value = result->input_value(0); + // set output name to Tensor to store it for openvino to cnn conversion + OPENVINO_SUPPRESS_DEPRECATED_START + ov::descriptor::set_ov_tensor_legacy_name( + in_value.get_tensor(), + op::util::create_ie_output_name(if_node->output(output_desc->m_output_index))); + OPENVINO_SUPPRESS_DEPRECATED_END for (const auto& input : if_node->output(output_desc->m_output_index).get_target_inputs()) { input.replace_source_output(result->get_input_source_output(0)); } diff --git a/src/common/transformations/src/transformations/control_flow/unroll_tensor_iterator.cpp b/src/common/transformations/src/transformations/control_flow/unroll_tensor_iterator.cpp index 6efbf51e1e3914..e807115c94ff3f 100644 --- a/src/common/transformations/src/transformations/control_flow/unroll_tensor_iterator.cpp +++ b/src/common/transformations/src/transformations/control_flow/unroll_tensor_iterator.cpp @@ -123,6 +123,10 @@ bool ov::pass::UnrollTensorIterator::run_on_model(const std::shared_ptr& target_inp) { return ov::as_type(target_inp.get_node()) != nullptr; })) { + OPENVINO_SUPPRESS_DEPRECATED_START + ov::descriptor::set_ov_tensor_legacy_name(insert_to.get_tensor(), + ov::op::util::create_ie_output_name(ti_output)); + OPENVINO_SUPPRESS_DEPRECATED_END } }; 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 38ed429b68f39e..fe390af3cd8f02 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,11 +37,19 @@ 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); maxpool_v8_node->clear_control_dependencies(); + OPENVINO_SUPPRESS_DEPRECATED_START + ov::descriptor::set_ov_tensor_legacy_name(maxpool_v1_node->output(0).get_tensor(), out_name); + OPENVINO_SUPPRESS_DEPRECATED_END + return true; }; 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 03d187783316f8..d97500a652c4ea 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,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/tests/op_conversions/convert_nms_to_nms_ie_internal_test.cpp b/src/common/transformations/tests/op_conversions/convert_nms_to_nms_ie_internal_test.cpp index 81d66bc18f464d..597817ae543a03 100644 --- a/src/common/transformations/tests/op_conversions/convert_nms_to_nms_ie_internal_test.cpp +++ b/src/common/transformations/tests/op_conversions/convert_nms_to_nms_ie_internal_test.cpp @@ -26,52 +26,6 @@ using namespace testing; using namespace ov; -TEST_F(TransformationTestsF, ConvertNMS1ToNMSIEInternal) { - { - auto boxes = std::make_shared(element::f32, Shape{1, 1000, 4}); - auto scores = std::make_shared(element::f32, Shape{1, 1, 1000}); - auto max_output_boxes_per_class = opset1::Constant::create(element::i64, Shape{}, {10}); - auto iou_threshold = opset1::Constant::create(element::f32, Shape{}, {0.75}); - auto score_threshold = opset1::Constant::create(element::f32, Shape{}, {0.7}); - auto nms = std::make_shared(boxes, - scores, - max_output_boxes_per_class, - iou_threshold, - score_threshold, - op::v1::NonMaxSuppression::BoxEncodingType::CORNER, - true); - - model = std::make_shared(NodeVector{nms}, ParameterVector{boxes, scores}); - - manager.register_pass(); - manager.register_pass(); - manager.register_pass(); - - // as inside test infrastructure we can not predict output names for given Model - // we have to enable soft names comparison manually - enable_soft_names_comparison(); - } - - { - auto boxes = std::make_shared(element::f32, Shape{1, 1000, 4}); - auto scores = std::make_shared(element::f32, Shape{1, 1, 1000}); - auto max_output_boxes_per_class = opset1::Constant::create(element::i64, Shape{1}, {10}); - auto iou_threshold = opset1::Constant::create(element::f32, Shape{1}, {0.75}); - auto score_threshold = opset1::Constant::create(element::f32, Shape{1}, {0.7}); - auto nms = std::make_shared(boxes, - scores, - max_output_boxes_per_class, - iou_threshold, - score_threshold, - 0, - true, - element::i32); - auto convert = std::make_shared(nms->output(0), element::i64); - - model_ref = std::make_shared(NodeVector{convert}, ParameterVector{boxes, scores}); - } -} - TEST_F(TransformationTestsF, ConvertNMS3ToNMSIEInternal) { { auto boxes = std::make_shared(element::f32, Shape{1, 1000, 4});