評價此頁

PixelUnshuffle#

class torch.nn.PixelUnshuffle(downscale_factor)[原始碼]#

PixelShuffle 操作的逆操作。

將形狀為 (,C,H×r,W×r)(*, C, H \times r, W \times r) 的張量進行 PixelShuffle 操作的逆操作,將其重排為形狀為 (,C×r2,H,W)(*, C \times r^2, H, W) 的張量,其中 r 是下采樣因子。

更多細節請參閱論文:Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network,作者 Shi 等人(2016)。

引數

downscale_factor (int) – 用於減小空間解析度的因子

形狀
  • 輸入: (,Cin,Hin,Win)(*, C_{in}, H_{in}, W_{in}),其中 * 表示零個或多個批次維度

  • 輸出: (,Cout,Hout,Wout)(*, C_{out}, H_{out}, W_{out}),其中

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}

示例

>>> 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()[原始碼]#

返回模組的額外表示。

返回型別

str

forward(input)[原始碼]#

執行前向傳播。

返回型別

張量