code: def main(unused_argv=None):
      tf.logging.set_verbosity(tf.logging.INFO)
  
      # Load model weights from trained checkpoint, and export to SavedModel format
      (
          predict_saved_model_folder,
          transform_saved_model_folder,
      ) = export_to_saved_model(
          os.path.expanduser(FLAGS.checkpoint), FLAGS.alpha
      )
  
      # Define output TF Lite models path
      output_dir = os.path.expanduser(FLAGS.output_dir)
      if tf.io.gfile.isdir(output_dir):
          tf.logging.warn("Folder %s already existed." % output_dir)
      else:
          os.mkdir(output_dir)
  
      # Convert from SavedModel to TensorFlow Lite format
      predict_float_tflite_file = os.path.join(
          output_dir, "style_predict.tflite"
      )
      predict_weight_quantized_tflite_file = os.path.join(
          output_dir, "style_predict_quantized.tflite"
      )
      predict_weight_calibrated_tflite_file = os.path.join(
          output_dir, "style_predict_calibrated.tflite"
      )
      tranform_float_tflite_file = os.path.join(
          output_dir, "style_transform.tflite"
      )
      tranform_weight_quantized_tflite_file = os.path.join(
          output_dir, "style_transform_quantized.tflite"
      )
      tranform_weight_calibrated_tflite_file = os.path.join(
          output_dir, "style_transform_calibrated.tflite"
      )
  
      # Convert the SavedModels to float and weight quantized TF Lite models
      convert_saved_model_to_tflite(
          saved_model_dir=predict_saved_model_folder,
          input_shapes={
              "style_image": [
                  None,
                  FLAGS.image_size,
                  FLAGS.image_size,
                  3,
              ]
          },
          float_tflite_file=predict_float_tflite_file,
          quantized_tflite_file=predict_weight_quantized_tflite_file,
      )
  
      convert_saved_model_to_tflite(
          saved_model_dir=transform_saved_model_folder,
          input_shapes={
              "content_image": [
                  None,
                  FLAGS.image_size,
                  FLAGS.image_size,
                  3,
              ]
          },
          float_tflite_file=tranform_float_tflite_file,
          quantized_tflite_file=tranform_weight_quantized_tflite_file,
      )
  
      if (FLAGS.style_dataset_file is not None) and (
          FLAGS.imagenet_data_dir is not None
      ):
          with tf.Session(graph=tf.Graph()) as sess:
              # The training dataset is provided, so we'll do full int8 quantization
              predict_representative_dataset_size = 100
              transform_representative_dataset_size = 300
  
              style_dataset, content_dataset = get_calibration_dataset(
                  image_size=FLAGS.image_size,
                  style_dataset_file=FLAGS.style_dataset_file,
                  imagenet_data_dir=FLAGS.imagenet_data_dir,
              )
  
              predict_representative_dataset = predict_model_gen(
                  session=sess,
                  style_dataset=style_dataset,
                  sample_count=predict_representative_dataset_size,
              )
  
              transform_representative_dataset = transform_model_gen(
                  session=sess,
                  predict_saved_model=predict_saved_model_folder,
                  style_dataset=style_dataset,
                  content_dataset=content_dataset,
                  sample_count=transform_representative_dataset_size,
              )
  
              # Convert predict model
              convert_saved_model_to_int8_tflite(
                  saved_model_dir=predict_saved_model_folder,
                  input_shapes={
                      "style_image": [
                          None,
                          FLAGS.image_size,
                          FLAGS.image_size,
                          3,
                      ]
                  },
                  representative_dataset=predict_representative_dataset,
                  calibrated_tflite_file=predict_weight_calibrated_tflite_file,
              )
  
              # Convert transform model
              convert_saved_model_to_int8_tflite(
                  saved_model_dir=transform_saved_model_folder,
                  input_shapes={
                      "content_image": [
                          None,
                          FLAGS.image_size,
                          FLAGS.image_size,
                          3,
                      ]
                  },
                  representative_dataset=transform_representative_dataset,
                  calibrated_tflite_file=tranform_weight_calibrated_tflite_file,
              )
  
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 11 for calling a global function with example usage: main(unused_argv) without return types