code: def depthToSpaceUsingTranspose(self, tensor, block_size, data_format):
      block_size_sq = block_size * block_size
      if data_format == "NHWC":
          b, ih, iw, ic = tensor.shape.as_list()
          assert ic % block_size_sq == 0, (ic, block_size_sq)
          ow, oh, oc = (
              iw * block_size,
              ih * block_size,
              ic // block_size_sq,
          )
          tensor = array_ops.reshape(
              tensor, [b, ih, iw, block_size, block_size, oc]
          )
          tensor = array_ops.transpose(tensor, [0, 1, 3, 2, 4, 5])
          tensor = array_ops.reshape(tensor, [b, oh, ow, oc])
      elif data_format == "NCHW":
          b, ic, ih, iw = tensor.shape.as_list()
          assert ic % block_size_sq == 0, (ic, block_size_sq)
          ow, oh, oc = (
              iw * block_size,
              ih * block_size,
              ic // block_size_sq,
          )
          tensor = array_ops.reshape(
              tensor, [b, block_size, block_size, oc, ih, iw]
          )
          tensor = array_ops.transpose(tensor, [0, 3, 4, 1, 5, 2])
          tensor = array_ops.reshape(tensor, [b, oc, oh, ow])
      return tensor
  
imports: from absl.testing import parameterized
  import numpy
  from tensorflow.python.client import device_lib
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_array_ops
  from tensorflow.python.ops import gradient_checker
  from tensorflow.python.ops import math_ops
  from tensorflow.python.platform import test
  from tensorflow.python.platform import tf_logging
label_desc: Use image node_id 17 for calling the DepthToSpaceTest obj's underlying member method code with example usage: obj.depthToSpaceUsingTranspose(tensor, block_size, data_format) and returns: tensor