Skip to content

Converter internals unification #699

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

Merged
merged 2 commits into from
Jan 7, 2022
Merged

Conversation

CNugteren
Copy link
Contributor

What do these changes do?

This factors out some common code from saved_model_tfl_flatbuffer.cc and graphdef_tfl_flatbuffer.cc into a new file. This already leads to some code de-duplication, but is mainly motivated to make future additions of similar functionality easier (e.g. a tflite-mlir-tflite converter).

How Has This Been Tested?

CI should cover this I hope.

Related issue number

N/A

@CNugteren CNugteren added the internal-improvement Internal Improvements and Maintenance label Jan 7, 2022
@CNugteren CNugteren requested a review from a team January 7, 2022 09:57
}
}

Status GetNumInputs(mlir::OwningModuleRef* module, int* num_inputs) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function was copied 1-to-1 from saved_model_tfl_flatbuffer.cc.

return Status::OK();
}

pybind11::bytes ConvertMLIRModuleToTFLiteFlatBuffer(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function body was copied from saved_model_tfl_flatbuffer.cc and then adjusted in the following ways:

  1. The should_quantize option was added to make it work with graphdef_tfl_flatbuffer.cc as well.
  2. The mark_as_post_training_quant option was added to make it work with graphdef_tfl_flatbuffer.cc as well.

@CNugteren CNugteren merged commit 3826efc into main Jan 7, 2022
@CNugteren CNugteren deleted the converter_internals_refactoring branch January 7, 2022 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal-improvement Internal Improvements and Maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants