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 api_nn_vision_PixelShuffle .

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”. 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) – The default value is None. Normally there is no need for user to set this property.

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)
out = out_var.numpy()
print(out.shape)
# (2, 1, 12, 12)