評價此頁

torch.nn.functional.pixel_unshuffle#

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

反轉 PixelShuffle 操作,透過重排形狀為 (,C,H×r,W×r)(*, C, H \times r, W \times r) 的張量,將其重排為形狀為 (,C×r2,H,W)(*, C \times r^2, H, W) 的張量,其中 r 是 downscale_factor

更多詳情請參閱 PixelUnshuffle

引數
  • input (Tensor) – 輸入張量

  • downscale_factor (int) – 增加空間解析度的因子

示例

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