code: def build_run_compare(
      remote,
      tvm_mod,
      params1,
      input_shape,
      dtypes,
      target="llvm",
      static_mem_scopes=[],
      gpu_preprocess=None,
      stat_file=None,
  ):
      if remote is None:
          target_host = "llvm"
      else:
          target_host = "llvm -mtriple=arm64-linux-android"
  
      if gpu_preprocess:
          tvm_mod_nchwc = gpu_preprocess(tvm_mod)
      else:
          tvm_mod_nchwc = tvm_mod
  
      if stat_file is not None:
          with autotvm.apply_history_best(stat_file):
              with tvm.transform.PassContext(opt_level=3):
                  graph, lib, params = relay.build(
                      tvm_mod_nchwc,
                      target_host=target_host,
                      target=target,
                      params=params1,
                  )
      else:
          with tvm.transform.PassContext(opt_level=3):
              graph, lib, params = relay.build(
                  tvm_mod_nchwc,
                  target_host=target_host,
                  target=target,
                  params=params1,
              )
  
      # verification that storage_scope has expected textures scopes
      graph_json = json.loads(graph)
      if "storage_scope" in graph_json["attrs"]:
          assert (
              len(static_mem_scopes)
              == len(graph_json["attrs"]["storage_scope"][1])
              or len(static_mem_scopes) == 0
          )
      else:
          assert len(static_mem_scopes) == 0
  
      for i in range(0, len(static_mem_scopes)):
          assert (
              static_mem_scopes[i]
              == graph_json["attrs"]["storage_scope"][1][i]
          )
  
      if remote is None:
          ctx = tvm.opencl()
          m = graph_runtime.create(graph, lib, ctx)
      else:
          temp = utils.tempdir()
          dso_binary = "dev_lib_cl.so"
          dso_binary_path = temp.relpath(dso_binary)
          ctx = remote.cl(0)
          lib.export_library(
              dso_binary_path, fcompile=ndk.create_shared
          )
          remote.upload(dso_binary_path)
          rlib = remote.load_module(dso_binary)
          m = graph_runtime.create(graph, rlib, ctx)
      m.set_input(**params)
      inputs = []
      for key in input_shape:
          inputs.append(
              np.random.normal(size=input_shape[key]).astype(
                  dtypes[key]
              )
          )
          m.set_input(key, inputs[-1])
      m.run()
  
      ref_outputs = get_cpu_reference(
          tvm_mod, params1, input_shape, inputs
      )
      for i, ref_output in enumerate(ref_outputs):
          tvm_output = m.get_output(i)
          output = tvm_output.asnumpy()
  
          np.testing.assert_allclose(
              output, ref_output, rtol=1e-1, atol=1e-1
          )
      return graph
  
file_path: tvm/tests/python/relay/opencl_texture/utils/adreno_utils.py
imports: import os
  import tvm
  import numpy
  from tvm import relay
  from tvm import autotvm
  from tvm import rpc
  from tvm.contrib import utils, ndk
  from tvm.relay import testing
  from tvm.relay.transform import recast
  from tvm.contrib import graph_runtime
  from tvm.runtime.vm import VirtualMachine
  import json
label_desc: Use image node_id 2 for calling a global function with example usage: build_run_compare(remote, tvm_mod, params1, input_shape, dtypes, target, static_mem_scopes, gpu_preprocess, stat_file) and returns: graph