code: def get_tvm_output(
      func,
      x,
      params,
      target,
      device,
      out_shape=(1, 1000),
      input_name="image",
      dtype="float32",
  ):
      """Generic function to execute and get tvm output"""
      with tvm.transform.PassContext(opt_level=3):
          lib = relay.build(func, target, params=params)
      m = graph_executor.GraphModule(lib["default"](device))
      # set inputs
      m.set_input(input_name, tvm.nd.array(x.astype(dtype)))
      m.run()
      # get outputs
      out = m.get_output(0, tvm.nd.empty(out_shape, dtype))
      return out.numpy()
  
imports: from os import path
  from enum import Enum
  import tempfile
  import numpy
  import model_zoo
  import coremltools
  from coremltools.models.neural_network import NeuralNetworkBuilder
  from coremltools.models import datatypes
  from tensorflow import keras
  import tvm
  import tvm.topi.testing
  import tvm.testing
  from tvm.contrib import graph_executor
  from tvm.topi.testing import conv2d_nchw_python
  from tvm import relay
label_desc: Use image node_id 1 for calling a global function with example usage: get_tvm_output(func, x, params, target, device, out_shape, input_name, dtype) and returns: out