+
    &jl                     d    ^ RI Hu Ht ^ RIHt ^RIHt RR.t ! R R]4      t	 ! R R]4      t
R# )    NTensor)ModulePixelShufflePixelUnshufflec                   x   a a ] tR t^
t oRtR.tV3R lV 3R lltV3R lR ltV3R lR ltV3R	 lt	R
t
VtV ;t# )r   a  Rearrange 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_factorc                $   < V ^8  d   QhRS[ RR/# )   r	   returnNint)format__classdict__s   "u/Users/jameslopez/projects/CWCArchive/cwc-podcast/.venv/lib/python3.14/site-packages/torch/nn/modules/pixelshuffle.py__annotate__PixelShuffle.__annotate__6   s     - -s -t -    c                0   < \         SV `  4        Wn        R # N)super__init__r	   )selfr	   	__class__s   &&r   r   PixelShuffle.__init__6   s    ,r   c                &   < V ^8  d   QhRS[ RS[ /# r   inputr   r   )r   r   s   "r   r   r   :   s     ; ;V ; ;r   c                B    \         P                  ! WP                  4      # z
Runs the forward pass.
)Fpixel_shuffler	   r   r   s   &&r   forwardPixelShuffle.forward:   s     u&9&9::r   c                    < V ^8  d   QhRS[ /# r   r   str)r   r   s   "r   r   r   @   s     7 7C 7r   c                     RV P                    2# )0
Return the extra representation of the module.
zupscale_factor=r	   r   s   &r   
extra_reprPixelShuffle.extra_repr@   s     !!4!4 566r   c                &   < V ^8  d   Qh/ S[ ;R&   # )r   r	   r   )r   r   s   "r   r   r   
   s     T U r   r,   __name__
__module____qualname____firstlineno____doc____constants__r   r$   r.   __annotate_func____static_attributes____classdictcell____classcell__r   r   s   @@r   r   r   
   s;     &P &&M- -; ;7 7m  r   c                   x   a a ] tR t^Gt oRtR.tV3R lV 3R lltV3R lR ltV3R lR ltV3R	 lt	R
t
VtV ;t# )r   a  Reverse 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_factorc                $   < V ^8  d   QhRS[ RR/# )r   r>   r   Nr   )r   r   s   "r   r   PixelUnshuffle.__annotate__q   s     1 1 1 1r   c                0   < \         SV `  4        Wn        R # r   )r   r   r>   )r   r>   r   s   &&r   r   PixelUnshuffle.__init__q   s     0r   c                &   < V ^8  d   QhRS[ RS[ /# r   r   )r   r   s   "r   r   r@   u   s     ? ?V ? ?r   c                B    \         P                  ! WP                  4      # r    )r!   pixel_unshuffler>   r#   s   &&r   r$   PixelUnshuffle.forwardu   s       (=(=>>r   c                    < V ^8  d   QhRS[ /# r'   r(   )r   r   s   "r   r   r@   {   s     ; ;C ;r   c                     RV P                    2# )r+   zdownscale_factor=r>   r-   s   &r   r.   PixelUnshuffle.extra_repr{   s     #4#8#8"9::r   c                &   < V ^8  d   Qh/ S[ ;R&   # )r   r>   r   )r   r   s   "r   r   r@   G   s     P Q r   rI   r1   r<   s   @@r   r   r   G   s;     $L ((M1 1? ?; ;i  r   )torch.nn.functionalnn
functionalr!   torchr   moduler   __all__r   r    r   r   <module>rS      s7        +
,:76 :7z8;V 8;r   