Performs TFLite conversion.
Inherits From: BaseRewriter
tfx.components.trainer.rewriting.tflite_rewriter.TFLiteRewriter(
name: Text,
filename: Text = 'tflite',
copy_assets: bool = True,
copy_assets_extra: bool = True,
quantization_optimizations: Optional[Sequence[tf.lite.Optimize]] = None,
quantization_supported_types: Optional[Sequence[tf.DType]] = None,
quantization_enable_full_integer: bool = False,
signature_key: Text = None
)
Args |
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 quantizae with FULL_INTEGER
option.
|
signature_key
|
Key identifying SignatureDef containing TFLite inputs and
outputs.
|
Attributes |
name
|
The user-specified name of the rewriter.
|
Methods
View source
perform_rewrite(
original_model: tfx.components.trainer.rewriting.rewriter.ModelDescription
,
rewritten_model: tfx.components.trainer.rewriting.rewriter.ModelDescription
)
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.
|