space_to_depth

dragon.vm.tensorflow.nn.space_to_depth(
  input,
  block_size,
  data_format='NHWC',
  name=None
)[source]

Rearrange blocks of spatial data into depth.

Examples:

n, h, w, c, bs = 1, 2, 2, 2, 2
x = tf.range(n * h * w * c).reshape((n, h, w, c))
y = tf.reshape(x, (n, h // bs, bs, w // bs, bs, c))
y = tf.transpose(y, (0, 1, 3, 2, 4, 5))
y = tf.reshape(y, (n, h // bs, w // bs, bs * bs * c))
z = tf.nn.space_to_depth(x, 2)  # Equivalent
Parameters:
  • input (dragon.Tensor) The input tensor.
  • block_size (int, required) The size of spatial block.
  • data_format ({'NCHW', 'NHWC'}, optional) The optional data format.
  • name (str, optional) The operation name.
Returns:

dragon.Tensor The output tensor.