Questions about TFX? Join us at Google I/O!

tfx.components.trainer.rewriting.tflite_rewriter.TFLiteRewriter

Performs TFLite conversion.

Inherits From: BaseRewriter

name The name to use when identifying the rewriter.
filename The name of the file to use for the tflite model.
copy_assets Boolean whether to copy the assets directory to the rewritten model directory.
copy_assets_extra Boolean whether to copy the assets.extra directory to the rewritten model directory.
quantization_optimizations Options for optimizations in quantization. If None, no quantization will be applied(float32). Check https://www.tensorflow.org/lite/performance/post_training_quantization for details.
quantization_supported_types Options for optimizations in quantization. Check https://www.tensorflow.org/lite/performance/post_training_quantization for details.
quantization_enable_full_integer True to quantize with FULL_INTEGER option.
signature_key Key identifying SignatureDef containing TFLite inputs and outputs.
representative_dataset Iterable that provides representative examples used for quantization. See https://www.tensorflow.org/lite/performance/post_training_quantization for details.
**kwargs Additional keyword arguments to create TFlite converter.

name The user-specified name of the rewriter.

Methods

perform_rewrite

View source

Invoke all validations and perform the rewrite.

Args
original_model A base_rewriter.ModelDescription object describing the original model.
rewritten_model A base_rewriter.ModelDescription object describing the location and type of the rewritten model.

Raises
ValueError if the model was not successfully rewritten.