Shortcuts

PixelUnshuffle

class torch.nn.PixelUnshuffle(downscale_factor)[source][source]

Reverse the PixelShuffle operation.

Reverses the PixelShuffle operation by rearranging elements in a tensor of shape (,C,H×r,W×r)(*, C, H \times r, W \times r) to a tensor of shape (,C×r2,H,W)(*, C \times r^2, 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)(*, C_{in}, H_{in}, W_{in}), where * is zero or more batch dimensions

  • Output: (,Cout,Hout,Wout)(*, C_{out}, H_{out}, W_{out}), where

Cout=Cin×downscale_factor2C_{out} = C_{in} \times \text{downscale\_factor}^2
Hout=Hin÷downscale_factorH_{out} = H_{in} \div \text{downscale\_factor}
Wout=Win÷downscale_factorW_{out} = W_{in} \div \text{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])

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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy