Rate this Page

PixelUnshuffle#

class torch.nn.modules.pixelshuffle.PixelUnshuffle(downscale_factor)[source]#

Reverse the PixelShuffle operation.

Reverses the PixelShuffle operation by rearranging elements in a tensor of shape (,C,H×r,W×r) to a tensor of shape (,C×r2,H,W), where r is a downscale factor.

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

downscale_factor (int) – factor to decrease spatial resolution by

Shape:
  • Input: (,Cin,Hin,Win), where * is zero or more batch dimensions

  • Output: (,Cout,Hout,Wout), where

Cout=Cin×downscale_factor2
Hout=Hin÷downscale_factor
Wout=Win÷downscale_factor

Examples:

>>> pixel_unshuffle = nn.PixelUnshuffle(3)
>>> input = torch.randn(1, 1, 12, 12)
>>> output = pixel_unshuffle(input)
>>> print(output.size())
torch.Size([1, 9, 4, 4])
extra_repr()[source]#

Return the extra representation of the module.

Return type

str

forward(input)[source]#

Runs the forward pass.

Return type

Tensor

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources
Morty Proxy This is a proxified and sanitized view of the page, visit original site.