code: def test_dyn_pad(executor_kind):
      def verify_pad(dshape, pad_width, pad_val, dtype):
          x = relay.var("x", relay.TensorType(dshape, dtype))
          ndim = len(dshape)
          pad_width_var = relay.var(
              "pad_width_var", relay.TensorType((ndim, 2), "int64")
          )
          pad_val_var = relay.var(
              "pad_val_var", relay.TensorType((), dtype)
          )
          y = relay.nn.pad(x, pad_width_var, pad_val_var)
          yy = run_infer_type(y)
  
          assert yy.checked_type == relay.ty.TensorType(
              (relay.Any(),) * ndim, dtype
          )
          func = relay.Function([x, pad_width_var, pad_val_var], y)
          data = np.random.uniform(size=dshape).astype(dtype)
          ref_res = np.pad(
              data,
              pad_width,
              "constant",
              constant_values=(((pad_val,) * 2),) * ndim,
          )
          pad_width = np.array(pad_width).astype("int64")
  
          verify_func(
              executor_kind,
              func,
              [data, pad_width, np.array(pad_val).astype(dtype)],
              ref_res,
          )
  
      def verify_pad_default_fill(dshape, pad_width, dtype):
          x = relay.var("x", relay.TensorType(dshape, dtype))
          ndim = len(dshape)
          pad_width_var = relay.var(
              "pad_width_var", relay.TensorType((ndim, 2), "int64")
          )
          y = relay.nn.pad(x, pad_width_var)
          yy = run_infer_type(y)
  
          assert yy.checked_type == relay.ty.TensorType(
              (relay.Any(),) * ndim, dtype
          )
          func = relay.Function([x, pad_width_var], y)
          data = np.random.uniform(size=dshape).astype(dtype)
          ref_res = np.pad(data, pad_width)
          pad_width = np.array(pad_width).astype("int64")
  
          verify_func(executor_kind, func, [data, pad_width], ref_res)
  
      verify_pad(
          (4, 10, 7, 7), ((1, 1), (2, 2), (3, 3), (4, 4)), 2.0, "int32"
      )
      verify_pad((2, 7), ((1, 4), (2, 2)), 4.0, "float64")
      verify_pad_default_fill(
          (4, 10, 7, 7), ((1, 1), (2, 2), (3, 3), (4, 4)), "float64"
      )
      verify_pad_default_fill((2, 7), ((1, 4), (2, 2)), "int32")
  
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 5 for calling a global function with example usage: test_dyn_pad(executor_kind) without return types