Versioned name: DepthToSpace-1
Category: Data movement
Short description: DepthToSpace operation rearranges data from the depth dimension of the input tensor into spatial dimensions of the output tensor.
Attributes
block_size ^ (len(input.shape) - 2)
.int
[block_size, ..., block_size, new_depth]
[new_depth, block_size, ..., block_size]
string
Inputs
data
- input tensor of any type with rank >= 3. Required.Outputs
[N, C / block_size ^ K, D1 * block_size, D2 * block_size, ..., DK * block_size]
.Detailed description
DepthToSpace operation permutes elements from the input tensor with shape [N, C, D1, D2, ..., DK]
, to the output tensor where values from the input depth dimension (features) C
are moved to spatial blocks in D1
, ..., DK
. Refer to the ONNX* specification for an example of the 4D input tensor case.
The operation is equivalent to the following transformation of the input tensor data
with K
spatial dimensions of shape [N, C, D1, D2, ..., DK]
to Y output tensor. If mode = blocks_first
:
x' = reshape(data, [N, block_size, block_size, ..., block_size, C / (block_size ^ K), D1, D2, ..., DK]) x'' = transpose(x', [0, K + 1, K + 2, 1, K + 3, 2, K + 4, 3, ..., K + (K + 1), K]) y = reshape(x'', [N, C / (block_size ^ K), D1 * block_size, D2 * block_size, D3 * block_size, ..., DK * block_size])
If mode = depth_first
:
x' = reshape(data, [N, C / (block_size ^ K), block_size, block_size, ..., block_size, D1, D2, ..., DK]) x'' = transpose(x', [0, 1, K + 2, 2, K + 3, 3, K + 4, 4, ..., K + (K + 1), K + 1]) y = reshape(x'', [N, C / (block_size ^ K), D1 * block_size, D2 * block_size, D3 * block_size, ..., DK * block_size])
Example