Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TRANSFORMATIONS] Remove use of legacy names from transformations #23574

Merged
merged 3 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/common/snippets/src/op/subgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,16 +257,10 @@ auto Subgraph::wrap_node_as_subgraph(const std::shared_ptr<ov::Node>& node) -> s
}

void Subgraph::fill_empty_output_names(const Output<Node>& target_output_node, const Output<Node>& 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<ov::Node>& node) -> bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ov::op::v0::Convert>(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<ov::op::v0::Convert>(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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,11 @@ pass::ConvertMulticlassNmsToMulticlassNmsIE::ConvertMulticlassNmsToMulticlassNms

if (nms->output(1).get_element_type() != output_1.get_element_type()) {
output_1 = std::make_shared<ov::op::v0::Convert>(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<ov::op::v0::Convert>(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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,12 @@ ov::pass::ConvertNMSRotatedToNMSIEInternal::ConvertNMSRotatedToNMSIEInternal() {
Output<Node> output_0 = nms_legacy->output(0);
if (nms_rotated->output(0).get_element_type() != output_0.get_element_type()) {
output_0 = std::make_shared<ov::op::v0::Convert>(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<Node> output_2 = nms_legacy->output(2);
if (nms_rotated->output(2).get_element_type() != output_2.get_element_type()) {
output_2 = std::make_shared<ov::op::v0::Convert>(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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,12 @@ ov::pass::ConvertNMSToNMSIEInternal::ConvertNMSToNMSIEInternal() {
Output<Node> output_0 = nms_legacy->output(0);
if (nms_5->output(0).get_element_type() != output_0.get_element_type()) {
output_0 = std::make_shared<ov::op::v0::Convert>(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<Node> output_2 = nms_legacy->output(2);
if (nms_5->output(2).get_element_type() != output_2.get_element_type()) {
output_2 = std::make_shared<ov::op::v0::Convert>(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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,52 +26,6 @@
using namespace testing;
using namespace ov;

TEST_F(TransformationTestsF, ConvertNMS1ToNMSIEInternal) {
{
auto boxes = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1000, 4});
auto scores = std::make_shared<opset1::Parameter>(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<opset1::NonMaxSuppression>(boxes,
scores,
max_output_boxes_per_class,
iou_threshold,
score_threshold,
op::v1::NonMaxSuppression::BoxEncodingType::CORNER,
true);

model = std::make_shared<Model>(NodeVector{nms}, ParameterVector{boxes, scores});

manager.register_pass<ov::pass::ConvertNMS1ToNMS5>();
manager.register_pass<ov::pass::ConvertNMSToNMSIEInternal>();
manager.register_pass<pass::ConstantFolding>();

// 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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like we've lost a little bit of coverage. can we still have a test without name comparison?

Copy link
Contributor

@itikhono itikhono Mar 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still have in convert_nms9_to_nms_ie_internal_test.cpp
But we are going to delete this test in the next Release, so it's better to create a new test without nms specifics in the next PR

}

{
auto boxes = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1000, 4});
auto scores = std::make_shared<opset1::Parameter>(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<ov::op::internal::NonMaxSuppressionIEInternal>(boxes,
scores,
max_output_boxes_per_class,
iou_threshold,
score_threshold,
0,
true,
element::i32);
auto convert = std::make_shared<opset1::Convert>(nms->output(0), element::i64);

model_ref = std::make_shared<Model>(NodeVector{convert}, ParameterVector{boxes, scores});
}
}

TEST_F(TransformationTestsF, ConvertNMS3ToNMSIEInternal) {
{
auto boxes = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1000, 4});
Expand Down
Loading