code: def test_tflite_unpack(ifm_shape, axis):
      dtype = "int8"
  
      def create_tflite_graph():
          class Model(tf.Module):
              @tf.function
              def tf_function(self, x, axis):
                  return tf.unstack(x, axis=axis)
  
          model = Model()
          concrete_func = model.tf_function.get_concrete_function(
              tf.TensorSpec(ifm_shape, tf.float32), axis
          )
  
          def representative_dataset():
              for _ in range(100):
                  data = np.random.rand(*tuple(ifm_shape))
                  yield [data.astype(np.float32)]
  
          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_model = converter.convert()
  
          return tflite_model
  
      def verify(ext_func):
          outputs = ext_func.body.args[0].fields
          shape = list(ifm_shape)
          unpacked_shape = shape[:axis] + shape[axis + 1 :]
          split_shape = shape[:axis] + [1] + shape[axis + 1 :]
  
          assert len(outputs) == shape[axis]
  
          for i, output in enumerate(outputs):
              expr = output.args[0].args[0]
              expr = expr.tuple_value[expr.index]
              expr = expr.args[0]
  
              # Checking expected unpacked output shape.
              # Squeeze is legalized to a reshape.
              assert expr.op.name == "reshape"
              assert list(expr.checked_type.shape) == unpacked_shape
              assert output.checked_type.dtype == dtype
  
              expr = expr.args[0]
              expr = expr.tuple_value[expr.index]
              expr = expr.args[0]
  
              # Check input is split correctly
              assert list(expr.args[0].checked_type.shape) == shape
              assert list(expr.checked_type.shape) == split_shape
              assert expr.checked_type.dtype == dtype
  
              # Check split attrs
              begin_shape = [0] * len(ifm_shape)
              begin_shape[axis] = i
              assert list(expr.attrs.begin) == begin_shape
              end_shape = shape[:axis] + [i + 1] + shape[axis + 1 :]
              assert list(expr.attrs.end) == end_shape
              assert list(expr.attrs.strides) == [1]
  
      pack_pattern_table = [
          (
              ethosu.SplitParams.composite_name,
              ethosu.split_pattern(),
              lambda pat: ethosu.SplitParams(pat).is_valid(),
          ),
          (
              ethosu.SqueezeParams.composite_name,
              ethosu.squeeze_pattern(),
              lambda pat: ethosu.SqueezeParams(pat).is_valid(),
          ),
          (
              ethosu.ReshapeParams.composite_name,
              ethosu.reshape_pattern(),
              lambda pat: ethosu.ReshapeParams(pat).is_valid(),
          ),
      ]
  
      tflite_graph = create_tflite_graph()
      tflite_model = tflite.Model.Model.GetRootAsModel(tflite_graph, 0)
  
      mod, _ = relay.frontend.from_tflite(
          tflite_model,
          shape_dict={"input": ifm_shape},
          dtype_dict={"input": dtype},
      )
      mod = partition_ethosu_by_table(mod, pack_pattern_table)
  
      seq = [
          legalize.PartitionedSplitRewriter(),
          legalize.SplitRewriter(),
          legalize.SqueezeRewriter(),
          legalize.ReshapeRewriter(),
          legalize.NoOpRewriter(),
      ]
      for legalizer in seq:
          mod[
              "tvmgen_default_ethos_u_main_0"
          ] = dataflow_pattern.rewrite(
              legalizer, mod["tvmgen_default_ethos_u_main_0"]
          )
      mod[
          "tvmgen_default_ethos_u_main_0"
      ] = relay.transform.InferType()(mod)[
          "tvmgen_default_ethos_u_main_0"
      ]
      verify(mod["tvmgen_default_ethos_u_main_0"])
  
imports: import pytest
  import math
  import numpy
  import tensorflow
  import tflite.Model
  import tvm
  from tvm import relay
  from tvm.relay.backend.contrib.ethosu import legalize, preprocess
  from tvm.relay import dataflow_pattern
  from tvm.relay.op.contrib import ethosu
  from tvm.relay.backend.contrib.ethosu import util, codegen
  from tvm.relay.build_module import bind_params_by_name
  from tvm.relay.frontend.tflite import get_pad_value
  from tvm.relay.expr_functor import ExprVisitor
  from .None import infra
label_desc: Use image node_id 37 for calling a global function with example usage: test_tflite_unpack(ifm_shape, axis) and returns: tflite_model, tf