code: def test_depth_to_space(executor_kind):
      def verify_depth_to_space(dshape, block_size, layout, mode):
          if layout == "NHWC":
              out_shape = [
                  dshape[0],
                  dshape[1] * block_size,
                  dshape[2] * block_size,
                  dshape[3] / (block_size * block_size),
              ]
          else:
              out_shape = [
                  dshape[0],
                  dshape[1] / (block_size * block_size),
                  dshape[2] * block_size,
                  dshape[3] * block_size,
              ]
  
          x_data = np.random.uniform(size=dshape).astype("float32")
          if layout == "NHWC":
              x_data = np.transpose(x_data, axes=[0, 3, 1, 2])
          ref_res = tvm.topi.testing.depth_to_space_python(
              x_data, block_size, mode=mode
          )
          if layout == "NHWC":
              x_data = np.transpose(x_data, axes=[0, 2, 3, 1])
              ref_res = np.transpose(ref_res, axes=[0, 2, 3, 1])
  
          x = relay.var("x", relay.TensorType(dshape, "float32"))
          z = relay.nn.depth_to_space(x, block_size, layout, mode)
          assert "block_size=" in z.astext()
          zz = run_infer_type(z)
          assert zz.checked_type == relay.TensorType(
              ref_res.shape, "float32"
          )
          func = relay.Function([x], z)
  
          for target, dev in tvm.testing.enabled_targets():
              op_res = relay.create_executor(
                  executor_kind, device=dev, target=target
              ).evaluate(func)(x_data)
              tvm.testing.assert_allclose(
                  op_res.numpy(), ref_res, rtol=1e-4
              )
  
      for layout in ["NHWC", "NCHW"]:
          for mode in ["DCR", "CDR"]:
              verify_depth_to_space((1, 4, 4, 4), 2, layout, mode)
  
imports: import math
  import platform
  import sys
  import numpy
  import pytest
  import tvm
  import tvm.testing
  import tvm.topi.testing
  from tvm import relay, te
  from tvm.relay.testing import run_infer_type
label_desc: Use image node_id 13 for calling a global function with example usage: test_depth_to_space(executor_kind) without return types