PixelShuffle#
- class torch.nn.modules.pixelshuffle.PixelShuffle(upscale_factor)[原始碼]#
根據上取樣因子重新排列張量中的元素。
將形狀為 的張量重新排列為形狀為 的張量,其中 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])