tree: ad208d29939a5fd0da0fedfa461bb904fadb7dda [path history] [tgz]
  1. ir/
  2. python/
  3. quantization/
  4. tests/
  5. tools/
  6. transforms/
  7. utils/
  8. BUILD
  9. emit_error_reporter.cc
  10. emit_error_reporter.h
  11. flatbuffer_import.cc
  12. flatbuffer_import.h
  13. flatbuffer_operator.cc
  14. flatbuffer_operator.h
  15. flatbuffer_to_string.cc
  16. flatbuffer_translate.cc
  17. flatbuffer_translate.h
  18. mlir_tflite_runner.cc
  19. operator_writer_gen.cc
  20. README.md
  21. tf_tfl_translate.cc
  22. tf_tfl_translate_cl.cc
  23. tf_tfl_translate_cl.h
  24. tf_to_tfl_flatbuffer.cc
  25. tf_to_tfl_flatbuffer.h
tensorflow/compiler/mlir/lite/README.md

Experimental code for the new TF-Lite convertor, and MLIR dialects and utilities for TensorFlow Lite.

This directory contains:

  1. Experimental code for the new TF-Lite convertor.
  2. Code for the TF-lite dialect MLIR.

API:

The API for converting TensorFlow models to TensorFlow Lite will be through tf.lite.TFLiteConverter. All the conversion code is open sourced, and the API will be integrated soon.

The conversion process from TensorFlow to TensorFlow Lite includes the following major passes:

  • Import from GraphDef, in .pb or .pbtxt format, into MLIR.
  • Raise to Control-flow-graph. Converts TF Control Flow dialect to TF dialect.
  • The Canonicalization pass iteratively applies canonicalization transformations in a greedy way until no further changes occur. Canonicalization includes constant folding.
  • The Legalize pass converts TensorFlow operations to TensorFlow Lite ones. The operations that cannot be mapped to TensorFlow Lite dialect are left as TensorFlow operations. Unsupported op handling follows the proposed TFLite mechanism.
  • Optimizations are performed in both the TF & TFLite dialect; aiming for small size and high performance (among the core value proposition of TensorFlow Lite models).
  • The Export pass writes out TensorFlow Lite FlatBuffer format. This pass operates on MLIR TensorFlow Lite dialect and is simple/direct translation.