Rate this Page
โ˜… โ˜… โ˜… โ˜… โ˜…

torch.nn.functional.pixel_unshuffle#

torch.nn.functional.pixel_unshuffle(input, downscale_factor) โ†’ Tensor#

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 the downscale_factor.

See PixelUnshuffle for details.

Parameters
  • input (Tensor) โ€“ the input tensor

  • downscale_factor (int) โ€“ factor to increase spatial resolution by

Examples:

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