Skip to content

Add script to convert from TFLite to C++ using EmitC.#215

Open
jacob-hegna wants to merge 5 commits into
mainfrom
emitc
Open

Add script to convert from TFLite to C++ using EmitC.#215
jacob-hegna wants to merge 5 commits into
mainfrom
emitc

Conversation

@jacob-hegna

Copy link
Copy Markdown
Collaborator

To get from TF saved model to TFLite, see:
llvm/lib/Analysis/models/saved-model-to-tflite.py.

Example usage:

python compiler_opt/tools/tflite_to_cpp.py \
  --name="InlineOzTestModel" \
  --emitc_runtime_path=/tmp/mlir-emitc/reference-implementation/include/emitc
  --iree_import_tflite_path=/tmp/iree-import-tflite \
  --input=/tmp/model.tflite \
  --emitc_opt_path=/tmp/emitc-opt \
  --mlir_translate_path=/tmp/mlir-translate \
  --output_dir=/tmp/ \
  --base_class=::llvm::MLInlineOzEmitCModel \
  --additional_headers="llvm/Analysis/MLInlineEmitCModel.h"

To get from TF saved model to tflite, see:
  llvm/lib/Analysis/models/saved-model-to-tflite.py
@jacob-hegna

Copy link
Copy Markdown
Collaborator Author

will upload tests early next week. uploaded the patch without them initially so that reviewer(s) of reviews.llvm.org/D146483 can reference the code that produces the EmitC models.

@jacob-hegna jacob-hegna requested a review from mtrofin April 22, 2023 03:17
@mtrofin

mtrofin commented Apr 24, 2023

Copy link
Copy Markdown
Collaborator

Why can't this go in llvm/llvm-project/llvm/lib/Analysis/models?

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.

2 participants