pixel_shuffle

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

This API implements pixel shuffle operation. See more details in PixelSuffle .

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

  • upscale_factor (int) – factor to increase spatial resolution.

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

  • name (str, optional) – Name for the operation (optional, default is None). 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(shape=[2,9,4,4])
>>> out_var = F.pixel_shuffle(x, 3)
>>> print(out_var.shape)
[2, 1, 12, 12]