code: def convert_saved_model_to_int8_tflite(
      saved_model_dir,
      input_shapes,
      representative_dataset,
      calibrated_tflite_file,
  ):
      """Convert SavedModel to int8 quantized TF Lite format.
  
      Args:
        saved_model_dir: str, path to the SavedModel directory.
        input_shapes: dict, input shapes of the SavedModel.
        representative_dataset: function, generator function to feed to
          TFLiteConverter
        calibrated_tflite_file: str, path to export the full int8 quantized TF Lite
          model.
      Returns: (str, str) Path to the exported style predict and style transform
        SavedModel.
      """
  
      converter = tf.lite.TFLiteConverter.from_saved_model(
          saved_model_dir=saved_model_dir, input_shapes=input_shapes
      )
  
      converter.optimizations = [tf.lite.Optimize.DEFAULT]
      converter.representative_dataset = representative_dataset
  
      tflite_full_int8_quantize_model = converter.convert()
      with tf.gfile.GFile(calibrated_tflite_file, "wb") as f:
          f.write(tflite_full_int8_quantize_model)
  
      tf.logging.info(
          "Converted to TF Lite full integer quantized model: %s; Size: %d KB."
          % (
              calibrated_tflite_file,
              len(tflite_full_int8_quantize_model) / 1024,
          )
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import tempfile
  from magenta.models.arbitrary_image_stylization import arbitrary_image_stylization_build_mobilenet_model
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 4 for calling a global function with example usage: convert_saved_model_to_int8_tflite(saved_model_dir, input_shapes, representative_dataset, calibrated_tflite_file) without return types