PixelShuffle#
- class torch.nn.PixelShuffle(upscale_factor)[source]#
将张量中的元素按上采样因子重新排列。
将形状为 的张量重新排列为形状为 的张量,其中 r 是上采样因子。
这对于实现步长为 的高效子像素卷积很有用。
更多细节请参阅论文:Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network,作者:Shi 等人 (2016)。
- 参数
upscale_factor (int) – 空间分辨率增加的因子
- 形状
输入:, 其中 * 是零个或多个批处理维度
输出:, 其中
示例
>>> pixel_shuffle = nn.PixelShuffle(3) >>> input = torch.randn(1, 9, 4, 4) >>> output = pixel_shuffle(input) >>> print(output.size()) torch.Size([1, 1, 12, 12])