diff --git a/src/common/transformations/src/transformations/common_optimizations/moc_transformations.cpp b/src/common/transformations/src/transformations/common_optimizations/moc_transformations.cpp index e1b1898c15d29f..a22fa2bdcf088b 100644 --- a/src/common/transformations/src/transformations/common_optimizations/moc_transformations.cpp +++ b/src/common/transformations/src/transformations/common_optimizations/moc_transformations.cpp @@ -267,7 +267,7 @@ bool ov::pass::MOCTransformations::run_on_model(const std::shared_ptr REGISTER_PASS(manager, AlignEltwiseInputRanks) REGISTER_PASS(manager, SharedOpOptimization) REGISTER_PASS(manager, ConstantFolding) - REGISTER_PASS(manager, ResolveNameCollisions) + manager.register_pass(true); manager.run_passes(f); if (!m_use_shapes) { diff --git a/src/core/src/pass/serialize.cpp b/src/core/src/pass/serialize.cpp index a5c195a633effc..94558a38f4e766 100644 --- a/src/core/src/pass/serialize.cpp +++ b/src/core/src/pass/serialize.cpp @@ -783,28 +783,6 @@ std::string escape_delim(const std::string& name, const char delim = ',') { return result_name; } -std::string generate_unique_name(const std::unordered_set& unique_names, - const std::string& base_name, - int suffix) { - std::string new_name = base_name + std::to_string(suffix); - if (unique_names.find(new_name) == unique_names.end()) { - return new_name; - } else { - suffix++; - return generate_unique_name(unique_names, base_name, suffix); - } -} - -// TODO: remove when CNNNetwork will be supporting not-unique names -std::string get_node_unique_name(std::unordered_set& unique_names, const ov::Node* n) { - std::string name = n->get_friendly_name(); - if (unique_names.find(name) != unique_names.end()) { - name = generate_unique_name(unique_names, name, 0); - } - unique_names.insert(name); - return name; -} - void visit_exec_graph_node(pugi::xml_node& layer, const ov::Node* n) { auto data = layer.child("data"); for (const auto& param : n->get_rt_info()) { @@ -936,7 +914,6 @@ void ngfunction_2_ir(pugi::xml_node& netXml, pugi::xml_node layers = netXml.append_child("layers"); const std::unordered_map layer_ids = create_layer_ids(model); - std::unordered_set unique_names; const bool exec_graph = is_exec_graph(model); @@ -976,7 +953,7 @@ void ngfunction_2_ir(pugi::xml_node& netXml, // If determinism is not required, include auto-generated names into xml // layer name is not critical for hash computing if (!deterministic) { - layer.append_attribute("name").set_value(get_node_unique_name(unique_names, node).c_str()); + layer.append_attribute("name").set_value(node->get_friendly_name().c_str()); } layer.append_attribute("type").set_value(translate_type_name(node_type_name).c_str()); if (!exec_graph) { diff --git a/src/frontends/ir/src/ir_deserializer.cpp b/src/frontends/ir/src/ir_deserializer.cpp index 030c85224db8cf..a3981f694bb827 100644 --- a/src/frontends/ir/src/ir_deserializer.cpp +++ b/src/frontends/ir/src/ir_deserializer.cpp @@ -457,7 +457,6 @@ std::shared_ptr ov::XmlDeserializer::parse_function(const pugi::xml_n std::map params; std::vector outputs; - std::unordered_set opName; std::vector order; std::set dfs_used_nodes; @@ -465,9 +464,6 @@ std::shared_ptr ov::XmlDeserializer::parse_function(const pugi::xml_n // Read all layers and store their parameters in params map FOREACH_CHILD (node, root.child("layers"), "layer") { auto node_param = parse_generic_params(node); - if (opName.find(node_param.name) != opName.end() && node_param.type != "Result") - OPENVINO_THROW("Invalid IR! ", node_param.name, " name is not unique!"); - opName.insert(node_param.name); params[node_param.layerId] = {node, node_param}; if (node_param.type == "Result" || node_param.type == "Assign") { outputs.push_back(node_param.layerId); diff --git a/src/frontends/ir/tests/frontend_test_basic.cpp b/src/frontends/ir/tests/frontend_test_basic.cpp index 71dae9159c7f02..ebf11fed7629ac 100644 --- a/src/frontends/ir/tests/frontend_test_basic.cpp +++ b/src/frontends/ir/tests/frontend_test_basic.cpp @@ -783,7 +783,7 @@ TEST_F(IRFrontendTests, name_is_not_unique) { createTemporalModelFile(xmlModel, buffer); std::shared_ptr model; - ASSERT_THROW(core.read_model(xmlFileName, binFileName), ov::Exception); + EXPECT_NO_THROW(core.read_model(xmlFileName, binFileName)); } TEST_F(IRFrontendTests, edge_has_wrong_port_id) { diff --git a/src/frontends/onnx/frontend/src/frontend.cpp b/src/frontends/onnx/frontend/src/frontend.cpp index a21238f6bc4c8c..f773527e353f46 100644 --- a/src/frontends/onnx/frontend/src/frontend.cpp +++ b/src/frontends/onnx/frontend/src/frontend.cpp @@ -114,7 +114,7 @@ void FrontEnd::normalize(const std::shared_ptr& model) const { // Here, you can register transformations as a second step of importing process // In particular, you can operate on not supported ops (it allows to N:N ONNX->OV mapping). ov::pass::Manager manager; - manager.register_pass(); + manager.register_pass(true); manager.run_passes(model); } diff --git a/src/frontends/paddle/src/frontend.cpp b/src/frontends/paddle/src/frontend.cpp index 6cdba8c29550f5..416ec152ce399f 100644 --- a/src/frontends/paddle/src/frontend.cpp +++ b/src/frontends/paddle/src/frontend.cpp @@ -568,7 +568,7 @@ void FrontEnd::add_extension(const std::shared_ptr& extension) { void FrontEnd::normalize(const std::shared_ptr& model) const { ov::pass::Manager manager; - manager.register_pass(); + manager.register_pass(true); manager.run_passes(model); } diff --git a/src/frontends/tensorflow/src/frontend.cpp b/src/frontends/tensorflow/src/frontend.cpp index 5a777094f5f4c1..f7ac0ebed1b6ee 100644 --- a/src/frontends/tensorflow/src/frontend.cpp +++ b/src/frontends/tensorflow/src/frontend.cpp @@ -550,7 +550,7 @@ void FrontEnd::normalize(const std::shared_ptr& model) const { manager.register_pass(); manager.register_pass(); manager.register_pass(); - manager.register_pass(); + manager.register_pass(true); manager.run_passes(model); } diff --git a/src/frontends/tensorflow_lite/src/frontend.cpp b/src/frontends/tensorflow_lite/src/frontend.cpp index b71774c0633899..c2dafa9bbafea1 100644 --- a/src/frontends/tensorflow_lite/src/frontend.cpp +++ b/src/frontends/tensorflow_lite/src/frontend.cpp @@ -292,7 +292,7 @@ void FrontEnd::normalize(const std::shared_ptr& function) const { manager.register_pass(); manager.register_pass(); manager.register_pass(); - manager.register_pass(); + manager.register_pass(true); manager.run_passes(function); }