STT-tensorflow/tensorflow/compiler/mlir/lite
Feng Liu 31acd85aee Add quantization support for tfl.transpose_conv
PiperOrigin-RevId: 317725618
Change-Id: If98427ba8b732edc7e1bd30f9c0f11d565d08a84
2020-06-22 13:46:24 -07:00
..
common - Remove executor_to_control pass. 2020-06-09 13:55:27 -07:00
experimental Add a TFL_CustomOp definition and support in exporter and importer. 2020-04-27 21:09:48 -07:00
ir Add quantization support for tfl.transpose_conv 2020-06-22 13:46:24 -07:00
python Use Bazel target names aligned with upstream library names 2020-06-10 19:57:02 -07:00
quantization Merge pull request #40371 from tg-at-google:sign-compare-warning-fixes-batch-1 2020-06-17 11:39:36 -07:00
sparsity Use Bazel target names aligned with upstream library names 2020-06-10 19:57:02 -07:00
tests Add quantization support for tfl.transpose_conv 2020-06-22 13:46:24 -07:00
transforms [NFC] Eliminate use of .getBlocks() when not needed 2020-06-22 10:34:01 -07:00
utils Support variant of whitespace tokenizer 2020-06-09 11:27:52 -07:00
BUILD Move tfl-device-index-selector to TF directory. 2020-06-18 15:11:43 -07:00
converter_gen.cc Do not emit op errors on TF -> TFL legalization 2020-06-17 15:49:36 -07:00
emit_error_reporter.cc Add EmitErrorReporter to bridge between ErrorReporter and context. 2019-07-08 12:26:33 -07:00
emit_error_reporter.h Change comment of the external repo #include file origin. 2020-03-23 10:42:53 -07:00
flatbuffer_export_flags.h Make flatbuffer_translate_lib dynamic linked 2020-03-23 18:29:10 -07:00
flatbuffer_export.cc [NFC] Eliminate use of .getBlocks() when not needed 2020-06-22 10:34:01 -07:00
flatbuffer_export.h Make flatbuffer_translate_lib dynamic linked 2020-03-23 18:29:10 -07:00
flatbuffer_import.cc [MLIR] Determine function visibility during import 2020-06-12 11:53:36 -07:00
flatbuffer_import.h Change comment of the external repo #include file origin. 2020-03-23 10:42:53 -07:00
flatbuffer_operator.cc Add a TFL_CustomOp definition and support in exporter and importer. 2020-04-27 21:09:48 -07:00
flatbuffer_operator.h Add a TFL_CustomOp definition and support in exporter and importer. 2020-04-27 21:09:48 -07:00
flatbuffer_to_string.cc Change comment of the external repo #include file origin. 2020-03-23 10:42:53 -07:00
flatbuffer_translate_flags.h Make flatbuffer_translate_lib dynamic linked 2020-03-22 22:49:32 -07:00
flatbuffer_translate.cc Make flatbuffer_translate_lib dynamic linked 2020-03-23 18:29:10 -07:00
flatbuffer_translate.h Change comment of the external repo #include file origin. 2020-03-23 10:42:53 -07:00
json_to_flatbuffer.cc Create a json to flatbuffer utility for tests that cannot use mlir-flatbuffer-mlir round-trip. 2020-04-09 19:32:39 -07:00
mlir_tflite_runner.cc Make flatbuffer_translate_lib dynamic linked 2020-03-23 18:29:10 -07:00
README.md [TFLite] Update README to reflect current state 2020-03-05 13:53:04 -08:00
tf_tfl_passes.cc Apply default quantization parameter before quantization pass 2020-06-22 10:05:11 -07:00
tf_tfl_passes.h Change comment of the external repo #include file origin. 2020-03-23 10:42:53 -07:00
tf_tfl_translate_cl.cc Add a flag for enabling/disabling legalize tf while pass in tf_tfl_translate 2020-03-24 16:26:18 -07:00
tf_tfl_translate_cl.h Add a flag for enabling/disabling legalize tf while pass in tf_tfl_translate 2020-03-24 16:26:18 -07:00
tf_tfl_translate.cc Merge branch 'master' into IFX/PR_tfl_converter_QAT_fixes 2020-05-27 15:26:47 +02:00
tf_to_tfl_flatbuffer.cc - Remove executor_to_control pass. 2020-06-09 13:55:27 -07:00
tf_to_tfl_flatbuffer.h Enable Keras/RNN case via MLIR SavedModel import in TFLiteConverterV2 2020-04-03 14:33:45 -07:00

The new MLIR based

TensorFlow to TensorFlow Lite converter

This directory contains:

  1. MLIR dialects, transformation passes and utilities for TensorFlow Lite.

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.

See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/compiler/mlir/lite/tf_tfl_passes.cc for the full list of MLIR passes for conversion from TensorFlow to TensorFlow Lite.