class_docstr: Performs TFLite conversion.
class_docstr_tok: ["Performs","TFLite","conversion","."]
docstr: Create an instance of the TFLiteRewriter.
  
  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 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.
docstr_tok: ["Create","an","instance","of","the","TFLiteRewriter",".","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","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","."]
code: def __init__(
      self,
      name: str,
      filename: str = "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: Optional[str] = None,
      representative_dataset: Optional[
          Iterable[Sequence[np.ndarray]]
      ] = None,
      **kwargs,
  ):
      """Create an instance of the TFLiteRewriter.
  
      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 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.
      """
      self._name = name
      self._filename = _ensure_str(filename)
      self._copy_assets = copy_assets
      self._copy_assets_extra = copy_assets_extra
  
      if quantization_optimizations is None:
          quantization_optimizations = []
      if quantization_supported_types is None:
          quantization_supported_types = []
      self._quantization_optimizations = quantization_optimizations
      self._quantization_supported_types = quantization_supported_types
      self._representative_dataset = representative_dataset
      if (
          quantization_enable_full_integer
          and self._representative_dataset is None
      ):
          raise ValueError(
              "If quantization_enable_full_integer is set to "
              "`True`, then `representative_dataset` must be "
              "defined."
          )
      self._signature_key = signature_key
      self._kwargs = kwargs
  
file_path: tfx/tfx/components/trainer/rewriting/tflite_rewriter.py
imports: import os
  import time
  from typing import Iterable, Optional, Sequence
  import numpy
  import tensorflow
  from tfx.components.trainer.rewriting import rewriter
  from tfx.dsl.io import fileio
  from tfx.utils import io_utils
label_desc: Use image node_id 1 to create a new TFLiteRewriter object from inherited base classes: rewriter with example: obj = TFLiteRewriter(name, filename, copy_assets, copy_assets_extra, quantization_optimizations, quantization_supported_types, quantization_enable_full_integer, signature_key, representative_dataset)