Pixel Unshuffle
- 类torch.nn.PixelUnshuffle(downscale_factor)[源代码]
-
执行 PixelShuffle 操作的逆操作。
通过重新排列形状为$(*, C, H \times r, W \times r)$的张量中的元素,并将其转换为形状为$(*, C \times r^2, H, W)$的张量,从而反转
PixelShuffle
操作。其中r是缩小因子。参见 Shi 等人于 2016 年发表的论文《使用高效的子像素卷积神经网络进行实时单图像和视频超分辨率》(Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network),了解更多详细信息。
- 参数
-
downscale_factor (int) – 降低空间分辨率的因子
- 形状:
-
-
输入: $(*, C_{in}, H_{in}, W_{in})$,其中 * 代表零个或多个批次维度
-
输出为 $(*, C_{\text{out}}, H_{\text{out}}, W_{\text{out}})$,其中
-
$C_{out} = C_{in} \times \text{downscale\_factor}^2$$H_{out} = H_{in} \div \text{downscale\_factor}$$W_{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])