Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[TF FE] Fix conversion of body graph from memory (#25973)

Roman Kazantsevca51e55dfc05
diff --git a/src/frontends/tensorflow/src/input_model.cpp b/src/frontends/tensorflow/src/input_model.cpp
index 7610c7a23dc..924380b2399 100644
--- a/src/frontends/tensorflow/src/input_model.cpp
+++ b/src/frontends/tensorflow/src/input_model.cpp
@@ -231,7 +231,7 @@ void InputModel::InputModelTFImpl::load_places() {
type = dtype_any.as<ov::element::Type>();
}
std::vector<std::string> names = {op_name + ":0"};
- auto tensor_place = std::make_shared<TensorPlace>(m_input_model, pshape, type, names);
+ auto tensor_place = std::make_shared<TensorPlace>(m_input_model, pshape, type, names, op_name);
m_default_places[op_name + ":0"] = tensor_place;
@@ -257,7 +257,8 @@ void InputModel::InputModelTFImpl::load_places() {
auto tensor_place = std::make_shared<TensorPlace>(m_input_model,
ov::PartialShape::dynamic(),
type,
- std::vector<std::string>{op_name});
+ std::vector<std::string>{op_name},
+ op_name);
m_inputs.push_back(tensor_place);
}
}
diff --git a/src/frontends/tensorflow/src/translate_session.cpp b/src/frontends/tensorflow/src/translate_session.cpp
index 3bd21889f2a..dae6c7f5edd 100644
--- a/src/frontends/tensorflow/src/translate_session.cpp
+++ b/src/frontends/tensorflow/src/translate_session.cpp
@@ -439,6 +439,7 @@ void TranslateSession::translate_graph(const ov::frontend::InputModel::Ptr& inpu
const auto& input_tensor_place = std::dynamic_pointer_cast<TensorPlace>(input_place);
auto input_shape = input_tensor_place->get_partial_shape();
auto input_type = input_tensor_place->get_element_type();
+ auto input_op_name = input_tensor_place->get_operation_name();
// in case of cutting graph, types of custom inputs can be dynamic,
// according to MO help, fp32 is used by default in such cases
@@ -453,7 +454,7 @@ void TranslateSession::translate_graph(const ov::frontend::InputModel::Ptr& inpu
param->set_friendly_name(input_name);
set_out_name(input_name, param);
params.push_back(param);
- (*ov_tensors_map)[input_name] = {NamedOutput(param)};
+ (*ov_tensors_map)[input_op_name] = {NamedOutput(param)};
}
}
diff --git a/src/frontends/tensorflow_common/include/place.hpp b/src/frontends/tensorflow_common/include/place.hpp
index 1ed70fa59d2..5588fc4cbe7 100644
--- a/src/frontends/tensorflow_common/include/place.hpp
+++ b/src/frontends/tensorflow_common/include/place.hpp
@@ -156,6 +156,12 @@ public:
ov::element::Type type,
const std::vector<std::string>& names);
+ TensorPlace(const ov::frontend::InputModel& input_model,
+ const ov::PartialShape& pshape,
+ ov::element::Type type,
+ const std::vector<std::string>& names,
+ const std::string& operation_name);
+
void add_producing_port(const std::shared_ptr<OutPortPlace>& out_port);
void add_consuming_port(const std::shared_ptr<InPortPlace>& in_port);
@@ -166,6 +172,9 @@ public:
const element::Type& get_element_type() const {
return m_type;
}
+ const std::string& get_operation_name() const {
+ return m_operation_name;
+ }
void set_partial_shape(const PartialShape& pshape) {
m_pshape = pshape;
}
@@ -183,6 +192,8 @@ public:
private:
PartialShape m_pshape;
element::Type m_type;
+ // store original node name from which tensor place is created
+ std::string m_operation_name;
std::vector<std::weak_ptr<OutPortPlace>> m_producing_ports;
std::vector<std::weak_ptr<InPortPlace>> m_consuming_ports;
diff --git a/src/frontends/tensorflow_common/src/place.cpp b/src/frontends/tensorflow_common/src/place.cpp
index ec0a2fec818..9ef13e207b4 100644
--- a/src/frontends/tensorflow_common/src/place.cpp
+++ b/src/frontends/tensorflow_common/src/place.cpp
@@ -182,7 +182,19 @@ TensorPlace::TensorPlace(const ov::frontend::InputModel& input_model,
const std::vector<std::string>& names)
: Place(input_model, names),
m_pshape(pshape),
- m_type(type) {}
+ m_type(type) {
+ m_operation_name = (names.size() > 0) ? names[0] : m_operation_name;
+}
+
+TensorPlace::TensorPlace(const ov::frontend::InputModel& input_model,
+ const ov::PartialShape& pshape,
+ ov::element::Type type,
+ const std::vector<std::string>& names,
+ const std::string& operation_name)
+ : Place(input_model, names),
+ m_pshape(pshape),
+ m_type(type),
+ m_operation_name(operation_name) {}
std::vector<ov::frontend::Place::Ptr> TensorPlace::get_consuming_ports() const {
std::vector<ov::frontend::Place::Ptr> consuming_ports;
diff --git a/tests/model_hub_tests/tensorflow/model_lists/precommit_convert_model b/tests/model_hub_tests/tensorflow/model_lists/precommit_convert_model
index f0f34a8ef46..c1215cbca78 100644
--- a/tests/model_hub_tests/tensorflow/model_lists/precommit_convert_model
+++ b/tests/model_hub_tests/tensorflow/model_lists/precommit_convert_model
@@ -13,7 +13,7 @@ small_bert/bert_en_uncased_L-4_H-256_A-4,https://www.kaggle.com/models/tensorflo
movinet/a5/base/kinetics-600/classification,https://www.kaggle.com/models/google/movinet/frameworks/tensorFlow2/variations/a5-base-kinetics-600-classification/versions/3
object_detection/mobile_object_localizer_v1,https://www.kaggle.com/models/google/mobile-object-localizer-v1/frameworks/tensorFlow1/variations/object-detection-mobile-object-localizer-v1/versions/1,xfail,128695 - inference results mismatch
# models with TensorListConcatV2 op
-efficientdet/lite0/detection,https://www.kaggle.com/models/tensorflow/efficientdet/frameworks/tensorFlow2/variations/lite0-detection/versions/1,skip,142814 - unregistered parameters for While conversion
+efficientdet/lite0/detection,https://www.kaggle.com/models/tensorflow/efficientdet/frameworks/tensorFlow2/variations/lite0-detection/versions/1
# model with complex tensors and FFT ops
yamnet,https://www.kaggle.com/models/google/yamnet/frameworks/tensorFlow2/variations/yamnet/versions/1
# secure notebook models