code: def get_tflite_graph(tf_func, shapes, ranges=None):
      tensor_specs = [
          tf.TensorSpec(shape, dtype=tf.float32) for shape in shapes
      ]
      if not ranges:
          ranges = [(0, 1) for _ in shapes]
      concrete_func = tf_func.get_concrete_function(*tensor_specs)
  
      # Convert the model
      def representative_dataset():
          for _ in range(100):
              inputs = []
              for i, shape in enumerate(shapes):
                  data = np.random.uniform(
                      low=ranges[i][0],
                      high=ranges[i][1],
                      size=tuple(shape),
                  ).astype("float32")
                  inputs.append(data)
  
              yield inputs
  
      converter = tf.lite.TFLiteConverter.from_concrete_functions(
          [concrete_func]
      )
      converter.optimizations = [tf.lite.Optimize.DEFAULT]
      converter.representative_dataset = representative_dataset
      converter.target_spec.supported_ops = [
          tf.lite.OpsSet.TFLITE_BUILTINS_INT8
      ]
      converter.inference_input_type = tf.int8
      converter.inference_output_type = tf.int8
      tflite_graph = converter.convert()
  
      # Get TFLite model from buffer
      try:
          import tflite
  
          tflite_model = tflite.Model.GetRootAsModel(tflite_graph, 0)
      except AttributeError:
          import tflite.Model
  
          tflite_model = tflite.Model.Model.GetRootAsModel(
              tflite_graph, 0
          )
  
      relay_module, params = relay.frontend.from_tflite(tflite_model)
      mod = partition_for_ethosu(relay_module, params)
      return mod, tflite_graph
  
imports: from typing import List
  import os
  import struct
  import numpy
  import math
  from enum import IntEnum
  import tensorflow
  from ethosu.vela.register_command_stream_generator import CmdMode
  from ethosu.vela.register_command_stream_generator import cmd0
  from ethosu.vela.register_command_stream_generator import cmd1
  import tvm
  from tvm import relay
  import tvm.relay.backend.contrib.ethosu.op
  from tvm.topi.nn.utils import get_pad_tuple
  from tvm.relay.expr_functor import ExprMutator
  from tvm.relay.op.annotation import compiler_begin, compiler_end
  from tvm.relay.backend.contrib.ethosu import preprocess
  import tvm.relay.testing.tf
  from tvm import WorkspaceMemoryPools, WorkspacePoolInfo, PoolInfoProperties
  from tvm.relay.op.contrib.ethosu import partition_for_ethosu
  from tvm.testing.aot import AOTCompiledTestModel, AOTDataLinkage, AOTTestModel, AOTTestRunner, compile_models, run_and_check
label_desc: Use image node_id 10 for calling a global function with example usage: get_tflite_graph(tf_func, shapes, ranges) and returns: mod,  tflite_graph