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

[PT FE] Remove unique names from FE, rely on ResolveNameCollisions #21636

Merged
merged 2 commits into from
Dec 14, 2023
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
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
Loading