Skip to content

Commit

Permalink
[PT FE] Remove unique names from FE, rely on ResolveNameCollisions (o…
Browse files Browse the repository at this point in the history
…penvinotoolkit#21636)

* [PT FE] Remove unicalisation from FE, rely on ResolveNameCollisions

* Fix build
  • Loading branch information
mvafin authored Dec 14, 2023
1 parent 27bf494 commit 1d03b08
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 15 deletions.
2 changes: 1 addition & 1 deletion src/frontends/pytorch/src/frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void FrontEnd::normalize(const std::shared_ptr<ov::Model>& model) const {
manager.register_pass<ov::pass::ReverseShapeAndTypeInfer>();
// Second pass of AlignTypesRemoval after all converting transformations
manager.register_pass<ov::frontend::pytorch::pass::AlignTypesRemoval>();
manager.register_pass<ov::pass::ResolveNameCollisions>();
manager.register_pass<ov::pass::ResolveNameCollisions>(true);
manager.run_passes(model);

apply_pytorch_conversion_transforms(model);
Expand Down
1 change: 0 additions & 1 deletion src/frontends/pytorch/src/node_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ OutputVector NodeContext::as_constant() const {

std::shared_ptr<Node> NodeContext::mark_node(std::shared_ptr<Node> ov_node) const {
ov_node = m_decoder->mark_node(ov_node);
m_translate_session->unique_name(ov_node);
return ov_node;
}

Expand Down
8 changes: 0 additions & 8 deletions src/frontends/pytorch/src/translate_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,14 +402,6 @@ Output<Node> TranslateSession::get_reverseprop_op(const std::shared_ptr<TorchDec
return std::make_shared<PtFrameworkNode>(node, OutputVector{value}, 1, true);
}

void TranslateSession::unique_name(const std::shared_ptr<Node>& node) {
if (m_unique_friendly_name_set.count(node->get_friendly_name())) {
node->set_friendly_name(node->get_friendly_name() + '_' + std::to_string(m_friendly_name_counter++));
} else {
m_unique_friendly_name_set.insert(node->get_friendly_name());
}
}

} // namespace pytorch
} // namespace frontend
} // namespace ov
5 changes: 0 additions & 5 deletions src/frontends/pytorch/src/translate_session.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ class TranslateSession {
/// \brief Gets pytorch tensor index from openvino tensor
size_t decode_tensor_name(const Output<Node>& tensor_desc);

/// \brief Make sure Node has unique name
void unique_name(const std::shared_ptr<Node>& node);

// Maps tensor index to initial tensor index which it is alias to, and to decoder of the node produced this alias
// and to the output produced during conversion of this node
std::map<size_t, std::tuple<size_t, std::shared_ptr<TorchDecoder>, Output<Node>>> m_may_be_alias;
Expand All @@ -64,8 +61,6 @@ class TranslateSession {

std::map<size_t, std::pair<size_t, Output<Node>>> m_counter_map;
std::map<std::string, uint64_t> m_op_statistics;
std::unordered_set<std::string> m_unique_friendly_name_set;
size_t m_friendly_name_counter = 0;
};

} // namespace pytorch
Expand Down

0 comments on commit 1d03b08

Please sign in to comment.