code: def test_basic_build():
      tgt = "llvm"
      dev = tvm.cpu()
      # func
      a = relay.var("a", dtype="float32", shape=(16, 8))
      b = relay.var("b", dtype="float32", shape=(8, 8))
      c = relay.var("c", dtype="float32", shape=(16, 8))
      x = relay.nn.dense(a, b)
      y = relay.nn.relu(x)
      z = y + c
      func = relay.Function([a, b, c], z)
      A = tvm.nd.array(
          np.random.uniform(-1, 1, (16, 8)).astype("float32"),
          device=dev,
      )
      B = tvm.nd.array(
          np.random.uniform(-1, 1, (8, 8)).astype("float32"), device=dev
      )
      C = tvm.nd.array(
          np.random.uniform(-1, 1, (16, 8)).astype("float32"),
          device=dev,
      )
      params = {"b": B, "c": C}
      # build
      targets = {tvm.tir.IntImm("int32", dev.device_type): tgt}
      mod = tvm.IRModule.from_expr(func)
      func_in_mod = mod["main"]
      assert (
          mod["main"] == func_in_mod
      ), "cannot compare function to itself"
  
      lib = relay.build(mod, targets, "llvm", params=params)
      assert (
          mod["main"] == func_in_mod
      ), "relay.build changed module in-place"
  
      # test
      rt = tvm.contrib.graph_executor.GraphModule(lib["default"](dev))
      rt.set_input("a", A)
      rt.run()
      out = rt.get_output(0)
  
      np.testing.assert_allclose(
          out.numpy(),
          np.maximum(np.dot(A.numpy(), B.numpy().T), 0) + C.numpy(),
          atol=1e-5,
          rtol=1e-5,
      )
  
file_path: tvm/tests/python/relay/test_cpp_build_module.py
imports: import numpy
  import tvm
  from tvm import te
  from tvm import relay, runtime
  from tvm.contrib.nvcc import have_fp16
  import tvm.testing
label_desc: Use image node_id 1 for calling a global function with example usage: test_basic_build() without return types