# mx.nd.depth.to.space¶

## Description¶

Rearranges(permutes) data from depth into blocks of spatial data. Similar to ONNX DepthToSpace operator: https://github.com/onnx/onnx/blob/master/docs/Operators.md#DepthToSpace. The output is a new tensor where the values from depth dimension are moved in spatial blocks to height and width dimension. The reverse of this operation is space_to_depth. .. math:: begin{gather*} x prime = reshape(x, [N, block_size, block_size, C / (block_size ^ 2), H * block_size, W * block_size]) \ x prime prime = transpose(x prime, [0, 3, 4, 1, 5, 2]) \ y = reshape(x prime prime, [N, C / (block_size ^ 2), H * block_size, W * block_size]) end{gather*} [batch, channels, height, width] and $$y$$ is the output tensor of layout $$[N, C / (block\_size ^ 2), H * block\_size, W * block\_size]$$

Defined in src/operator/tensor/matrix_op.cc:L972

Example:

x = [[[[0, 1, 2],
[3, 4, 5]],
[[6, 7, 8],
[9, 10, 11]],
[[12, 13, 14],
[15, 16, 17]],
[[18, 19, 20],
[21, 22, 23]]]]
depth_to_space(x, 2) = [[[[0, 6, 1, 7, 2, 8],
[12, 18, 13, 19, 14, 20],
[3, 9, 4, 10, 5, 11],
[15, 21, 16, 22, 17, 23]]]]


## Arguments¶

Argument

Description

data

NDArray-or-Symbol.

Input ndarray

block.size

int, required.

Blocks of [block_size. block_size] are moved

## Value¶

out The result mx.ndarray