PixelShuffle#
- class torch.nn.modules.pixelshuffle.PixelShuffle(upscale_factor)[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 . - See the paper: Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network by Shi et al. (2016) for more details. - Parameters
- upscale_factor (int) – factor to increase spatial resolution by 
 - Shape:
- Input: , where * is zero or more batch dimensions 
- Output: , where 
 
 - Examples: - >>> pixel_shuffle = nn.PixelShuffle(3) >>> input = torch.randn(1, 9, 4, 4) >>> output = pixel_shuffle(input) >>> print(output.size()) torch.Size([1, 1, 12, 12])