Skip to content

Conversation

@rascani
Copy link
Contributor

@rascani rascani commented Aug 10, 2023

This PR creates the initial code generator scaffolding for performing inference without an interpreter. Currently, this does nothing other create a header and source file from Mako templates. Mako was chosen as a template engine due to existing dependency.

BUG=b/295076487

This PR creates the initial code generator scaffolding for performing
inference without an interpreter. Currently, this does nothing other
create a header and source file from Mako templates. Mako was chosen as
a template engine due to existing dependency.

BUG=b/295076487
@rascani rascani requested a review from a team as a code owner August 10, 2023 16:34
@rascani rascani requested a review from advaitjain August 10, 2023 16:34
Copy link
Member

@advaitjain advaitjain left a comment

Choose a reason for hiding this comment

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

What do you think of making a top-level codegen directory instead of tensorflow/lite/micro/tools/codegen?

""" Generate C/C++ inference code. """
header_file = f"{output_name}.h"
model_data: ModelData = {
'header_file': header_file,
Copy link
Member

Choose a reason for hiding this comment

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

is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, the generated source file will need to know where it's corresponding header is. Probably could have inferred it in the template from the model name, but that seemed like it could drift if we start including paths.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added header_file to the ModelData TypedDict

@rascani
Copy link
Contributor Author

rascani commented Aug 10, 2023

Top level codegen directory sounds good to me, lot less typing. :)

Also adds header_file to the TypedDict
@rascani rascani added the ci:run label Aug 10, 2023
@TFLM-bot TFLM-bot removed the ci:run label Aug 10, 2023
@mergify mergify bot merged commit 901d830 into tensorflow:main Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants