code: def test_upstream():
      @te.hybrid.script
      def upstream(a):
          b = output_tensor((20,), "float32")
          for i in range(20):
              b[i] = a[i] * i
          return b
  
      a = te.placeholder((20,), "float32")
      b = te.placeholder((20,), "float32")
      c = te.compute((20,), lambda x: a[x] + b[x])
      d = upstream(c)
      sch = te.create_schedule([c.op, d.op])
      ir = tvm.lower(sch, [a, b, d])
      func = tvm.build(sch, [a, b, d])
      assert func
  
      a = numpy.random.randn(20).astype("float32")
      b = numpy.random.randn(20).astype("float32")
      ref = numpy.zeros((20,), "float32")
      for i in range(20):
          ref[i] = (a[i] + b[i]) * i
  
      tvm_a = tvm.nd.array(a)
      tvm_b = tvm.nd.array(b)
      tvm_d = tvm.nd.array(numpy.zeros((20,)).astype("float32"))
  
      func(tvm_a, tvm_b, tvm_d)
      tvm.testing.assert_allclose(tvm_d.numpy(), ref, 1e-5, 1e-5)
  
imports: import tvm, inspect, sys, traceback, numpy, pytest, types, os
  from tvm import te
  from tvm.contrib import utils
  from tvm.te.hybrid import script
  from tvm.te.hybrid.runtime import HYBRID_GLOBALS
  import tvm.testing
label_desc: Use image node_id 11 for calling a global function with example usage: test_upstream() and returns: b