
    '}h                     D    d dl mZ ddlmZ ddlmZ dgZ G d de      Zy)	   )Module   )
functional    )TensorChannelShufflec                   Z     e Zd ZU dZdgZeed<   deddf fdZdedefdZ	de
fdZ xZS )	r   a  Divides and rearranges the channels in a tensor.

    This operation divides the channels in a tensor of shape :math:`(*, C , H, W)`
    into g groups and rearranges them as :math:`(*, \frac{C}{g}, g, H, W)`,
    while keeping the original tensor shape.

    Args:
        groups (int): number of groups to divide channels in.

    Examples::

        >>> # xdoctest: +IGNORE_WANT("FIXME: incorrect want")
        >>> channel_shuffle = nn.ChannelShuffle(2)
        >>> input = torch.randn(1, 4, 2, 2)
        >>> print(input)
        [[[[1, 2],
           [3, 4]],
          [[5, 6],
           [7, 8]],
          [[9, 10],
           [11, 12]],
          [[13, 14],
           [15, 16]],
         ]]
        >>> output = channel_shuffle(input)
        >>> print(output)
        [[[[1, 2],
           [3, 4]],
          [[9, 10],
           [11, 12]],
          [[5, 6],
           [7, 8]],
          [[13, 14],
           [15, 16]],
         ]]
    groupsreturnNc                 0    t         |           || _        y N)super__init__r
   )selfr
   	__class__s     ^/var/www/html/test/engine/venv/lib/python3.12/site-packages/torch/nn/modules/channelshuffle.pyr   zChannelShuffle.__init__1   s        inputc                 B    t        j                  || j                        S r   )Fchannel_shuffler
   )r   r   s     r   forwardzChannelShuffle.forward5   s      44r   c                      d| j                    S )Nzgroups=)r
   )r   s    r   
extra_reprzChannelShuffle.extra_repr8   s    &&r   )__name__
__module____qualname____doc____constants__int__annotations__r   r   r   strr   __classcell__)r   s   @r   r   r      sI    #J JMKs t 5V 5 5'C 'r   N)	moduler    r   r   torchr   __all__r    r   r   <module>r)      s"      
1'V 1'r   