
    JTh                     J    S SK Js  Jr  S SKJr  SSKJr  S/r " S S\5      r	g)    N)Tensor   )ModuleChannelShufflec                   j   ^  \ rS rSr% SrS/r\\S'   S\SS4U 4S jjrS\	S\	4S jr
S\4S	 jrS
rU =r$ )r   
   a  Divides and rearranges the channels in a tensor.

This operation divides the channels in a tensor of shape :math:`(N, C, *)`
into g groups as :math:`(N, \frac{C}{g}, g, *)` and shuffles them,
while retaining the original tensor shape in the final output.

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

Examples::

    >>> channel_shuffle = nn.ChannelShuffle(2)
    >>> input = torch.arange(1, 17, dtype=torch.float32).view(1, 4, 2, 2)
    >>> input
    tensor([[[[ 1.,  2.],
              [ 3.,  4.]],
             [[ 5.,  6.],
              [ 7.,  8.]],
             [[ 9., 10.],
              [11., 12.]],
             [[13., 14.],
              [15., 16.]]]])
    >>> output = channel_shuffle(input)
    >>> output
    tensor([[[[ 1.,  2.],
              [ 3.,  4.]],
             [[ 9., 10.],
              [11., 12.]],
             [[ 5.,  6.],
              [ 7.,  8.]],
             [[13., 14.],
              [15., 16.]]]])
groupsreturnNc                 .   > [         TU ]  5         Xl        g N)super__init__r	   )selfr	   	__class__s     W/var/www/auris/envauris/lib/python3.13/site-packages/torch/nn/modules/channelshuffle.pyr   ChannelShuffle.__init__0   s        inputc                 B    [         R                  " XR                  5      $ r   )Fchannel_shuffler	   )r   r   s     r   forwardChannelShuffle.forward4   s      44r   c                      SU R                    3$ )Nzgroups=r	   )r   s    r   
extra_reprChannelShuffle.extra_repr7   s    &&r   r   )__name__
__module____qualname____firstlineno____doc____constants__int__annotations__r   r   r   strr   __static_attributes____classcell__)r   s   @r   r   r   
   sN     D JMKs t 5V 5 5'C ' 'r   )
torch.nn.functionalnn
functionalr   torchr   moduler   __all__r    r   r   <module>r0      s'        
.'V .'r   