
    sh                     N   S SK Jr  S SKrS SKJs  Jr   S rS rS r	S r
S rS\R                  S	\S
\S\\   S\4
S jrS\\R                     S	\S
\S\\   S\4
S jrS\R                  S\\\      S\\\      S
\S\\   S\4S jrS\R                  S\R                  4S jrg)    )OptionalNc                     [         R                  " X25      n[        R                  R                  R                  U UU5      $ N)c10d$_resolve_group_name_by_ranks_and_tagtorchops_c10d_functional	broadcast)inputsrctagranks
group_size
group_names         ڂ/Users/tiagomarins/Projetos/claudeai/copy_bank/venv/lib/python3.13/site-packages/torch/distributed/_functional_collectives_impl.py
_broadcastr      s8    ::5FJ99%%//     c                     [         R                  " X25      n[        R                  R                  R                  U UU5      $ r   )r   r   r   r	   r
   
all_reducer   	reduce_opr   r   r   r   s         r   _all_reducer      s8    ::5FJ99%%00 r   c                     [         R                  " X25      n[        R                  R                  R                  U UU5      $ r   )r   r   r   r	   r
   all_reduce_coalescedinputsr   r   r   r   r   s         r   _all_reduce_coalescedr       s8    ::5FJ99%%:: r   c                     [         R                  " X!5      n[        R                  R                  R                  U UU5      $ r   )r   r   r   r	   r
   all_gather_into_tensorr   r   r   r   r   s        r   _all_gather_into_tensorr"   )   s8    ::5FJ99%%<< r   c                     [         R                  " X!5      n[        R                  R                  R                  U UU5      $ r   )r   r   r   r	   r
    all_gather_into_tensor_coalescedr!   s        r   !_all_gather_into_tensor_coalescedr%   2   s8    ::5FJ99%%FF r   r   r   r   r   r   c                     [         R                  " X25      n[        R                  R                  R                  U UUU5      $ r   )r   r   r   r	   r
   reduce_scatter_tensorr   s         r   _reduce_scatter_tensorr(   ;   s=     ::5FJ99%%;;	 r   r   c                     [         R                  " X25      n[        R                  R                  R                  U UUU5      $ r   )r   r   r   r	   r
   reduce_scatter_tensor_coalescedr   s         r    _reduce_scatter_tensor_coalescedr+   K   s=     ::5FJ99%%EE	 r   output_split_sizesinput_split_sizesc                     Ub  Uc%  Uc  Ub   S5       eU R                   S   U-  /U-  nUn[        R                  " XC5      n[        R                  R
                  R                  U UUU5      $ )Nz^output_split_sizes and input_split_sizes must either be specified together or both set to Noner   )shaper   r   r   r	   r
   all_to_all_single)r   r,   r-   r   r   r   r   s          r   _all_to_all_singler1   [   s     !%6%>!).?.G 	
5	
G $kk!n
:;jH.::5FJ99%%77	 r   tensorreturnc                 T    [         R                  R                  R                  U 5      $ r   )r   r	   r
   wait_tensor)r2   s    r   _wait_tensorr6   t   s    99%%11&99r   )typingr   r   "torch.distributed.distributed_c10ddistributeddistributed_c10dr   r   r   r   r"   r%   Tensorstrlistintr(   r+   r1   r6    r   r   <module>r@      s     1 1<< 
 9	
   
 9	
  << c+  S	* 
	
 9 2: :%,, :r   