Ë
    M²jÂG  ã                   ó   — d dl Z d dlZd dlmZ d dlmZ d dlmZmZ ddœd„Z	d„ Z
ej                  fd„Zd ej                  fd„Zd ej                  fd	„Zej                  ej                  fd
„Zej                  ej                  fd„Zej                  fd„Zej                  fd„Zej                  fd„Zddej                  fd„Zej                  ej                  fd„Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ d e«      Z G d!„ d"e«      Z G d#„ d$e«      Z y)%é    N)ÚFunction)ÚgroupÚReduceOp©Ú
suggestionc                ó:   — d| › d�}|r	|d|› d�z  }t        |«      ‚)Nú torch.distributed.nn.functional.z& is not supported under torch.compile.z Use ú	 instead.)ÚRuntimeError)Únamer   Úmsgs      ú^/var/www/html/ia-enhanced/venv/lib/python3.12/site-packages/torch/distributed/nn/functional.pyÚ_not_supported_under_compiler      s7   € à
*¨4¨&Ð0VÐWð ñ Ø��z�l )Ð,Ñ,ˆÜ
�sÓ
Ðó    c                 óJ   — t        j                  d| › d|› d�t        d¬«       y )Nr	   z is deprecated, use r
   é   )ÚcategoryÚ
stacklevel)ÚwarningsÚwarnÚFutureWarning)r   r   s     r   Ú_deprecatedr      s,   € Ü‡M�MØ
*¨4¨&ð 1Øˆl˜)ð	%äØö	r   c                 óž   — t         j                  j                  «       rt        dd¬«       t	        dd«       t
        j                  ||| «      S )a»  
    Broadcasts the tensor to the whole group.

    ``tensor`` must have the same number of elements in all processes
    participating in the collective.

    Arguments:
        tensor (Tensor): Data to be sent if ``src`` is the rank of current
            process.
        src (int): Source rank.
        group (ProcessGroup, optional): The process group to work on.

    Returns:
        Tensor: Received tensor from the broadcast op.

    Ú	broadcastz3torch.distributed._functional_collectives.broadcastr   )ÚtorchÚcompilerÚis_compilingr   r   Ú
_BroadcastÚapply)ÚtensorÚsrcr   s      r   r   r       sD   € ô" ‡~�~×"Ñ"Ô$Ü$ØØLõ	
ô �ÐRÔSÜ×Ñ˜C ¨Ó/Ð/r   c                 ó‚   — t         j                  j                  «       rt        d«       t        j                  ||| «      S )aT  
    Gathers a list of tensors in a single process.

    Arguments:
        tensor (Tensor): Input tensor.
        dst (int, optional): Destination rank (default is 0).
        group (ProcessGroup, optional): The process group to work on.

    Returns:
        tuple[Tensor]: List of appropriately-sized tensors with the gathered data.
    Úgather)r   r   r   r   Ú_Gatherr   )r    Údstr   s      r   r#   r#   :   s/   € ô ‡~�~×"Ñ"Ô$Ü$ XÔ.Ü�=‰=˜˜e VÓ,Ð,r   c                 ó‚   — t         j                  j                  «       rt        d«       t	        j
                  ||g| ¢­Ž S )aö  
    Scatters a list of tensors to all processes in a group.

    Each process will receive exactly one tensor and store its data in the
    ``tensor`` argument.

    Arguments:
        tensors (list[Tensor]): List of tensors to scatter on the source rank.
            Receivers must pass ``None`.
        src (int, optional): Source rank (default is 0).
        group (ProcessGroup, optional): The process group to work on.

    Returns:
        Tensor: Output tensor from the scatter operation.

    Úscatter)r   r   r   r   Ú_Scatterr   )Útensorsr!   r   s      r   r'   r'   K   s2   € ô" ‡~�~×"Ñ"Ô$Ü$ YÔ/Ü�>‰>˜#˜uÐ/ wÒ/Ð/r   c                 ó„   — t         j                  j                  «       rt        d«       t        j                  |||| «      S )a  
    Reduces the tensor data across all machines.

    Only the process with rank ``dst`` is going to receive the final result.

    Arguments:
        tensor (Tensor): Input of the collective.
        dst (int): Destination rank.
        op (optional): One of the values from
            ``torch.distributed.ReduceOp``
            enum.  Specifies an operation used for element-wise reductions.
        group (ProcessGroup, optional): The process group to work on.

    Returns:
        Tensor: Output of the collective.

    Úreduce)r   r   r   r   Ú_Reducer   )r    r%   Úopr   s       r   r+   r+   a   s1   € ô$ ‡~�~×"Ñ"Ô$Ü$ XÔ.Ü�=‰=˜˜b %¨Ó0Ð0r   c                 ó    — t         j                  j                  «       rt        dd¬«       t	        dd«       t        j                  ||| g|¢­Ž S )aõ  
    Reduces, then scatters a list of tensors to all processes in a group.

    Arguments:
        output (Tensor): Output tensor.
        input_list (list[Tensor]): List of tensors to reduce and scatter.
        op (optional): One of the values from
            ``torch.distributed.ReduceOp``
            enum.  Specifies an operation used for element-wise reductions.
        group (ProcessGroup, optional): The process group to work on.

    Returns:
        Tensor: Output of the collective.

    Úreduce_scatterz?torch.distributed._functional_collectives.reduce_scatter_tensorr   )r   r   r   r   r   Ú_Reduce_Scatterr   )ÚoutputÚ
input_listr-   r   s       r   r/   r/   x   sN   € ô  ‡~�~×"Ñ"Ô$Ü$ØØXõ	
ô ØØIôô × Ñ   U¨FÐ@°ZÒ@Ð@r   c                 óœ   — t         j                  j                  «       rt        dd¬«       t	        dd«       t
        j                  || «      S )a  
    Gathers tensors from the whole group in a list.

    Arguments:
        tensor (Tensor): Tensor to be broadcast from current process.
        group (ProcessGroup, optional): The process group to work on.

    Returns:
        tuple([Tensor]): Output of the collective.

    Ú
all_gatherz;torch.distributed._functional_collectives.all_gather_tensorr   )r   r   r   r   r   Ú
_AllGatherr   )r    r   s     r   r4   r4   ”   sG   € ô ‡~�~×"Ñ"Ô$Ü$ØØTõ	
ô ØÐSôô ×Ñ˜E 6Ó*Ð*r   c                 ó‚   — t         j                  j                  «       rt        d«       t        j                  | ||«      S )aâ  
    Single tensor all gather. Gathers a single tensor from all ranks, and puts them in a single output tensor.

    Args:
        output_tensor (Tensor): Output tensor. It should contain
            correctly-sized tensors to be used for output of the collective.
        input_tensor (Tensor): Tensor to be broadcast from current process.
        group (ProcessGroup, optional): The process group to work on. If None,
            the default process group will be used.

    Examples:
        >>> # All tensors below are of torch.int64 dtype.
        >>> # We have 2 process groups, 2 ranks.
        >>> # xdoctest: +SKIP("incorrect want text")
        >>> output_tensor = torch.zeros(2, dtype=torch.int64)
        >>> output_tensor
        [tensor([0, 0])] # Rank 0 and 1
        >>> tensor = torch.arange(1, dtype=torch.int64) + 1 + rank
        >>> tensor
        tensor([1]) # Rank 0
        tensor([2]) # Rank 1
        >>> dist.all_gather_base(output_tensor, tensor)
        >>> output_tensor
        tensor([1,2]) # Rank 0
        tensor([1,2]) # Rank 1

    .. warning::
        `_all_gather_base` is experimental and subject to change.
        It is the caller's responsibility to ensure the output_tensor
        is correctly sized.

    Ú_all_gather_base)r   r   r   r   Ú_AllGatherBaser   )Úoutput_tensorÚinput_tensorr   s      r   r7   r7   «   s3   € ôB ‡~�~×"Ñ"Ô$Ü$Ð%7Ô8Ü×Ñ ¨|¸UÓCÐCr   c                 ó‚   — t         j                  j                  «       rt        d«       t	        j
                  || g|¢­Ž S )aÃ  
    Each process scatters list of input tensors to all processes in a group and return gathered list of tensors in output list.

    Arguments:
        output_tensor_list (list[Tensor]): list of tensors to gather one per rank.
        input_tensor_list (list[Tensor]): List of tensors to scatter one per rank.
        group (ProcessGroup, optional): The process group to work on.

    Returns:
        tuple([Tensor]): Output of the collective.

    Ú
all_to_all)r   r   r   r   Ú	_AlltoAllr   )Úoutput_tensor_listÚinput_tensor_listr   s      r   r<   r<   Ñ   s4   € ô ‡~�~×"Ñ"Ô$Ü$ \Ô2Ü�?‰?˜5Ð"4ÐIÐ7HÒIÐIr   c                 ó¢   — t         j                  j                  «       rt        dd¬«       t	        dd«       t
        j                  || |||«      S )a  
    Each process splits input tensor and then scatters the split list to all processes in a group.

    Then concatenate the received tensors from all the processes in the group and return single output tensor.

    Arguments:
        output (Tensor): Gathered concatenated output tensor.
        input (Tensor): Input tensor to scatter.
        output_split_sizes: (list[Int], optional): Output split sizes for dim 0
            if specified None or empty, dim 0 of ``output`` tensor must divide
            equally by ``world_size``.
        input_split_sizes: (list[Int], optional): Input split sizes for dim 0
            if specified None or empty, dim 0 of ``input`` tensor must divide
            equally by ``world_size``.

    Returns:
        Tensor: Output of the collective.

    Úall_to_all_singlez;torch.distributed._functional_collectives.all_to_all_singler   )r   r   r   r   r   Ú_AlltoAllSingler   )r1   ÚinputÚoutput_split_sizesÚinput_split_sizesr   s        r   rA   rA   ã   sT   € ô4 ‡~�~×"Ñ"Ô$Ü$ØØTõ	
ô ØØEôô × Ñ ØˆvÐ)Ð+<¸eóð r   c                 óž   — t         j                  j                  «       rt        dd¬«       t	        dd«       t
        j                  ||| «      S )a&  
    Reduces the tensor data across all machines in such a way that all get the final result.

    After the call the returned tensor is going to be bitwise
    identical in all processes.

    Arguments:
        tensor (Tensor): Input of the collective.
        op (optional): One of the values from
            ``torch.distributed.ReduceOp``
            enum.  Specifies an operation used for element-wise reductions.
        group (ProcessGroup, optional): The process group to work on.

    Returns:
        Tensor: Output of the collective

    Ú
all_reducez4torch.distributed._functional_collectives.all_reducer   )r   r   r   r   r   Ú
_AllReducer   )r    r-   r   s      r   rG   rG     sD   € ô$ ‡~�~×"Ñ"Ô$Ü$ØØMõ	
ô �ÐTÔUÜ×Ñ˜B  vÓ.Ð.r   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)r   c                 ó¨   — || _         || _        t        j                  |¬«      | _        |j                  «       }t        j                  |||¬«       |S ©N©r   )r!   r   ÚdistÚget_rankÚrankÚcloner   )Úctxr!   r   r    s       r   Úforwardz_Broadcast.forward'  sD   € ð ˆŒØˆŒ	Ü—=‘= uÔ-ˆŒð —‘“ˆÜ�‰�v˜s¨%Õ0Øˆr   c                 óÒ   — t         j                  | j                  t        j                  | j
                  |«      }| j                  | j                  k7  r|j                  «        d d |fS ©N)r,   r   r!   r   ÚSUMr   rO   Úzero_)rQ   Úgrad_outputÚgxs      r   Úbackwardz_Broadcast.backward3  sJ   € ô �]‰]˜3Ÿ7™7¤H§L¡L°#·)±)¸[ÓIˆØ�7‰7�c—h‘hÒØ�H‰HŒJØ�d˜BÐÐr   N©Ú__name__Ú
__module__Ú__qualname__ÚstaticmethodrR   rY   © r   r   r   r   &  s(   „ Øñó ðð ñ ó ñ r   r   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)r$   c                 óˆ  — || _         || _        t        t        j                  |¬«      «      D �cg c]  }t        j                  |«      ‘Œ }}|j                  «       }t        j                  |¬«      |k(  r$t        j                  ||||¬«       t        |«      S t        j                  |d ||¬«       t        |«      S c c}w rK   )r%   r   ÚrangerM   Úget_world_sizer   Ú
zeros_likeÚ
contiguousrN   r#   Útuple)rQ   r%   r   r    ÚiÚtensor_lists         r   rR   z_Gather.forward=  s­   € ð ˆŒØˆŒ	ô /4´D×4GÑ4GÈeÔ4TÓ.Uö
Ø)*ŒE×Ñ˜VÕ$ð
ˆð 
ð ×"Ñ"Ó$ˆÜ�=‰=˜uÔ%¨Ò,Ü�K‰K˜ ¨S¸Õ>ô �[Ó!Ð!ô �K‰K˜  c°Õ7Ü�[Ó!Ð!ùò
s   °B?c                 ó`   — dt        j                  | j                  | j                  g|¢­Ž fz   S ©N©NN)r(   r   r%   r   )rQ   Úgrad_outputss     r   rY   z_Gather.backwardQ  s(   € àœxŸ~™~¨c¯g©g°s·y±yÐPÀ<ÒPÐRÑRÐRr   NrZ   r_   r   r   r$   r$   <  s*   „ Øñ"ó ð"ð$ ñSó ñSr   r$   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)r(   c                 ó4  ‡— || _         || _        t        ˆfd„‰D «       «      st        ‚t	        j
                  ‰d   «      }t        j                  |¬«      |k(  r$t        j                  |t        ‰«      ||¬«       |S t        j                  |d ||¬«       |S )Nc              3   óf   •K  — | ](  }|j                  «       ‰d    j                  «       k(  –— Œ* y­w)r   N)Úsize)Ú.0Útr)   s     €r   ú	<genexpr>z#_Scatter.forward.<locals>.<genexpr>\  s'   øè ø€ ÒB°Q�1—6‘6“8˜w q™zŸ™Ó0Õ0ÑBùs   ƒ.1r   rL   )
r!   r   ÚallÚAssertionErrorr   rd   rM   rN   r'   Úlist)rQ   r!   r   r)   r1   s      ` r   rR   z_Scatter.forwardW  s‚   ø€ ð ˆŒØˆŒ	ÜÓB¸'ÔBÔBÜ Ð Ü×!Ñ! '¨!¡*Ó-ˆÜ�=‰=˜uÔ%¨Ò,Ü�L‰L˜¤ g£°¸5ÕAð ˆô �L‰L˜  s°%Õ8Øˆr   c                 ó^   — dt         j                  | j                  | j                  |«      z   S rj   )r$   r   r!   r   ©rQ   rW   s     r   rY   z_Scatter.backwarde  s$   € ð œgŸm™m¨C¯G©G°S·Y±YÀÓLÑLÐLr   NrZ   r_   r   r   r(   r(   V  s*   „ Øñ
ó ð
ð ñMó ñMr   r(   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)r,   c                 ót   — || _         || _        |j                  «       }t        j                  ||||¬«       |S )N©r-   r   )r!   r   rP   rM   r+   )rQ   r!   r-   r   r    s        r   rR   z_Reduce.forwardl  s4   € ð ˆŒØˆŒ	Ø—‘“ˆÜ�‰�F˜C B¨eÕ4Øˆr   c                 ó`   — dt         j                  | j                  | j                  |«      fz   S ©N)NNN)r   r   r!   r   rx   s     r   rY   z_Reduce.backwardu  s)   € ð "¤Z×%5Ñ%5°c·g±g¸s¿y¹yÈ+Ó%VÐ$XÑXÐXr   NrZ   r_   r   r   r,   r,   k  s*   „ Øñó ðð ñYó ñYr   r,   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)r0   c                 óœ   — || _         |j                  «       }t        d„ |D «       «      }t        j                  |t        |«      ||¬«       |S )Nc              3   ó<   K  — | ]  }|j                  «       –— Œ y ­wrT   ©re   ©rq   rr   s     r   rs   z*_Reduce_Scatter.forward.<locals>.<genexpr>‚  s   è ø€ Ò!L°Q !§,¡,§.Ñ!Lùó   ‚r{   )r   re   rf   rM   r/   rv   )rQ   r-   r   r    r?   s        r   rR   z_Reduce_Scatter.forward|  sJ   € ð ˆŒ	à×"Ñ"Ó$ˆÜ!Ñ!LÐ:KÔ!LÓLÐÜ×Ñ˜F¤DÐ):Ó$;ÀÈ%ÕPØˆr   c                 óH   — dt         j                  | j                  |«      z   S r}   )r5   r   r   rx   s     r   rY   z_Reduce_Scatter.backward†  s    € ð "¤J×$4Ñ$4°S·Y±YÀÓ$LÑLÐLr   NrZ   r_   r   r   r0   r0   {  s*   „ Øñó ðð ñMó ñMr   r0   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)r5   c                 óþ   — |j                  «       }|| _        t        t        j                  |¬«      «      D �cg c]  }t        j                  |«      ‘Œ }}t        j                  |||¬«       t        |«      S c c}w rK   )	re   r   rb   rM   rc   r   Ú
empty_liker4   rf   )rQ   r   r    Ú_Úout_tensor_lists        r   rR   z_AllGather.forward�  sp   € ð ×"Ñ"Ó$ˆàˆŒ	ä.3´D×4GÑ4GÈeÔ4TÓ.Uö
Ø)*ŒE×Ñ˜VÕ$ð
ˆð 
ô 	�‰˜¨°uÕ=Ü�_Ó%Ð%ùò
s   ¹A:c                 ón  — t        j                  | j                  ¬«      t         j                  j                  t         j                  j
                  fv rlt        j                  | j                  ¬«      }t        j                  ||   «      }t        j                  t        j                  | j                  |g|¢­Ž }d |fS |D �cg c]  }t        j                  |«      ‘Œ }}t        j                  | j                  |g|¢­Ž }t        j                  t        j                  |«      d¬«      }d |fS c c}w )NrL   r   )Údim)rM   Úget_backendr   ÚBackendÚNCCLÚXCCLrN   r   r‡   r0   r   r   rU   r=   ÚsumÚstack)rQ   rl   rO   rX   r    rh   Úgxss          r   rY   z_AllGather.backward›  sê   € ä×Ñ #§)¡)Ô,´·±×1BÑ1BÄDÇLÁL×DUÑDUÐ0VÑVÜ—=‘= s§y¡yÔ1ˆDÜ×!Ñ! ,¨tÑ"4Ó5ˆBÜ ×&Ñ&¤x§|¡|°S·Y±YÀÐRÀ\ÒRˆBð �bˆzÐð COÖO¸œ5×+Ñ+¨FÕ3ÐOˆKÐOÜ—/‘/ #§)¡)¨[ÐH¸<ÒHˆCÜ—‘œ5Ÿ;™; sÓ+°Ô3ˆBØ�bˆzÐùò Ps   ÃD2NrZ   r_   r   r   r5   r5   Œ  s(   „ Øñ
&ó ð
&ð ñó ñr   r5   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)r8   c                 ó`   — || _         t        j                  ||j                  «       |¬«       |S rK   )r   rM   r7   re   )rQ   r9   r:   r   s       r   rR   z_AllGatherBase.forward«  s,   € ð ˆŒ	Ü×Ñ˜m¨\×-DÑ-DÓ-FÈeÕTØÐr   c                 ó€  — t        j                  | j                  ¬«      t         j                  j                  t         j                  j
                  fv rÛt        j                  | j                  ¬«      }t        |j                  «       «      }|d   |z  dk7  rt        d|› d|› �«      ‚|d   t        j                  | j                  ¬«      z  |d<   t        j                  ||j                  |j                  ¬«      }t        j                  ||t        j                   | j                  «       nt        d«      ‚d |d fS )NrL   r   zTensor with dimensions: z8 does not have first dimension divisible by world_size: ©ÚdeviceÚdtypezBackend not supported!)rM   rŒ   r   r�   rŽ   r�   rc   rv   rp   r   r   Úemptyr—   r˜   Ú_reduce_scatter_baser   rU   )rQ   rW   Ú
world_sizeÚout_sizerX   s        r   rY   z_AllGatherBase.backward²  s  € ô ×Ñ #§)¡)Ô,´·±×1BÑ1BÄDÇLÁL×DUÑDUÐ0VÑVÜ×,Ñ,°3·9±9Ô=ˆJÜ˜K×,Ñ,Ó.Ó/ˆHØ˜‰{˜ZÑ'¨1Ò,Ü"Ø.¨x¨jð 9IØISÈðVóð ð # 1™+¬×)<Ñ)<À3Ç9Á9Ô)MÑMˆH�Q‰KÜ—‘Ø ×!3Ñ!3¸;×;LÑ;LôˆBô ×%Ñ% b¨+´x·|±|ÀSÇYÁYÕOäÐ7Ó8Ð8Ø�b˜$ÐÐr   NrZ   r_   r   r   r8   r8   ª  s(   „ Øñó ðð
 ñ ó ñ r   r8   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)r=   c                 ób  — || _         t        t        j                  |¬«      «      D �cg c]  }||   j	                  «       ‘Œ c}| _        t        j                  |¬«      }t        d„ |D «       «      }t        j                  |¬«      t        j                  j                  u r]t        t        j                  |¬«      «      D ]0  }d }||k(  rt        |«      }t        j                  ||   |||¬«       Œ2 t        |«      S t        j                  |t        |«      |¬«       t        |«      S c c}w )NrL   c              3   ó<   K  — | ]  }|j                  «       –— Œ y ­wrT   r�   r‚   s     r   rs   z$_AlltoAll.forward.<locals>.<genexpr>Ð  s   è ø€ Ò8¨1˜Ÿ™ŸÑ8ùrƒ   )r   rb   rM   rc   rp   Úinput_tensor_size_listrN   rf   rŒ   r�   ÚGLOOrv   r'   r<   )rQ   r   r‰   r)   rg   Úmy_rankÚto_sends          r   rR   z_AlltoAll.forwardÈ  s  € ð ˆŒ	ä',¬T×-@Ñ-@ÀuÔ-MÓ'Nö&
Ø"#ˆG�A‰J�O‰OÕò&
ˆÔ"ô —-‘- eÔ,ˆÜÑ8°Ô8Ó8ˆä×Ñ %Ô(¬D¯L©L×,=Ñ,=Ñ=Üœ4×.Ñ.°UÔ;Ó<ò J�Ø�Ø˜’<Ü" 7›m�GÜ—‘˜_¨QÑ/°¸!À5ÖIð	Jô �_Ó%Ð%ô �O‰OØÜ�W“Øõô
 �_Ó%Ð%ùò%&
s   ©D,c           	      óæ   — | j                   D �cg c]4  }t        j                  ||d   j                  |d   j                  ¬«      ‘Œ6 }}dt        j                  | j                  |g|¢­Ž z   S c c}w )Nr   r–   rk   )r    r   r™   r—   r˜   r=   r   r   )rQ   rl   rp   rh   s       r   rY   z_AlltoAll.backwardà  ss   € ð ×2Ñ2ö	
ð ô �K‰KØ˜\¨!™_×3Ñ3¸<È¹?×;PÑ;Pöð
ˆð 
ð œiŸo™o¨c¯i©i¸ÐTÀ|ÒTÑTÐTùò
s   �9A.NrZ   r_   r   r   r=   r=   Ç  s*   „ Øñ&ó ð&ð, ñUó ñUr   r=   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)rB   c                 óŽ   — || _         |j                  «       | _        || _        || _        t        j                  |||||¬«       |S )N)rD   rE   r   )r   rp   Ú
input_sizerD   rE   rM   rA   )rQ   r   r1   rD   rE   rC   s         r   rR   z_AlltoAllSingle.forwardì  sL   € ð ˆŒ	ØŸ™›ˆŒØ!2ˆÔØ 2ˆÔÜ×ÑØØØ1Ø/Øõ	
ð ˆr   c           	      ó   — t        j                  | j                  |j                  |j                  ¬«      }dt
        j                  | j                  || j                  | j                  |j                  «       «      fz   S )Nr–   )NNNN)r   r™   r§   r—   r˜   rB   r   r   rD   rE   re   )rQ   rW   r    s      r   rY   z_AlltoAllSingle.backwardü  ss   € ô —‘Ø�N‰N ;×#5Ñ#5¸[×=NÑ=Nô
ˆð (Ü×!Ñ!Ø—	‘	ØØ×&Ñ&Ø×%Ñ%Ø×&Ñ&Ó(óð+
ñ 
ð 	
r   NrZ   r_   r   r   rB   rB   ë  s(   „ Øñó ðð ñ
ó ñ
r   rB   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)rH   c                 ó’   — || _         || _        |j                  t        j                  ¬«      }t        j                  |||¬«       |S )N)Úmemory_formatr{   )r   r-   rP   r   Úcontiguous_formatrM   rG   )rQ   r-   r   r    s       r   rR   z_AllReduce.forward  s=   € ð ˆŒ	ØˆŒØ—‘¬E×,CÑ,C�ÓDˆÜ�‰˜ 2¨UÕ3Øˆr   c                 ó`   — dt         j                  | j                  | j                  |«      fz   S rj   )rH   r   r-   r   rx   s     r   rY   z_AllReduce.backward  s)   € ð œz×/Ñ/°·±¸¿	¹	À;ÓOÐQÑQÐQr   NrZ   r_   r   r   rH   rH     s*   „ Øñó ðð ñRó ñRr   rH   )!r   r   Útorch.distributedÚdistributedrM   Útorch.autogradr   r   r   r   r   ÚWORLDr   r#   r'   rU   r+   r/   r4   r7   r<   rA   rG   r   r$   r(   r,   r0   r5   r8   r=   rB   rH   r_   r   r   ú<module>r²      sY  ðã ã Ý  Ý #÷
 .ð 6:ô òð "'§¡ó 0ð4  §¡ó -ð"  %§+¡+ó 0ð, $Ÿ<™<¨u¯{©{ó 1ð. +3¯,©,¸e¿k¹kó Að8 #Ÿ[™[ó +ð. 9>¿¹ó #DðL =B¿K¹Kó Jð* ØØ
�+‰+ó%ðP #Ÿ,™,¨e¯k©kó /ô6 �ô  ô,Sˆhô Sô4Mˆxô Mô*Yˆhô Yô M�hô Mô"�ô ô< �Xô  ô:!U�ô !UôH
�hô 
ôDR�õ Rr   