code: def test_dyn_upsampling_run(executor_kind):
      def verify_upsampling(
          dshape, scale_h, scale_w, layout, method, align_corners=False
      ):
          if layout == "NCHW":
              (n, c, h, w) = dshape
              x_data = np.random.uniform(size=(n, c, h, w)).astype(
                  "float32"
              )
  
          elif layout == "NHWC":
              (n, h, w, c) = dshape
              x_data = np.random.uniform(size=(n, h, w, c)).astype(
                  "float32"
              )
  
          ref_res = tvm.topi.testing.resize2d_python(
              x_data,
              (scale_h, scale_w),
              layout,
              method[2:] if method[0:2] == "bi" else method,
              "align_corners" if align_corners else "asymmetric",
          )
          x = relay.Var("x", relay.TensorType(dshape, "float32"))
          scale_h_var = relay.var(
              "scale_h", relay.TensorType((), "float32")
          )
          scale_w_var = relay.var(
              "scale_h", relay.TensorType((), "float32")
          )
  
          z = relay.nn.upsampling(
              x,
              scale_h_var,
              scale_w_var,
              method=method,
              layout=layout,
              align_corners=align_corners,
          )
          zz = run_infer_type(z)
          func = relay.Function([x, scale_h_var, scale_w_var], z)
  
          for target, dev in tvm.testing.enabled_targets():
              mod = tvm.ir.IRModule.from_expr(func)
              op_res = relay.create_executor(
                  executor_kind, mod=mod, device=dev, target=target
              ).evaluate()(
                  x_data,
                  np.array(scale_h).astype("float32"),
                  np.array(scale_w).astype("float32"),
              )
              tvm.testing.assert_allclose(
                  op_res.numpy(), ref_res, rtol=1e-4, atol=1e-6
              )
  
      verify_upsampling(
          (1, 16, 32, 32), 3, 2.0, "NCHW", "nearest_neighbor"
      )
      verify_upsampling(
          (1, 16, 32, 32), 5, 2.0, "NCHW", "bilinear", True
      )
      verify_upsampling(
          (1, 16, 32, 32), 2.0, 6, "NHWC", "nearest_neighbor"
      )
      verify_upsampling(
          (1, 16, 32, 32), 2.0, 2.0, "NHWC", "bilinear", True
      )
  
file_path: tvm/tests/python/relay/dyn/test_dynamic_op_level2.py
imports: import numpy
  import tvm
  from tvm import relay
  from tvm import te
  from tvm.relay.testing import enabled_targets
  import random
  from test_dynamic_op_level3 import verify_func
  import tvm.topi.testing
  from tvm.relay.testing import run_infer_type
label_desc: Use image node_id 1 for calling a global function with example usage: test_dyn_upsampling_run(executor_kind) without return types