class_docstr: Test cases for unary operators.
class_docstr_tok: ["Test","cases","for","unary","operators","."]
code: def testDepthToSpace(self):
      def make_op(data_format):
          def op(x):
              return array_ops.depth_to_space(
                  x, block_size=2, data_format=data_format
              )
  
          return op
  
      for dtype in self.numeric_types:
          for data_format in ["NCHW", "NHWC"]:
              self._assertOpOutputMatchesExpected(
                  make_op(data_format),
                  nhwc_to_format(
                      np.array([[[[1, 2, 3, 4]]]], dtype=dtype),
                      data_format,
                  ),
                  expected=nhwc_to_format(
                      np.array([[[[1], [2]], [[3], [4]]]], dtype=dtype),
                      data_format,
                  ),
              )
  
              self._assertOpOutputMatchesExpected(
                  make_op(data_format),
                  nhwc_to_format(
                      np.array(
                          [[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]],
                          dtype=dtype,
                      ),
                      data_format,
                  ),
                  expected=nhwc_to_format(
                      np.array(
                          [
                              [
                                  [[1, 2, 3], [4, 5, 6]],
                                  [[7, 8, 9], [10, 11, 12]],
                              ]
                          ],
                          dtype=dtype,
                      ),
                      data_format,
                  ),
              )
  
              self._assertOpOutputMatchesExpected(
                  make_op(data_format),
                  nhwc_to_format(
                      np.array(
                          [
                              [
                                  [[1, 2, 3, 4], [5, 6, 7, 8]],
                                  [[9, 10, 11, 12], [13, 14, 15, 16]],
                              ]
                          ],
                          dtype=dtype,
                      ),
                      data_format,
                  ),
                  expected=nhwc_to_format(
                      np.array(
                          [
                              [
                                  [[1], [2], [5], [6]],
                                  [[3], [4], [7], [8]],
                                  [[9], [10], [13], [14]],
                                  [[11], [12], [15], [16]],
                              ]
                          ],
                          dtype=dtype,
                      ),
                      data_format,
                  ),
              )
  
          self._assertOpOutputMatchesExpected(
              make_op("NCHW_VECT_C"),
              np.arange(32, dtype=dtype).reshape((1, 8, 1, 1, 4)),
              expected=np.array(
                  [
                      [
                          [
                              [[0, 1, 2, 3], [8, 9, 10, 11]],
                              [[16, 17, 18, 19], [24, 25, 26, 27]],
                          ],
                          [
                              [[4, 5, 6, 7], [12, 13, 14, 15]],
                              [[20, 21, 22, 23], [28, 29, 30, 31]],
                          ],
                      ]
                  ],
                  dtype=dtype,
              ),
          )
  
imports: import platform
  import unittest
  import numpy
  import six
  from tensorflow.compiler.tests import xla_test
  from tensorflow.python.framework import dtypes
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import array_ops_stack
  from tensorflow.python.ops import bitwise_ops
  from tensorflow.python.ops import gen_functional_ops
  from tensorflow.python.ops import gen_nn_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.platform import googletest
label_desc: Use image node_id 30 for calling the UnaryOpsTest obj's underlying member method code with example usage: obj.testDepthToSpace() and returns: op, array_ops