class_docstr: Performs TFLite conversion.
class_docstr_tok: ["Performs","TFLite","conversion","."]
docstr: Creates a TFLite converter with proper quantization options.
  
  Currently,
  this supports DYNAMIC_RANGE, FULL_INTEGER and FLOAT16 quantizations.
  
  Args:
    saved_model_path: Path for the TF SavedModel.
    quantization_optimizations: Options for optimizations in quantization. If
      empty, 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.
    representative_dataset: Iterable that provides representative examples
      used for quantization. See
      https://www.tensorflow.org/lite/performance/post_training_quantization
        for details.
    signature_key: Key identifying SignatureDef containing TFLite inputs and
      outputs. (default tf.saved_model.DEFAULT_SERVING_SIGNATURE_DEF_KEY)
    **kwargs: Additional arguments to create tflite converter.
  
  Returns:
    A TFLite converter with the proper flags being set.
  
  Raises:
    NotImplementedError: Raises when full-integer quantization is called.
docstr_tok: ["Creates","a","TFLite","converter","with","proper","quantization","options",".","Currently",",","this","supports","DYNAMIC_RANGE",",","FULL_INTEGER","and","FLOAT16","quantizations",".","Args",":","saved_model_path",":","Path","for","the","TF","SavedModel",".","quantization_optimizations",":","Options","for","optimizations","in","quantization",".","If","empty",",","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",".","representative_dataset",":","Iterable","that","provides","representative","examples","used","for","quantization",".","See","https",":","\/\/www.tensorflow.org\/lite\/performance\/post_training_quantization","for","details",".","signature_key",":","Key","identifying","SignatureDef","containing","TFLite","inputs","and","outputs",".","(","default","tf.saved_model.DEFAULT_SERVING_SIGNATURE_DEF_KEY",")","*","*","kwargs",":","Additional","arguments","to","create","tflite","converter",".","Returns",":","A","TFLite","converter","with","the","proper","flags","being","set",".","Raises",":","NotImplementedError",":","Raises","when","full-integer","quantization","is","called","."]
code: def _create_tflite_converter(
      self,
      saved_model_path: str,
      quantization_optimizations: Sequence[tf.lite.Optimize],
      quantization_supported_types: Sequence[tf.DType],
      representative_dataset=None,
      signature_key: Optional[str] = None,
      **kwargs,
  ) -> tf.lite.TFLiteConverter:
      """Creates a TFLite converter with proper quantization options.
  
      Currently,
      this supports DYNAMIC_RANGE, FULL_INTEGER and FLOAT16 quantizations.
  
      Args:
        saved_model_path: Path for the TF SavedModel.
        quantization_optimizations: Options for optimizations in quantization. If
          empty, 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.
        representative_dataset: Iterable that provides representative examples
          used for quantization. See
          https://www.tensorflow.org/lite/performance/post_training_quantization
            for details.
        signature_key: Key identifying SignatureDef containing TFLite inputs and
          outputs. (default tf.saved_model.DEFAULT_SERVING_SIGNATURE_DEF_KEY)
        **kwargs: Additional arguments to create tflite converter.
  
      Returns:
        A TFLite converter with the proper flags being set.
  
      Raises:
        NotImplementedError: Raises when full-integer quantization is called.
      """
  
      if signature_key:
          # Need the check here because from_saved_model takes signature_keys list.
          # [None] is not None.
          converter = tf.lite.TFLiteConverter.from_saved_model(
              saved_model_path, signature_keys=[signature_key]
          )
      else:
          converter = tf.lite.TFLiteConverter.from_saved_model(
              saved_model_path
          )
  
      converter.optimizations = quantization_optimizations
      converter.target_spec.supported_types = (
          quantization_supported_types
      )
      converter.representative_dataset = representative_dataset
  
      return converter
  
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 6 for calling the TFLiteRewriter obj's underlying member method code with example usage: obj._create_tflite_converter(saved_model_path, quantization_optimizations, quantization_supported_types, representative_dataset, signature_key) and returns: converter