pixel_unshuffle

paddle.nn.functional. pixel_unshuffle ( x, downscale_factor, data_format='NCHW', name=None ) [source]

This API implements pixel unshuffle operation. See more details in api_nn_vision_PixelUnshuffle .

Parameters
  • x (Tensor) – 4-D tensor, the data type should be float32 or float64.

  • downscale_factor (int) – Factor to decrease spatial resolution.

  • data_format (str, optional) – The data format of the input and output data. An optional string of NCHW or NHWC. The default is NCHW. When it is NCHW, the data is stored in the order of [batch_size, input_channels, input_height, input_width].

  • name (str, optional) – Name for the operation (optional, default is None). Normally there is no need for user to set this property. For more information, please refer to Name.

Returns

Reshaped tensor according to the new dimension.

Return type

Out (Tensor)

Examples

import paddle
import paddle.nn.functional as F
x = paddle.randn([2, 1, 12, 12])
out = F.pixel_unshuffle(x, 3)
print(out.shape)
# [2, 9, 4, 4]