code: def test_resize2d(executor_kind):
      def verify_resize2d(dshape, scale, method, layout):
          if layout == "NHWC":
              size = (dshape[1] * scale, dshape[2] * scale)
          else:
              size = (dshape[2] * scale, dshape[3] * scale)
          size = np.array(size).astype("int64")
          x_data = np.random.uniform(size=dshape).astype("float32")
  
          x = relay.var("x", relay.TensorType(dshape, "float32"))
          size_var = relay.var("size", relay.TensorType((2,), "int64"))
  
          coord_trans = (
              "asymmetric"
              if method == "nearest_neighbor"
              else "align_corners"
          )
          z = relay.image.resize2d(
              x,
              size_var,
              None,
              layout,
              method,
              coordinate_transformation_mode=coord_trans,
          )
  
          zz = run_infer_type(z)
          func = relay.Function([x, size_var], z)
  
          ref_res = tvm.topi.testing.resize2d_python(
              x_data, (scale, scale), layout, method, coord_trans
          )
  
          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, size)
              tvm.testing.assert_allclose(
                  op_res.numpy(), ref_res, rtol=1e-4, atol=1e-6
              )
  
      for method in ["linear", "nearest_neighbor"]:
          for layout in ["NCHW", "NHWC"]:
              verify_resize2d((1, 4, 4, 4), 2, method, layout)
              verify_resize2d((2, 8, 17, 20), 7, method, layout)
  
file_path: tvm/tests/python/relay/dyn/test_dynamic_op_level5.py
imports: import math
  import numpy
  import tvm
  from tvm import te
  from tvm import relay
  from tvm.relay import transform
  from tvm.relay.testing import run_infer_type
  import tvm.topi.testing
  import tvm.testing
label_desc: Use image node_id 2 for calling a global function with example usage: test_resize2d(executor_kind) without return types