a
    ßñh¿  ã                   @   s,   d dl mZ ddlmZ G dd„ deƒZdS )é   )ÚModuleé   )Ú
functionalc                       s6   e Zd ZdZdgZ‡ fdd„Zdd„ Zdd„ Z‡  ZS )	ÚChannelShufflea/  Divide the channels in a tensor of shape :math:`(*, C , H, W)`
    into g groups and rearrange them as :math:`(*, C \frac g, g, H, W)`,
    while keeping the original tensor shape.

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

    Examples::

        >>> 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]],
         ]]
    Úgroupsc                    s   t t| ƒ ¡  || _d S ©N)Úsuperr   Ú__init__r   )Úselfr   ©Ú	__class__© ú_/home/yuhw/wc/uboone-dl-vtx/venv/lib/python3.9/site-packages/torch/nn/modules/channelshuffle.pyr	   )   s    zChannelShuffle.__init__c                 C   s   t  || j¡S r   )ÚFZchannel_shuffler   )r
   Úinputr   r   r   Úforward-   s    zChannelShuffle.forwardc                 C   s   d  | j¡S )Nz	groups={})Úformatr   )r
   r   r   r   Ú
extra_repr0   s    zChannelShuffle.extra_repr)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Z__constants__r	   r   r   Ú__classcell__r   r   r   r   r      s
   !r   N)Úmoduler   Ú r   r   r   r   r   r   r   Ú<module>   s   