快捷方式

PixelUnshuffle

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

反转 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 是一个下采样因子。

更多详情请参见 Shi 等人 (2016) 的论文:使用高效亚像素卷积神经网络的实时单图像和视频超分辨率 (Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network)

参数

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])

文档

查阅 PyTorch 的全面开发者文档

查看文档

教程

获取面向初学者和高级开发者的深度教程

查看教程

资源

查找开发资源并获得问题解答

查看资源