Skip to content

Conversation

evkotov
Copy link
Contributor

@evkotov evkotov commented Oct 1, 2025

Details:

After CVS-136813, TensorFlow Frontend stopped removing Constant->Result subgraphs that represent training artifacts (e.g., Adam optimizer parameters like beta_1, beta_2). However, the test ModelWithConstResultSubgraphs was failing because:

  1. ConstToResultRemover was incorrectly removing all Constant->Result subgraphs, not just UnsupportedConstant->Result
  2. The reference model in the test didn't include the disconnected constants

Fixed ConstToResultRemover transformation
src/frontends/tensorflow_common/src/helper_transforms/const_to_result_remover.cpp

Removed logic that deleted all Constant->Result subgraphs. Now only removes UnsupportedConstant->Result subgraphs as intended. This preserves legitimate training artifacts from TensorFlow models.

// Before: removed both UnsupportedConstant and Constant
if (unsupported_const || const_node) {
    results_to_remove.push_back(result);
}

// After: only remove UnsupportedConstant
if (unsupported_const) {
    results_to_remove.push_back(result);
}

Updated reference model
src/frontends/tensorflow/tests/convert_tricky_models.cpp

Added disconnected Adam/beta_1 and Adam/beta_2 constants to the reference model to match the actual TensorFlow model structure.

Tickets:

  • 140357

@evkotov evkotov self-assigned this Oct 1, 2025
@evkotov evkotov requested a review from a team as a code owner October 1, 2025 17:52
@evkotov evkotov added the category: transformations OpenVINO Runtime library - Transformations label Oct 1, 2025
@evkotov evkotov requested review from a team as code owners October 1, 2025 17:52
@github-actions github-actions bot added category: IE Tests OpenVINO Test: plugins and common category: TF FE OpenVINO TensorFlow FrontEnd category: TFL FE OpenVINO TensorFlow Lite FrontEnd and removed category: transformations OpenVINO Runtime library - Transformations labels Oct 1, 2025
@evkotov evkotov changed the title FunctionComparator correctly handle models with disconnected subgraphs Preserve disconnected Constant->Result subgraphs in TensorFlow models Oct 1, 2025
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.

Copy link
Collaborator

@rkazants rkazants left a comment

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.

@rkazants rkazants assigned rkazants and unassigned evkotov Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: IE Tests OpenVINO Test: plugins and common category: TF FE OpenVINO TensorFlow FrontEnd category: TFL FE OpenVINO TensorFlow Lite FrontEnd do not merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants