code: def verify_avg_pool2d_grad(
      x_shape,
      pool_size,
      strides,
      padding,
      ceil_mode,
      count_include_pad,
      executor_kind,
      dtype="float32",
  ):
      for shape_dtype in ["int32", "int64"]:
          x = relay.var(
              "x",
              shape=[tvm.tir.IntImm(shape_dtype, x) for x in x_shape],
              dtype=dtype,
          )
          y = tvm.relay.nn.avg_pool2d(
              x,
              pool_size=pool_size,
              strides=strides,
              padding=padding,
              ceil_mode=ceil_mode,
              count_include_pad=count_include_pad,
          )
  
          fwd_func = relay.Function([x], y)
          fwd_func = run_infer_type(fwd_func)
          bwd_func = run_infer_type(gradient(fwd_func))
  
          data = np.random.rand(*x_shape).astype(dtype)
          ph, pw = padding
          y_shape = topi.utils.get_const_tuple(fwd_func.ret_type.shape)
          out_grad = np.ones(shape=y_shape)
          ref_grad = tvm.topi.testing.pool_grad_nchw(
              data,
              out_grad,
              pool_size=pool_size,
              strides=strides,
              padding=[ph, pw, ph, pw],
              pool_type="avg",
              ceil_mode=ceil_mode,
          )
  
          for target, dev in tvm.testing.enabled_targets():
              op_res, (op_grad,) = relay.create_executor(
                  executor_kind, device=dev, target=target
              ).evaluate(bwd_func)(data)
              np.testing.assert_allclose(
                  op_grad.numpy(), ref_grad, rtol=0.01
              )
  
imports: import numpy
  import pytest
  from tvm import topi
  import tvm.topi.testing
  import tvm
  from tvm import te
  from tvm import relay
  from tvm.relay.testing import check_grad, run_infer_type, run_opt_pass
  from tvm.relay.transform import gradient
  import tvm.testing
label_desc: Use image node_id 3 for calling a global function with example usage: verify_avg_pool2d_grad(x_shape, pool_size, strides, padding, ceil_mode, count_include_pad, executor_kind, dtype) without return types