code: def _test_coreml_model_image_input(
      tf_model_path,
      coreml_model,
      input_tensor_name,
      output_tensor_name,
      img_size,
      useCPUOnly=False,
  ):
      """Test single image input conversions.
      tf_model_path - the TF model
      coreml_model - converted CoreML model
      input_tensor_name - the input image tensor name
      output_tensor_name - the output tensor name
      img_size - size of the image
      """
  
      img_np, img = _load_image(
          TEST_IMAGE, resize_to=(img_size, img_size)
      )
      img_tf = np.expand_dims(img_np, axis=0)
      img_tf[:, :, :, 0] = 2.0 / 255 * img_tf[:, :, :, 0] - 1
      img_tf[:, :, :, 1] = 2.0 / 255 * img_tf[:, :, :, 1] - 1
      img_tf[:, :, :, 2] = 2.0 / 255 * img_tf[:, :, :, 2] - 1
  
      # evaluate the TF model
      tf.reset_default_graph()
      graph_def = graph_pb2.GraphDef()
      with open(tf_model_path, "rb") as f:
          graph_def.ParseFromString(f.read())
      g = tf.import_graph_def(graph_def)
      with tf.Session(graph=g) as sess:
          image_input_tensor = sess.graph.get_tensor_by_name(
              "import/" + input_tensor_name
          )
          output = sess.graph.get_tensor_by_name(
              "import/" + output_tensor_name
          )
          tf_out = sess.run(
              output, feed_dict={image_input_tensor: img_tf}
          )
      if len(tf_out.shape) == 4:
          tf_out = np.transpose(tf_out, (0, 3, 1, 2))
      tf_out_flatten = tf_out.flatten()
  
      # evaluate CoreML
      coreml_input_name = input_tensor_name.replace(":", "__").replace(
          "/", "__"
      )
      coreml_output_name = output_tensor_name.replace(
          ":", "__"
      ).replace("/", "__")
      coreml_input = {coreml_input_name: img}
  
      # Test the default CoreML evaluation
      coreml_out = coreml_model.predict(
          coreml_input, useCPUOnly=useCPUOnly
      )[coreml_output_name]
      coreml_out_flatten = coreml_out.flatten()
      print(coreml_out_flatten)
  
imports: import unittest
  import urllib
  import os
  import tarfile
  import zipfile
  import numpy
  import PIL.Image
  import tensorflow
  from tensorflow.core.framework import graph_pb2
  import tfcoreml
label_desc: Use image node_id 7 for calling a global function with example usage: _test_coreml_model_image_input(tf_model_path, coreml_model, input_tensor_name, output_tensor_name, img_size, useCPUOnly) without return types