Skip to content
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

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jacob-hegna
Copy link
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
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
Copy link
Collaborator

mtrofin commented Apr 24, 2023

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