Skip to content
Open
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
11 changes: 10 additions & 1 deletion src/frontends/tensorflow/tests/convert_tricky_models.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,16 @@ TEST_F(FrontEndConversionWithReferenceTestsF, ModelWithConstResultSubgraphs) {
auto inverse_order = make_shared<v0::Constant>(element::i64, Shape{4}, vector<int64_t>{0, 2, 3, 1});
auto transpose_to_nhwc = make_shared<v1::Transpose>(max_pool, inverse_order);

model_ref = make_shared<Model>(OutputVector{transpose_to_nhwc}, ParameterVector{x});
// These constants (Adam/beta_1, Adam/beta_2) are not connected to the main graph
auto beta_1 = make_shared<v0::Constant>(element::f32, Shape{}, vector<float>{0.8999999761581421f});
auto result_beta_1 = make_shared<v0::Result>(beta_1);

auto beta_2 = make_shared<v0::Constant>(element::f32, Shape{}, vector<float>{0.9990000128746033f});
auto result_beta_2 = make_shared<v0::Result>(beta_2);

auto result_main = make_shared<v0::Result>(transpose_to_nhwc);

model_ref = make_shared<Model>(ResultVector{result_main, result_beta_1, result_beta_2}, ParameterVector{x});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ bool ConstToResultRemover::run_on_model(const std::shared_ptr<ov::Model>& m) {
// no need to apply it for sub-graphs!
ResultVector results_to_remove;
// look for isolated UnsupportedConst->Result sub-graphs to remove
// also, find isolated Constant->Result sub-graphs to remove
for (const auto& result : m->get_results()) {
auto unsupported_const = as_type_ptr<UnsupportedConstant>(result->get_input_node_shared_ptr(0));
auto const_node = as_type_ptr<v0::Constant>(result->get_input_node_shared_ptr(0));
if (unsupported_const || const_node) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we have a model that contains multiple isolated Constants (tens of them) that impact compilation times of the plugin.
This was a reason to delete such isolated constants.

if (unsupported_const) {
results_to_remove.push_back(result);
}
}
Expand Down
Loading
Loading