mindspore.mint.nn.functional.pixel_shuffle
- mindspore.mint.nn.functional.pixel_shuffle(input, upscale_factor) Tensor [source]
Rearrange elements in a tensor according to an upscaling factor.
Rearranges elements in a tensor of shape
to a tensor of shape , where r is an upscale factor.This is useful for implementing efficient sub-pixel convolution with a stride of
.For detailed introduction to the pixel_shuffle algorithm, refer to Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network .
Warning
This is an experimental API that is subject to change or deletion.
- Parameters
- Returns
output (Tensor) - Tensor of shape
.
- Raises
ValueError – If upscale_factor is not a positive integer.
ValueError – If the length of third to last dimension is not divisible by the square of upscale_factor.
ValueError – If the dimension of input is less than 3.
- Supported Platforms:
Ascend
Examples
>>> from mindspore import mint >>> input = mint.randn(1, 9, 4, 4) >>> output = mint.nn.functional.pixel_shuffle(input, 3) >>> print(output.shape) (1, 1, 12, 12)