Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tfx.components.trainer.rewriting.tflite_rewriter.TFLiteRewriter

View source on GitHub

Performs TFLite conversion.

Inherits From: BaseRewriter

tfx.components.trainer.rewriting.tflite_rewriter.TFLiteRewriter(
    name, filename='tflite', enable_experimental_new_converter=False,
    copy_assets=True, copy_assets_extra=True
)

Args:

  • name: The name to use when identifying the rewriter.
  • filename: The name of the file to use for the tflite model.
  • enable_experimental_new_converter: Whether to use the MLIR converter.
  • 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.

Attributes:

  • name: The user-specified name of the rewriter.

Methods

perform_rewrite

View source

perform_rewrite(
    original_model, rewritten_model
)

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.