L ilbddlmcmZddlmZddlmZddgZGddeZ GddeZ y) N)Tensor)Module PixelShufflePixelUnshufflecZeZdZUdZdgZeed<deddffd ZdedefdZ de fdZ xZ S) raSRearrange elements in a tensor according to an upscaling factor. Rearranges elements in a tensor of shape :math:`(*, C \times r^2, H, W)` to a tensor of shape :math:`(*, C, H \times r, W \times r)`, where r is an upscale factor. This is useful for implementing efficient sub-pixel convolution with a stride of :math:`1/r`. See the paper: `Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network`_ by Shi et al. (2016) for more details. Args: upscale_factor (int): factor to increase spatial resolution by Shape: - Input: :math:`(*, C_{in}, H_{in}, W_{in})`, where * is zero or more batch dimensions - Output: :math:`(*, C_{out}, H_{out}, W_{out})`, where .. math:: C_{out} = C_{in} \div \text{upscale\_factor}^2 .. math:: H_{out} = H_{in} \times \text{upscale\_factor} .. math:: W_{out} = W_{in} \times \text{upscale\_factor} Examples:: >>> 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]) .. _Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network: https://arxiv.org/abs/1609.05158 upscale_factorreturnNc0t|||_yN)super__init__r )selfr __class__s c/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/torch/nn/modules/pixelshuffle.pyrzPixelShuffle.__init__6s ,inputcBtj||jSz( Runs the forward pass. )F pixel_shuffler rrs rforwardzPixelShuffle.forward:sud&9&9::rc d|jS)@ Return the extra representation of the module. zupscale_factor=)r rs r extra_reprzPixelShuffle.extra_repr@s!!4!4 566r __name__ __module__ __qualname____doc__ __constants__int__annotations__rrrstrr __classcell__rs@rrr sK&P&&M-s-t-;V;; 7C7rcZeZdZUdZdgZeed<deddffd ZdedefdZ de fdZ xZ S) raReverse the PixelShuffle operation. Reverses the :class:`~torch.nn.PixelShuffle` operation by rearranging elements in a tensor of shape :math:`(*, C, H \times r, W \times r)` to a tensor of shape :math:`(*, C \times r^2, H, W)`, where r is a downscale factor. See the paper: `Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network`_ by Shi et al. (2016) for more details. Args: downscale_factor (int): factor to decrease spatial resolution by Shape: - Input: :math:`(*, C_{in}, H_{in}, W_{in})`, where * is zero or more batch dimensions - Output: :math:`(*, C_{out}, H_{out}, W_{out})`, where .. math:: C_{out} = C_{in} \times \text{downscale\_factor}^2 .. math:: H_{out} = H_{in} \div \text{downscale\_factor} .. math:: W_{out} = W_{in} \div \text{downscale\_factor} Examples:: >>> 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]) .. _Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network: https://arxiv.org/abs/1609.05158 downscale_factorr Nc0t|||_yr )r rr*)rr*rs rrzPixelUnshuffle.__init__qs  0rrcBtj||jSr)rpixel_unshuffler*rs rrzPixelUnshuffle.forwardus  (=(=>>rc d|jS)rzdownscale_factor=)r*rs rrzPixelUnshuffle.extra_repr{s#4#8#8"9::rrr(s@rrrGsK$L((M111?V?? ;C;r) torch.nn.functionalnn functionalrtorchrmoduler__all__rrrrr6s7 + ,:76:7z8;V8;r