space_to_depth¶
- dragon.nn.- space_to_depth(
 inputs,
 block_size,
 mode='DCR',
 data_format='NCHW',
 copy=True,
 **kwargs
 )[source]¶
- Rearrange blocks of spatial data into depth. - Examples: - n, c, h, w, bs = 1, 2, 2, 2, 2 x = dragon.range(n * c * h * w).reshape((n, c, h, w)) y = dragon.reshape(x, (n, c, h // bs, bs, w // bs, bs)) y = dragon.transpose(y, (0, 3, 5, 1, 2, 4)) y = dragon.reshape(y, (n, (bs ** 2) * c, h // bs, w // bs)) z = dragon.nn.space_to_depth(x, 2) # Equivalent - Parameters:
- inputs (dragon.Tensor) – The input tensor.
- block_size (int, required) – The size of spatial block.
- mode (str, optional, default='DCR') – Rearrangement order for 'NCHW'format.
- data_format (str, optional, default='NCHW') – 'NCHW'or'NHWC'.
- copy (bool, optional, default=True) – Return a new tensor or call in-place.
 
 - Returns:
- dragon.Tensor – The output tensor. 
 
