code: def verify_space_to_depth(
      block_size, batch, in_channel, in_height, in_width, layout="NCHW"
  ):
      out_channel = int(in_channel * (block_size * block_size))
      out_height = int(in_height / block_size)
      out_width = int(in_width / block_size)
  
      if layout == "NCHW":
          in_shape = [batch, in_channel, in_height, in_width]
          out_shape = [batch, out_channel, out_height, out_width]
      elif layout == "NHWC":
          in_shape = [batch, in_height, in_width, in_channel]
          out_shape = [batch, out_height, out_width, out_channel]
      else:
          raise NotImplementedError(
              "Layout not supported {}".format(layout)
          )
  
      A = te.placeholder(in_shape, name="A", dtype="float32")
      dtype = A.dtype
      a_np = np.random.uniform(size=in_shape).astype(dtype)
  
      B = topi.nn.space_to_depth(
          A, block_size=block_size, layout=layout
      )
      if layout == "NHWC":
          a_np = np.transpose(a_np, axes=[0, 3, 1, 2])
      b_np = tvm.topi.testing.space_to_depth_python(a_np, block_size)
      if layout == "NHWC":
          a_np = np.transpose(a_np, axes=[0, 2, 3, 1])
          b_np = np.transpose(b_np, axes=[0, 2, 3, 1])
  
      def check_device(device, dev):
          print("Running on target: %s" % device)
          with tvm.target.Target(device):
              s = tvm.topi.testing.get_injective_schedule(device)(B)
          a = tvm.nd.array(a_np, dev)
          b = tvm.nd.array(np.zeros(out_shape, dtype=dtype), dev)
          f = tvm.build(s, [A, B], device)
          f(a, b)
          tvm.testing.assert_allclose(
              b.numpy(), b_np, rtol=1e-3, atol=1e-3
          )
  
      for device, dev in tvm.testing.enabled_targets():
          check_device(device, dev)
  
file_path: tvm/tests/python/topi/test_topi_space_to_depth.py
imports: import numpy
  import tvm
  from tvm import te
  from tvm import topi
  import tvm.testing
  import tvm.topi.testing
label_desc: Use image node_id 1 for calling a global function with example usage: verify_space_to_depth(block_size, batch, in_channel, in_height, in_width, layout) without return types