
    AVh$                       d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z
 ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZm Z m!Z! ddl"m#Z#  eddddddd      Z$dede#e!e$f   de#e!ejJ                  f   de#e!ejJ                  f   de#e!ejJ                  f   de#e e!   ejL                  f   de'de(d e)d!e#e!e$f   fd"Z*  ed#       ejV                  e*            Z,de#e!e$f   de#e!ejJ                  f   de#e!ejJ                  f   de#e!ejJ                  f   de#e e!   ejL                  f   de'de(d e)d!e#e!e$f   fd$Z- ed%dddddd      Z.dfde#e!e.f   d&e#e!ejL                  f   d'e#e!ejJ                  f   de(d!e#e!e.f   f
d(Z/  ed)       ejV                  e/            Z0de#e!e.f   d&e#e!ejL                  f   d'e#e!ejJ                  f   de(d!e#e!e.f   f
d*Z1 ejd                  d+ddg      Z3dgd'e#e!ejJ                  f   d,e#e!ejJ                  f   d-e#e!ejJ                  f   fd.Z4  ed/       ejV                  e4            Z5d'e#e!ejJ                  f   d,e#e!ejJ                  f   d-e#e!ejJ                  f   fd0Z6 ed1d2ddddd      Z7dhd3e7de8de8de8de'de(d!e#e!e7f   fd4Z9  ed5       ejV                  e9            Z:d3e7de8de8de8de'de(d!e#e!e7f   fd6Z; ed7d2ddddd      Z< ed8dd      Z=dhde#e!ejJ                  f   de#e!ejJ                  f   de#e!ejJ                  f   d9e#e!e=f   d3e<de'de(d!e#e!e<f   fd:Z>  ed;       ejV                  e>            Z?de#e!ejJ                  f   de#e!ejJ                  f   de#e!ejJ                  f   d9e#e!e=f   d3e<de'de(d!e#e!e<f   fd<Z@ ed=d2ddddd      ZAdhde#e!eAf   de8de8de8de'de(d!e#e!eAf   fd>ZB  ed?       ejV                  eB            ZCde#e!eAf   de8de8de8de'de(d!e#e!eAf   fd@ZD edAd2ddddd      ZEdhde#e!eEf   de#e!ejJ                  f   de#e!ejJ                  f   de#e!ejJ                  f   de'de(d!e#e!eEf   fdBZF  edC       ejV                  eF            ZGde#e!eEf   de#e!ejJ                  f   de#e!ejJ                  f   de#e!ejJ                  f   de'de(d!e#e!eEf   fdDZH edEddddd      ZIdhde#e!eIf   de8de8de8de'de(d!e#e!eIf   fdFZJ  edG       ejV                  eJ            ZKde#e!eIf   de8de8de8de'de(d!e#e!eIf   fdHZL edIddddd      ZMdede#e!eMf   de#e!ejJ                  f   de#e!ejJ                  f   de#e!ejJ                  f   de#e e!   ejL                  f   de'de(d e)d!e#e!eMf   fdJZN  edK       ejV                  eN            ZOde#e!eMf   de#e!ejJ                  f   de#e!ejJ                  f   de#e!ejJ                  f   de#e e!   ejL                  f   de'de(d e)d!e#e!eMf   fdLZPdhde#e!ejJ                  f   dMe#e!ejJ                  f   de#e!ejJ                  f   de'de(d!e#e!ejL                  f   fdNZQ  edO       ejV                  eQ            ZRde#e!ejJ                  f   dMe#e!ejJ                  f   de#e!ejJ                  f   de'de(d!e#e!ejL                  f   fdPZS edQdddddd      ZTg dddfde#e!eTf   de8de8de8dRe'dSe'de'de(d!e#e!eTf   fdTZU  edU       ejV                  eU            ZVde#e!eTf   de8de8de8dRe'dSe'de'de(d!e#e!eTf   fdVZW edWdddddd      ZXdide#e!eXf   de#e!ejJ                  f   de#e!ejJ                  f   de#e!ejJ                  f   de#e e!   ejL                  f   dRe'dSe'de'de(d e)dXe8d!e#e!eXf   fdYZY  edZ       ejV                  eY            ZZde#e!eXf   de#e!ejJ                  f   de#e!ejJ                  f   de#e!ejJ                  f   de#e e!   ejL                  f   dRe'dSe'de'de(d e)dXe8d!e#e!eXf   fd[Z[ ed\dddddd      Z\dide#e!e\f   de#e!ejJ                  f   de#e!ejJ                  f   de#e!ejJ                  f   de#e e!   ejL                  f   dRe'dSe'de'de(d e)dXe8d!e#e!e\f   fd]Z]  ed^       ejV                  e]            Z^de#e!e\f   de#e!ejJ                  f   de#e!ejJ                  f   de#e!ejJ                  f   de#e e!   ejL                  f   dRe'dSe'de'de(d e)dXe8d!e#e!e\f   fd_Z_ ed`dddddd      Z`dfde#e!e`f   d&e#e!ejL                  f   d'e#e!ejJ                  f   dae'de(d!e#e!e`f   fdbZa  edc       ejV                  ea            Zbde#e!e`f   d&e#e!ejL                  f   d'e#e!ejJ                  f   dae'de(d!e#e!e`f   fddZcy)jzUPython wrappers around TensorFlow ops.

This file is MACHINE GENERATED! Do not edit.
    N)
pywrap_tfe)context)core)execute)dtypes)annotation_types)op_def_registry)ops)op_def_library)deprecated_endpoints)dispatch)	tf_export)TypeVarListAny)	AnnotatedTV_CollectiveAllToAllV2_Tz_atypes.BFloat16z_atypes.Float32z_atypes.Float64z_atypes.Halfz_atypes.Int32z_atypes.Int64autoinput
group_size	group_keyinstance_keyordering_tokencommunication_hinttimeout_secondsis_statelessreturnc	                 2   t         j                   xs t        j                         }	|	j                  }
|
j                  r%	 t	        j
                  |	d|| ||||d|d|d|      }|S t        |t        t        f      st!        d|z        t#        |      }|d}t%        j&                  |d      }|d	}t%        j(                  |d      }|d
}t%        j*                  |d      }t-        j.                  d| ||||||||
      \  }}}}|dd }t%        j0                         r{d|j3                  d      d|j5                  d      d|j5                  d      d|j7                  d      d|j9                  d      f
}|j:                  }t%        j<                  d|||       |\  }|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | |||||||||	
      S # t        j                  $ r Y w xY w)a  Mutually exchanges multiple tensors of identical type and shape.

  `is_stateless` means each op does not need control dependencies to other
  collective ops. In this case, keys that are unique at runtime
  (e.g. `instance_key`) should be used to distinguish collective groups.

  Args:
    input: A `Tensor`. Must be one of the following types: `bfloat16`, `float32`, `half`, `float64`, `int32`, `int64`.
    group_size: A `Tensor` of type `int32`.
    group_key: A `Tensor` of type `int32`.
    instance_key: A `Tensor` of type `int32`.
    ordering_token: A list of `Tensor` objects with type `resource`.
    communication_hint: An optional `string`. Defaults to `"auto"`.
    timeout_seconds: An optional `float`. Defaults to `0`.
    is_stateless: An optional `bool`. Defaults to `False`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `input`.
  CollectiveAllToAllV2r   r   r   Nr   r   r   namectxUExpected list for 'ordering_token' argument to 'collective_all_to_all_v2' Op, not %r.r   r   F	r   r   r   r   r   r   r   r   r!   TNordering_token)_contextr   _thread_local_datais_eagerr   TFE_Py_FastPathExecute_core_NotOkStatusException_opsraise_from_not_ok_status_FallbackException'collective_all_to_all_v2_eager_fallback_SymbolicException
isinstancelisttuple	TypeErrorlen_executemake_str
make_float	make_bool_op_def_library_apply_op_helpermust_record_gradient_get_attr_typeget_attr_get_attr_bool_get_attr_intinputsrecord_gradientr   r   r   r   r   r   r   r   r!   _ctxtld_resulte_attr_Nordering_token__op_outputs_attrs_inputs_flats                      X/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/ops/gen_collective_ops.pycollective_all_to_all_v2rP      sX   * 
			0h..0$#\\
11$dE:yn&:-	&g
 n 
NT5M	2
	13A	BC C n-(();=QRO''9JK/L##L.A,'88e
*3-9/=3E0?-9F!QX QK'""$3%%c*,@ll/02Cll,-~  02C 12	4F
 ::Lfg?('	.] && -
##At,,## 
4
Yn/)	 
 ## 
0    #F G&2GG&%G&*G? ?HHzraw_ops.CollectiveAllToAllV2c
           
         t        |t        t        f      st        d|z        t	        |      }
|d}t        j                  |d      }|d}t        j                  |d      }|d}t        j                  |d      }t        j                  | g|	t        j                  t        j                  t        j                  t        j                  t        j                  t        j                   g      \  }\  } t#        j$                  |t        j                        }t#        j$                  |t        j                        }t#        j$                  |t        j                        }t#        j&                  |t        j(                        }| |||gt        |      z   }d|d|d|d|d	|
f
}t        j*                  d
d|||	|      }t        j,                         rt        j.                  d|||       |\  }|S )Nr#   r   r   r   r   Fr   r%   r&   s   CollectiveAllToAllV2   rB   attrsr"   r!   r   )r2   r3   r4   r5   r6   r7   r8   r9   r:   args_to_matching_eager_dtypesbfloat16float32halffloat64int32int64r-   convert_to_tensorconvert_n_to_tensorresourcer   r=   rC   r   r   r   r   r   r   r   r   r!   r"   rI   _attr_TrN   rM   rG   s                  rO   r0   r0   m   s   	NT5M	2
	13A	BC C n-(();=QRO''9JK/L##L.A,55ugsWEUEUW^WfWfhohthtv}  wF  wF  HO  HU  HU  W^  Wd  Wd  Eg  h'8E%%j'--@*$$Y>)''gmmD,++NG<L<LM.Y=^@TT,.0B_nl*,& 4a#)s?'""$fg?('	.    TV_CollectiveAllToAllV3_Tcommunicatorgroup_assignmentc           
         t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| ||d|      }|S |d}t        j                  |d      }t        j                   d| ||||      \  }	}	}
}|dd }t        j"                         rHd|
j%                  d      d|
j'                  d      f}|
j(                  }t        j*                  d|||       |\  }|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | |||||      S # t        j                  $ r Y w xY w)a  Mutually exchanges multiple tensors of identical type and shape.

  Args:
    input: A `Tensor`. Must be one of the following types: `bfloat16`, `float32`, `half`, `float64`, `int32`, `int64`.
    communicator: A `Tensor` of type `resource`.
    group_assignment: A `Tensor` of type `int32`.
    timeout_seconds: An optional `float`. Defaults to `0`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `input`.
  CollectiveAllToAllV3r   N)r   r!   r"   r   )r   re   rf   r   r!   r%   )r'   r   r(   r)   r   r*   r+   r,   r-   r.   r/   'collective_all_to_all_v3_eager_fallbackr1   r7   r9   r;   r<   r=   r>   r?   rB   rC   )r   re   rf   r   r!   rE   rF   rG   rH   rJ   rK   rL   rM   rN   s                 rO   collective_all_to_all_v3rj      s    
			0h..0$#\\11$dE<+_>g n O''9JK/'88e,1A0?dL!QX QK'""$3%%c*,=ll,-/F::Lfg?('	.5 && -
##At,,## 
4
/)$@ @ ## 
s0    C? ?ED--EE
E E21E2zraw_ops.CollectiveAllToAllV3c           
      d   |d}t        j                  |d      }t        j                  | g|t        j                  t        j
                  t        j                  t        j                  t        j                  t        j                  g      \  }\  } t        j                  |t        j                        }t        j                  |t        j                        }| ||g}d|d|f}t        j                  dd||||      }	t        j                         rt        j                  d|||	       |	\  }	|	S )Nr   r   r%   s   CollectiveAllToAllV3rS   rT   rh   )r7   r9   rV   rW   rX   rY   rZ   r[   r\   r]   r-   r^   r`   r   r=   rC   )
r   re   rf   r   r!   r"   rb   rN   rM   rG   s
             rO   ri   ri      s3   O''9JK/55ugsWEUEUW^WfWfhohthtv}  wF  wF  HO  HU  HU  W^  Wd  Wd  Eg  h'8E''g6F6FG,++,<gmmL'78,+_=&4a#)s?'""$fg?('	.rc   CollectiveAssignGroupV2device_indexbase_keyc                    t         j                   xs t        j                         }|j                  }|j                  r2	 t	        j
                  |d|| ||      }t        j                  |      }|S t        j                   d| |||      \  }}}	}
|
dd }t#        j$                         r&d}|	j&                  }t#        j(                  d|||       t        j                  |      }|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||||      S # t        j                  $ r Y w xY w)a  Assign group keys based on group assignment.

  Args:
    group_assignment: A `Tensor` of type `int32`.
    device_index: A `Tensor` of type `int32`.
    base_key: A `Tensor` of type `int32`.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (group_size, group_key).

    group_size: A `Tensor` of type `int32`.
    group_key: A `Tensor` of type `int32`.
  rl   N)r!   r"   )rf   rm   rn   r!    )r'   r   r(   r)   r   r*   _CollectiveAssignGroupV2Output_maker+   r,   r-   r.   r/   )collective_assign_group_v2_eager_fallbackr1   r;   r<   r7   r=   rB   rC   )rf   rm   rn   r!   rE   rF   rG   rH   rJ   rK   rL   rM   rN   s                rO   collective_assign_group_v2rt      sZ    
			0h..0$#\\	11'/?g /44W=gn (88!4D0<,44A!QX QK'""$F::L!<B*009'	.+ && -
##At,,## 
6
L(4I I## 
s0    0C& &D-9DD-,D-1E EEzraw_ops.CollectiveAssignGroupV2c                    t        j                  | t        j                        } t        j                  |t        j                        }t        j                  |t        j                        }| ||g}d }t	        j
                  dd||||      }t	        j                         rt	        j                  d|||       t        j                  |      }|S )Ns   CollectiveAssignGroupV2   rT   rl   )
r-   r^   rW   r\   r7   r   r=   rC   rq   rr   )rf   rm   rn   r!   r"   rN   rM   rG   s           rO   rs   rs     s    ++,<gmmL''gmmD,##Hgmm<("L(;,&7$0C"&(' ""$!<B*009'	.rc   TV_CollectiveBcastRecv_Tz_atypes.Boolr%   c                    t         j                   xs t        j                         }|j                  }	|	j                  r(	 t	        j
                  |d|d| d|d|d|d|d|d|      }
|
S t        j                  | d      } t        j                  |d      }t        j                  |d      }t        j                  |d      }t        j                   |d      }|d}t        j"                  |d      }|d}t        j$                  |d      }t'        j(                  d| |||||||	      \  }}}}|d	d	 }
t        j*                         rd|j-                  d      d|j/                  d      d|j/                  d      d|j/                  d      d|j1                  d      d|j1                  d      d|j1                  d      f}|j2                  }t        j4                  d|||
       |
\  }
|
S # t        j                  $ r }t        j                  ||       Y d	}~nd	}~wt        j                  $ r Y nw xY w	 t        | ||||||||
	      S # t        j                  $ r Y w xY w)a  Receives a tensor value broadcast from another device.

  Args:
    T: A `tf.DType` from: `tf.bool, tf.float32, tf.half, tf.float64, tf.int32, tf.int64`.
    group_size: An `int`.
    group_key: An `int`.
    instance_key: An `int`.
    shape: A `tf.TensorShape` or list of `ints`.
    communication_hint: An optional `string`. Defaults to `"auto"`.
    timeout_seconds: An optional `float`. Defaults to `0`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `T`.
  CollectiveBcastRecvr%   r   r   r   shaper   r   N)	r%   r   r   r   rz   r   r   r!   r"   r   r   )r%   r   r   r   rz   r   r   r!   )r'   r   r(   r)   r   r*   r+   r,   r-   r.   r/   $collective_bcast_recv_eager_fallbackr1   r7   	make_typemake_int
make_shaper8   r9   r;   r<   r=   r>   rA   r?   rB   rC   )r%   r   r   r   rz   r   r   r!   rE   rF   rG   rH   rJ   rK   rL   rM   rN   s                    rO   collective_bcast_recvr     s{     
			0h..0$#\\
11#T3<Ygu02C	g
 n C !  \:*	;7)""<@,


eW
-%(();=QRO''9JK/'88z)2%*2D/>TK!QX QK'""$3%%c*L-{,n/ll7#%9ll/02Cll,-/F ::L|VW>('	.W && -
##At,,## 
1*	#5/)$	@ @
 ## 
s0    &G( (H/;HH/.H/3I IIzraw_ops.CollectiveBcastRecvc	                    t        j                  | d      } t        j                  |d      }t        j                  |d      }t        j                  |d      }t        j                  |d      }|d}t        j                  |d      }|d}t        j
                  |d	      }g }	d| d|d|d|d|d|d	|f}
t        j                  d
d|	|
||      }t        j                         rt        j                  d|	|
|       |\  }|S )Nr%   r   r   r   rz   r   r   r   r   s   CollectiveBcastRecvrS   rT   ry   )	r7   r|   r}   r~   r8   r9   r   r=   rC   )r%   r   r   r   rz   r   r   r!   r"   rN   rM   rG   s               rO   r{   r{   h  s   C !  \:*	;7)""<@,


eW
-%(();=QRO''9JK/,L*k9,0D':& 3Q|#)s?'""$|VW>('	.rc   TV_CollectiveBcastRecvV2_TTV_CollectiveBcastRecvV2_Tshaperz   c                    t         j                   xs t        j                         }|j                  }	|	j                  r$	 t	        j
                  |d|| |||d|d|d|      }
|
S t        j                  |d      }|d}t        j                  |d      }|d}t        j                   |d      }t#        j$                  d| |||||||		      \  }}}}|dd }
t        j&                         rjd|j)                  d      d
|j)                  d
      d|j+                  d      d|j+                  d      f}|j,                  }t        j.                  d|||
       |
\  }
|
S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||||||||	      S # t        j                  $ r Y kw xY w)aD  Receives a tensor value broadcast from another device.

  Args:
    group_size: A `Tensor` of type `int32`.
    group_key: A `Tensor` of type `int32`.
    instance_key: A `Tensor` of type `int32`.
    shape: A `Tensor`. Must be one of the following types: `int32`, `int64`.
    T: A `tf.DType` from: `tf.bool, tf.float32, tf.half, tf.float64, tf.int32, tf.int64`.
    communication_hint: An optional `string`. Defaults to `"auto"`.
    timeout_seconds: An optional `float`. Defaults to `0`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `T`.
  CollectiveBcastRecvV2r%   r   r   N)r%   r   r   r!   r"   r   r   )r   r   r   rz   r%   r   r   r!   Tshape)r'   r   r(   r)   r   r*   r+   r,   r-   r.   r/   'collective_bcast_recv_v2_eager_fallbackr1   r7   r|   r8   r9   r;   r<   r=   r>   r?   rB   rC   )r   r   r   rz   r%   r   r   r!   rE   rF   rG   rH   rJ   rK   rL   rM   rN   s                    rO   collective_bcast_recv_v2r     s     
			0h..0$#\\	11%tZeS!%9;M?,g n C !(();=QRO''9JK/'88J).:%14F1@t	M!QX
 QK'""$3%%c*H  *,@ll/02Cll,-/F ::Lvw@('	.E && -
##At,,## 
4
iu/)$@ @ ## 
s0    "E F ,FF F $F8 8GGzraw_ops.CollectiveBcastRecvV2c	                    t        j                  |d      }|d}t        j                  |d      }|d}t        j                  |d      }t        j                  |g|t
        j                  t
        j                  gt
        j                        \  }	\  }t        j                  | t
        j                        } t        j                  |t
        j                        }t        j                  |t
        j                        }| |||g}
d|d|	d|d|f}t        j                  dd|
|||	      }t        j                         rt        j                  d
|
||       |\  }|S )Nr%   r   r   r   r   r   s   CollectiveBcastRecvV2rS   rT   r   )r7   r|   r8   r9   rV   rW   r\   r]   r-   r^   r   r=   rC   )r   r   r   rz   r%   r   r   r!   r"   _attr_TshaperN   rM   rG   s                rO   r   r     sB   C !(();=QRO''9JK/#::E7C'--Y`YfYfIikrkxkxy,%%j'--@*$$Y>)''gmmD,iu=,Hl,@':&5q#)s?'""$vw@('	.rc   TV_CollectiveBcastSend_Tc                    t         j                   xs t        j                         }|j                  }	|	j                  r'	 t	        j
                  |d|| d|d|d|d|d|d|      }
|
S t        j                  |d      }t        j                  |d      }t        j                  |d      }t        j                  |d      }|d
}t        j                   |d      }|d}t        j"                  |d      }t%        j&                  d| |||||||	      \  }}}}|dd }
t        j(                         rd|j+                  d      d|j-                  d      d|j-                  d      d|j-                  d      d|j/                  d      d|j/                  d      d|j/                  d      f}|j0                  }t        j2                  d|||
       |
\  }
|
S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||||||||		      S # t        j                  $ r Y w xY w)a  Broadcasts a tensor value to one or more other devices.

  Args:
    input: A `Tensor`. Must be one of the following types: `bool`, `float32`, `half`, `float64`, `int32`, `int64`.
    group_size: An `int`.
    group_key: An `int`.
    instance_key: An `int`.
    shape: A `tf.TensorShape` or list of `ints`.
    communication_hint: An optional `string`. Defaults to `"auto"`.
    timeout_seconds: An optional `float`. Defaults to `0`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `input`.
  CollectiveBcastSendr   r   r   rz   r   r   Nr   r   r   rz   r   r   r!   r"   r   r   r   r   r   r   rz   r   r   r!   r%   )r'   r   r(   r)   r   r*   r+   r,   r-   r.   r/   $collective_bcast_send_eager_fallbackr1   r7   r}   r~   r8   r9   r;   r<   r=   r>   rA   r?   rB   rC   r   r   r   r   rz   r   r   r!   rE   rF   rG   rH   rJ   rK   rL   rM   rN   s                    rO   collective_bcast_sendr     sg     
			0h..0$#\\
11#T5,
Ygu02C	g
 n   \:*	;7)""<@,


eW
-%(();=QRO''9JK/'88Uz)2%*2D/>TK!QX QK'""$3%%c*L-{,n/ll7#%9ll/02Cll,-/F ::L|VW>('	.U && -
##At,,## 
1
J)#5/)$	@ @
 ## 
0    %G H$G??HHH0 0IIzraw_ops.CollectiveBcastSendc	                    t        j                  |d      }t        j                  |d      }t        j                  |d      }t        j                  |d      }|d}t        j                  |d      }|d}t        j                  |d      }t        j
                  | g|t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  g      \  }	\  } | g}
d	|	d|d|d|d|d|d|f}t        j                  d
d|
|||      }t        j                         rt        j                  d|
||       |\  }|S )Nr   r   r   rz   r   r   r   r   r%   s   CollectiveBcastSendrS   rT   r   )r7   r}   r~   r8   r9   rV   rW   boolrY   rZ   r[   r\   r]   r   r=   rC   r   r   r   r   rz   r   r   r!   r"   rb   rN   rM   rG   s                rO   r   r   '  s     \:*	;7)""<@,


eW
-%(();=QRO''9JK/55ugsW\\SZSbSbdkdpdpry  sB  sB  DK  DQ  DQ  SZ  S`  S`  Ec  d'8E,,
K,0D':& 3Q|#)s?'""$|VW>('	.rc   TV_CollectiveBcastSendV2_Tc                 N   t         j                   xs t        j                         }|j                  }|j                  r"	 t	        j
                  |d|| |||d|d|      }	|	S |d}t        j                  |d      }|d}t        j                  |d      }t!        j"                  d| ||||||      \  }}}}|dd }	t        j$                         rYd	|j'                  d	      d|j)                  d      d|j)                  d      f}|j*                  }t        j,                  d|||	       |	\  }	|	S # t        j                  $ r }
t        j                  |
|       Y d}
~
nd}
~
wt        j                  $ r Y nw xY w	 t        | |||||||      S # t        j                  $ r Y Bw xY w)
a#  Broadcasts a tensor value to one or more other devices.

  Args:
    input: A `Tensor`. Must be one of the following types: `bool`, `float32`, `half`, `float64`, `int32`, `int64`.
    group_size: A `Tensor` of type `int32`.
    group_key: A `Tensor` of type `int32`.
    instance_key: A `Tensor` of type `int32`.
    communication_hint: An optional `string`. Defaults to `"auto"`.
    timeout_seconds: An optional `float`. Defaults to `0`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `input`.
  CollectiveBcastSendV2r   r   Nr   r   r!   r"   r   r   )r   r   r   r   r   r   r!   r%   )r'   r   r(   r)   r   r*   r+   r,   r-   r.   r/   'collective_bcast_send_v2_eager_fallbackr1   r7   r8   r9   r;   r<   r=   r>   r?   rB   rC   )r   r   r   r   r   r   r!   rE   rF   rG   rH   rJ   rK   rL   rM   rN   s                   rO   collective_bcast_send_v2r   B  s    
			0h..0$#\\	11%tUJ	*,>?,g n (();=QRO''9JK/'88u+4.:4F1@tM!QX QK'""$3%%c*,@ll/02Cll,-/F ::Lvw@('	.C && -
##At,,## 
4
Y/)$@ @ ## 
s0     D/ /E6EE65E6:F F$#F$zraw_ops.CollectiveBcastSendV2c           
         |d}t        j                  |d      }|d}t        j                  |d      }t        j                  | g|t        j
                  t        j                  t        j                  t        j                  t        j                  t        j                  g      \  }\  } t        j                  |t        j                        }t        j                  |t        j                        }t        j                  |t        j                        }| |||g}	d|d|d|f}
t        j                  dd|	|
||      }t        j                         rt        j                  d	|	|
|       |\  }|S )
Nr   r   r   r   r%   s   CollectiveBcastSendV2rS   rT   r   )r7   r8   r9   rV   rW   r   rY   rZ   r[   r\   r]   r-   r^   r   r=   rC   )r   r   r   r   r   r   r!   r"   rb   rN   rM   rG   s               rO   r   r     sn   (();=QRO''9JK/55ugsW\\SZSbSbdkdpdpry  sB  sB  DK  DQ  DQ  SZ  S`  S`  Ec  d'8E%%j'--@*$$Y>)''gmmD,Y=,.0B_&&5q#)s?'""$vw@('	.rc   TV_CollectiveGather_Tc                    t         j                   xs t        j                         }|j                  }	|	j                  r'	 t	        j
                  |d|| d|d|d|d|d|d|      }
|
S t        j                  |d      }t        j                  |d      }t        j                  |d      }t        j                  |d      }|d
}t        j                   |d      }|d}t        j"                  |d      }t%        j&                  d| |||||||	      \  }}}}|dd }
t        j(                         rd|j+                  d      d|j-                  d      d|j-                  d      d|j-                  d      d|j/                  d      d|j/                  d      d|j/                  d      f}|j0                  }t        j2                  d|||
       |
\  }
|
S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||||||||		      S # t        j                  $ r Y w xY w)a!  Mutually accumulates multiple tensors of identical type and shape.

  Args:
    input: A `Tensor`. Must be one of the following types: `float32`, `half`, `float64`, `int32`, `int64`.
    group_size: An `int`.
    group_key: An `int`.
    instance_key: An `int`.
    shape: A `tf.TensorShape` or list of `ints`.
    communication_hint: An optional `string`. Defaults to `"auto"`.
    timeout_seconds: An optional `float`. Defaults to `0`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `input`.
  CollectiveGatherr   r   r   rz   r   r   Nr   r   r   r   r%   )r'   r   r(   r)   r   r*   r+   r,   r-   r.   r/    collective_gather_eager_fallbackr1   r7   r}   r~   r8   r9   r;   r<   r=   r>   rA   r?   rB   rC   r   s                    rO   collective_gatherr     sg     
			0h..0$#\\
11 $|ZYgu02C	g
 n   \:*	;7)""<@,


eW
-%(();=QRO''9JK/'88%J&/l"'/A,;$H!QX QK'""$3%%c*L-{,n/ll7#%9ll/02Cll,-/F ::LL&';('	.U && -
##At,,## 
-
J)#5/)$	@ @
 ## 
r   zraw_ops.CollectiveGatherc	                    t        j                  |d      }t        j                  |d      }t        j                  |d      }t        j                  |d      }|d}t        j                  |d      }|d}t        j                  |d      }t        j
                  | g|t        j                  t        j                  t        j                  t        j                  t        j                  g      \  }	\  } | g}
d	|	d|d|d|d|d|d|f}t        j                  d
d|
|||      }t        j                         rt        j                  d|
||       |\  }|S )Nr   r   r   rz   r   r   r   r   r%   s   CollectiveGatherrS   rT   r   )r7   r}   r~   r8   r9   rV   rW   rY   rZ   r[   r\   r]   r   r=   rC   r   s                rO   r   r     sj     \:*	;7)""<@,


eW
-%(();=QRO''9JK/55ugsW__V]VbVbdkdsdsu|  vC  vC  EL  ER  ER  EU  V'8E,,
K,0D':& 0!L#)s?'""$L&';('	.rc   TV_CollectiveGatherV2_Tc	                 2   t         j                   xs t        j                         }	|	j                  }
|
j                  r%	 t	        j
                  |	d|| ||||d|d|d|      }|S t        |t        t        f      st!        d|z        t#        |      }|d}t%        j&                  |d      }|d	}t%        j(                  |d      }|d
}t%        j*                  |d      }t-        j.                  d| ||||||||
      \  }}}}|dd }t%        j0                         r{d|j3                  d      d|j5                  d      d|j5                  d      d|j7                  d      d|j9                  d      f
}|j:                  }t%        j<                  d|||       |\  }|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | |||||||||	
      S # t        j                  $ r Y w xY w)a{  Mutually accumulates multiple tensors of identical type and shape.

  `is_stateless` means each op does not need control dependencies to other
  collective ops. In this case, keys that are unique at runtime
  (e.g. `instance_key`) should be used to distinguish collective groups.

  Args:
    input: A `Tensor`. Must be one of the following types: `float32`, `half`, `float64`, `int32`, `int64`.
    group_size: A `Tensor` of type `int32`.
    group_key: A `Tensor` of type `int32`.
    instance_key: A `Tensor` of type `int32`.
    ordering_token: A list of `Tensor` objects with type `resource`.
    communication_hint: An optional `string`. Defaults to `"auto"`.
    timeout_seconds: An optional `float`. Defaults to `0`.
    is_stateless: An optional `bool`. Defaults to `False`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `input`.
  CollectiveGatherV2r   r   r   Nr    QExpected list for 'ordering_token' argument to 'collective_gather_v2' Op, not %r.r   r   Fr$   r%   r&   )r'   r   r(   r)   r   r*   r+   r,   r-   r.   r/   #collective_gather_v2_eager_fallbackr1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   s                      rO   collective_gather_v2r     sT   * 
			0h..0$#\\
11"D%Yn&:-	&g
 n 
NT5M	2
	-/=	>? ? n-(();=QRO''9JK/L##L.A,'88Ej(1-;1C.=+7dD!QX QK'""$3%%c*,@ll/02Cll,-~  02C 12	4F
 ::LlFG=('	.[ && -
##At,,## 
0
Yn/)	 
 ## 
rQ   zraw_ops.CollectiveGatherV2c
           
         t        |t        t        f      st        d|z        t	        |      }
|d}t        j                  |d      }|d}t        j                  |d      }|d}t        j                  |d      }t        j                  | g|	t        j                  t        j                  t        j                  t        j                  t        j                  g      \  }\  } t!        j"                  |t        j                        }t!        j"                  |t        j                        }t!        j"                  |t        j                        }t!        j$                  |t        j&                        }| |||gt        |      z   }d|d|d|d|d	|
f
}t        j(                  d
d|||	|      }t        j*                         rt        j,                  d|||       |\  }|S )Nr   r   r   r   r   Fr   r%   r&   s   CollectiveGatherV2rS   rT   r   )r2   r3   r4   r5   r6   r7   r8   r9   r:   rV   rW   rY   rZ   r[   r\   r]   r-   r^   r_   r`   r   r=   rC   ra   s                  rO   r   r   N  s   	NT5M	2
	-/=	>? ? n-(();=QRO''9JK/L##L.A,55ugsW__V]VbVbdkdsdsu|  vC  vC  EL  ER  ER  EU  V'8E%%j'--@*$$Y>)''gmmD,++NG<L<LM.Y=^@TT,.0B_nl*,& 2Al#)s?'""$lFG=('	.rc   rankc                 &   t         j                   xs t        j                         }|j                  }|j                  r!	 t	        j
                  |d|| ||d|d|
      }|S |d}t        j                  |d      }|d}t        j                  |d      }t!        j"                  d| |||||      \  }
}
}}|dd }t        j$                         rHd|j'                  d      d|j'                  d      f}|j(                  }t        j*                  d|||       |\  }|S # t        j                  $ r }	t        j                  |	|       Y d}	~	nd}	~	wt        j                  $ r Y nw xY w	 t        | ||||||      S # t        j                  $ r Y /w xY w)	a  Initializes a group for collective operations.

  Args:
    group_key: A `Tensor` of type `int32`.
    rank: A `Tensor` of type `int32`.
    group_size: A `Tensor` of type `int32`.
    communication_hint: An optional `string`. Defaults to `"auto"`.
    timeout_seconds: An optional `float`. Defaults to `0`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `resource`.
   CollectiveInitializeCommunicatorr   r   Nr   r   r   )r   r   r   r   r   r!   )r'   r   r(   r)   r   r*   r+   r,   r-   r.   r/   1collective_initialize_communicator_eager_fallbackr1   r7   r8   r9   r;   r<   r=   r?   rB   rC   )r   r   r   r   r   r!   rE   rF   rG   rH   rJ   rK   rL   rM   rN   s                  rO   "collective_initialize_communicatorr   o  s    
			0h..0$#\\	110$	4(*<?,g n (();=QRO''9JK/'88*id7A?Q<K157!QX QK'""$"CLL1E$F.?!@BF::L*L&'K('	.? && -
##At,,## 
>
T::L)$@ @ ## 
s0    D E#/E

E#"E#'E9 9FFz(raw_ops.CollectiveInitializeCommunicatorc                    |d}t        j                  |d      }|d}t        j                  |d      }t        j                  | t
        j                        } t        j                  |t
        j                        }t        j                  |t
        j                        }| ||g}d|d|f}t        j                  dd||||      }	t        j                         rt        j                  d|||	       |	\  }	|	S )	Nr   r   r   r   s    CollectiveInitializeCommunicatorrS   rT   r   )
r7   r8   r9   r-   r^   rW   r\   r   r=   rC   )
r   r   r   r   r   r!   r"   rN   rM   rG   s
             rO   r   r     s    (();=QRO''9JK/$$Y>)			gmm	4$%%j'--@*T:., "46G&@!$0C"&(' ""$*L&'K('	.rc   TV_CollectiveReduce_Tmerge_opfinal_opc                 v   t         j                   xs t        j                         }|j                  }|j                  r-	 t	        j
                  |d|
| d|d|d|d|d|d|d|d	|d
|	      }|S t        j                  |d      }t        j                  |d      }t        j                  |d      }t        j                  |d      }t        j                  |d      }t!        |t"        t$        f      st'        d|z        |D cg c]  }t        j                  |d       }}|g }t!        |t"        t$        f      st'        d|z        |D cg c]  }t        j                  |d       }}|d}t        j                  |d	      }|	d}	t        j(                  |	d
      }	t+        j,                  d| |||||||||	|
      \  }}}}|dd }t        j.                         rd|j1                  d      d|j3                  d      d|j3                  d      d|j3                  d      d|j5                  d      d|j5                  d      d|j5                  d      d|j5                  d      d	|j5                  d	      d
|j5                  d
      f}|j6                  }t        j8                  d|||       |\  }|S # t        j                  $ r }t        j                  ||
       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | |||||||||	|
|      S # t        j                  $ r Y w xY wc c}w c c}w )a  Mutually reduces multiple tensors of identical type and shape.

  Args:
    input: A `Tensor`. Must be one of the following types: `bfloat16`, `float32`, `half`, `float64`, `int32`, `int64`.
    group_size: An `int`.
    group_key: An `int`.
    instance_key: An `int`.
    merge_op: A `string` from: `"Min", "Max", "Mul", "Add"`.
    final_op: A `string` from: `"Id", "Div"`.
    subdiv_offsets: A list of `ints`.
    wait_for: An optional list of `ints`. Defaults to `[]`.
    communication_hint: An optional `string`. Defaults to `"auto"`.
    timeout_seconds: An optional `float`. Defaults to `0`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `input`.
  CollectiveReducer   r   r   r   r   subdiv_offsetswait_forr   r   N)r   r   r   r   r   r   r   r   r   r!   r"   NExpected list for 'subdiv_offsets' argument to 'collective_reduce' Op, not %r.HExpected list for 'wait_for' argument to 'collective_reduce' Op, not %r.r   r   )r   r   r   r   r   r   r   r   r   r   r!   r%   )r'   r   r(   r)   r   r*   r+   r,   r-   r.   r/    collective_reduce_eager_fallbackr1   r7   r}   r8   r2   r3   r4   r5   r9   r;   r<   r=   r>   rA   r?   rB   rC   )r   r   r   r   r   r   r   r   r   r   r!   rE   rF   rG   rH   _irJ   rK   rL   rM   rN   s                        rO   collective_reducer     sm   & 
			0h..0$#\\11 $|ZYj*h(8.H24F?,g n   \:*	;7)""<@,x4(x4(	NT5M	2
	*,:	;< < GUUH%%b*:;U.UH	HtUm	,
	*,4	56 6 ;CCBhJ/C(C(();=QRO''9JK/'88%J&/l%-+9H/A,;$H!QX QK'""$3%%c*L-{,n/ll:&
CLL4L-= >
ll:&(<ll/02Cll,-/F ::LL&';('	.w && -
##At,,## 
-
J)#h'(/)$@ @ ## 
 V Ds<    +J5 L1L65K<K##K<;K< L L.-L.zraw_ops.CollectiveReducec                 8   t        j                  |d      }t        j                  |d      }t        j                  |d      }t        j                  |d      }t        j                  |d      }t        |t        t
        f      st        d|z        |D cg c]  }t        j                  |d       }}|g }t        |t        t
        f      st        d|z        |D cg c]  }t        j                  |d	       }}|d
}t        j                  |d      }|	d}	t        j                  |	d      }	t        j                  | g|t        j                  t        j                  t        j                  t        j                  t        j                  t        j                  g      \  }\  } | g}d|d|d|d|d|d|d|d	|d|d|	f}t        j                   dd||||
      }t        j"                         rt        j$                  d|||       |\  }|S c c}w c c}w )Nr   r   r   r   r   r   r   r   r   r   r   r   r   r%   s   CollectiveReducerS   rT   r   )r7   r}   r8   r2   r3   r4   r5   r9   rV   rW   rX   rY   rZ   r[   r\   r]   r   r=   rC   )r   r   r   r   r   r   r   r   r   r   r!   r"   r   rb   rN   rM   rG   s                    rO   r   r   !  sP     \:*	;7)""<@,x4(x4(	NT5M	2
	*,:	;< < GUUH%%b*:;U.UH	HtUm	,
	*,4	56 6 ;CCBhJ/C(C(();=QRO''9JK/55ugsWEUEUW^WfWfhohthtv}  wF  wF  HO  HU  HU  W^  Wd  Wd  Eg  h'8E,,
K,
Hj(NJ*,=	&
 0!L#)s?'""$L&';('	.7 V Ds   H"HTV_CollectiveReduceScatterV2_Tmax_subdivs_per_devicec                 <   t         j                   xs t        j                         }|j                  }|j                  r+	 t	        j
                  |d|| ||||d|d|d|d|d|	d|
      }|S t        |t        t        f      st!        d
|z        t#        |      }t%        j&                  |d      }t%        j&                  |d      }|d}t%        j&                  |d      }|d}t%        j(                  |d      }|	d}	t%        j*                  |	d      }	|
d}
t%        j,                  |
d      }
t/        j0                  d| |||||||||	|
|      \  }}}}|dd }t%        j2                         rd|j5                  d      d|j7                  d      d|j7                  d      d|j7                  d      d|j7                  d      d|j9                  d      d|j;                  d      d|j;                  d      f}|j<                  }t%        j>                  d|||       |\  }|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | |||||||||	|
||	      S # t        j                  $ r Y 0w xY w)aG  Mutually reduces multiple tensors of identical type and shape and scatters the result.

  `is_stateless` means each op does not need control dependencies to other
  collective ops. In this case, keys that are unique at runtime
  (e.g. `instance_key`) should be used to distinguish collective groups.

  Args:
    input: A `Tensor`. Must be one of the following types: `bfloat16`, `float32`, `half`, `float64`, `int32`, `int64`.
    group_size: A `Tensor` of type `int32`.
    group_key: A `Tensor` of type `int32`.
    instance_key: A `Tensor` of type `int32`.
    ordering_token: A list of `Tensor` objects with type `resource`.
    merge_op: A `string` from: `"Min", "Max", "Mul", "Add"`.
    final_op: A `string` from: `"Id", "Div"`.
    communication_hint: An optional `string`. Defaults to `"auto"`.
    timeout_seconds: An optional `float`. Defaults to `0`.
    is_stateless: An optional `bool`. Defaults to `False`.
    max_subdivs_per_device: An optional `int`. Defaults to `-1`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `input`.
  CollectiveReduceScatterV2r   r   r   r   r   r   Nr   r   r   r   r   r   r!   r"   YExpected list for 'ordering_token' argument to 'collective_reduce_scatter_v2' Op, not %r.r   r   Fr   r   r   r   r   r   r   r   r   r   r   r!   r%   r&   ) r'   r   r(   r)   r   r*   r+   r,   r-   r.   r/   +collective_reduce_scatter_v2_eager_fallbackr1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r}   r;   r<   r=   r>   r?   r@   rA   rB   rC   r   r   r   r   r   r   r   r   r   r   r   r!   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   s                         rO   collective_reduce_scatter_v2r   K  s   0 
			0h..0$#\\11)4
Inj(J&(:<M "8:g n 
NT5M	2
	57E	FG G n-x4(x4((();=QRO''9JK/L##L.A,##,,-CE]^'88#5Z/82>4B.68J5D2><R*.
0!QX QK'""$3%%c*Jll:&
CLL4L"CLL1E$F.?!@c00@!2!23D!E& 89;F ::L#\67D('	.u && -
##At,,## 
8
Ynh/)!7dN N ## 
0    )H! !I(4II('I(,J JJz!raw_ops.CollectiveReduceScatterV2c                 x   t        |t        t        f      st        d|z        t	        |      }t        j                  |d      }t        j                  |d      }|d}t        j                  |d      }|d}t        j                  |d      }|	d}	t        j                  |	d	      }	|
d
}
t        j                  |
d      }
t        j                  | g|t        j                  t        j                  t        j                  t        j                  t        j                   t        j"                  g      \  }\  } t%        j&                  |t        j                         }t%        j&                  |t        j                         }t%        j&                  |t        j                         }t%        j(                  |t        j*                        }| |||gt        |      z   }d|d|d|d|d|d	|	d|d|
f}t        j,                  dd||||      }t        j.                         rt        j0                  d|||       |\  }|S )Nr   r   r   r   r   r   r   Fr   r   r   r%   r&   s   CollectiveReduceScatterV2rS   rT   r   r2   r3   r4   r5   r6   r7   r8   r9   r:   r}   rV   rW   rX   rY   rZ   r[   r\   r]   r-   r^   r_   r`   r   r=   rC   r   r   r   r   r   r   r   r   r   r   r   r!   r"   rI   rb   rN   rM   rG   s                     rO   r   r     sK   	NT5M	2
	57E	FG G n-x4(x4((();=QRO''9JK/L##L.A,##,,-CE]^55ugsWEUEUW^WfWfhohthtv}  wF  wF  HO  HU  HU  W^  Wd  Wd  Eg  h'8E%%j'--@*$$Y>)''gmmD,++NG<L<LM.Y=^@TT,*h
H*,=><1B13IK& 91$0C"&(' ""$#\67D('	.rc   TV_CollectiveReduceV2_Tc                 <   t         j                   xs t        j                         }|j                  }|j                  r+	 t	        j
                  |d|| ||||d|d|d|d|d|	d|
      }|S t        |t        t        f      st!        d
|z        t#        |      }t%        j&                  |d      }t%        j&                  |d      }|d}t%        j&                  |d      }|d}t%        j(                  |d      }|	d}	t%        j*                  |	d      }	|
d}
t%        j,                  |
d      }
t/        j0                  d| |||||||||	|
|      \  }}}}|dd }t%        j2                         rd|j5                  d      d|j7                  d      d|j7                  d      d|j7                  d      d|j7                  d      d|j9                  d      d|j;                  d      d|j;                  d      f}|j<                  }t%        j>                  d|||       |\  }|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | |||||||||	|
||	      S # t        j                  $ r Y 0w xY w)a/  Mutually reduces multiple tensors of identical type and shape.

  `is_stateless` means each op does not need control dependencies to other
  collective ops. In this case, keys that are unique at runtime
  (e.g. `instance_key`) should be used to distinguish collective groups.

  Args:
    input: A `Tensor`. Must be one of the following types: `bfloat16`, `float32`, `half`, `float64`, `int32`, `int64`.
    group_size: A `Tensor` of type `int32`.
    group_key: A `Tensor` of type `int32`.
    instance_key: A `Tensor` of type `int32`.
    ordering_token: A list of `Tensor` objects with type `resource`.
    merge_op: A `string` from: `"Min", "Max", "Mul", "Add"`.
    final_op: A `string` from: `"Id", "Div"`.
    communication_hint: An optional `string`. Defaults to `"auto"`.
    timeout_seconds: An optional `float`. Defaults to `0`.
    is_stateless: An optional `bool`. Defaults to `False`.
    max_subdivs_per_device: An optional `int`. Defaults to `-1`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `input`.
  CollectiveReduceV2r   r   r   r   r   r   Nr   QExpected list for 'ordering_token' argument to 'collective_reduce_v2' Op, not %r.r   r   Fr   r   r%   r&   ) r'   r   r(   r)   r   r*   r+   r,   r-   r.   r/   #collective_reduce_v2_eager_fallbackr1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r}   r;   r<   r=   r>   r?   r@   rA   rB   rC   r   s                         rO   collective_reduce_v2r     s   0 
			0h..0$#\\11"D%Ynj(J&(:<M "8:g n 
NT5M	2
	-/=	>? ? n-x4(x4((();=QRO''9JK/L##L.A,##,,-CE]^'88Ej(1-;'/(1C.=+75K#'	)!QX QK'""$3%%c*Jll:&
CLL4L"CLL1E$F.?!@c00@!2!23D!E& 89;F ::LlFG=('	.s && -
##At,,## 
0
Ynh/)!7dN N ## 
r   zraw_ops.CollectiveReduceV2c                 x   t        |t        t        f      st        d|z        t	        |      }t        j                  |d      }t        j                  |d      }|d}t        j                  |d      }|d}t        j                  |d      }|	d}	t        j                  |	d	      }	|
d
}
t        j                  |
d      }
t        j                  | g|t        j                  t        j                  t        j                  t        j                  t        j                   t        j"                  g      \  }\  } t%        j&                  |t        j                         }t%        j&                  |t        j                         }t%        j&                  |t        j                         }t%        j(                  |t        j*                        }| |||gt        |      z   }d|d|d|d|d|d	|	d|d|
f}t        j,                  dd||||      }t        j.                         rt        j0                  d|||       |\  }|S )Nr   r   r   r   r   r   r   Fr   r   r   r%   r&   s   CollectiveReduceV2rS   rT   r   r   r   s                     rO   r   r   8  sD   	NT5M	2
	-/=	>? ? n-x4(x4((();=QRO''9JK/L##L.A,##,,-CE]^55ugsWEUEUW^WfWfhohthtv}  wF  wF  HO  HU  HU  W^  Wd  Wd  Eg  h'8E%%j'--@*$$Y>)''gmmD,++NG<L<LM.Y=^@TT,*h
H*,=><1B13IK& 2Al#)s?'""$lFG=('	.rc   TV_CollectiveReduceV3_T	reductionc                 @   t         j                   xs t        j                         }|j                  }|j                  r!	 t	        j
                  |d|| ||d|d|
      }|S t        j                  |d      }|d}t        j                  |d      }t!        j"                  d| |||||      \  }
}
}}|dd }t        j$                         rYd|j'                  d      d|j)                  d      d|j)                  d      f}|j*                  }t        j,                  d|||       |\  }|S # t        j                  $ r }	t        j                  |	|       Y d}	~	nd}	~	wt        j                  $ r Y nw xY w	 t        | ||||||      S # t        j                  $ r Y <w xY w)	a  Mutually reduces multiple tensors of identical type and shape.

  Args:
    input: A `Tensor`. Must be one of the following types: `bfloat16`, `float32`, `half`, `float64`, `int32`, `int64`.
    communicator: A `Tensor` of type `resource`.
    group_assignment: A `Tensor` of type `int32`.
    reduction: A `string` from: `"Min", "Max", "Mul", "Add"`.
    timeout_seconds: An optional `float`. Defaults to `0`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `input`.
  CollectiveReduceV3r   r   N)r   r   r!   r"   r   )r   re   rf   r   r   r!   r%   )r'   r   r(   r)   r   r*   r+   r,   r-   r.   r/   #collective_reduce_v3_eager_fallbackr1   r7   r8   r9   r;   r<   r=   r>   r?   rB   rC   )r   re   rf   r   r   r!   rE   rF   rG   rH   rJ   rK   rL   rM   rN   s                  rO   collective_reduce_v3r   a  s    
			0h..0$#\\	11"D%+y2Cg n 	;7)O''9JK/'88E/?(1.=D	J!QX
 QK'""$3%%c*Kll;'):ll,-/F ::LlFG=('	.; && -
##At,,## 
0
/9)$@ @ ## 
s0    D) )E0<EE0/E04F FFzraw_ops.CollectiveReduceV3c           
         t        j                  |d      }|d}t        j                  |d      }t        j                  | g|t        j
                  t        j                  t        j                  t        j                  t        j                  t        j                  g      \  }\  } t        j                  |t        j                        }t        j                  |t        j                        }| ||g}d|d|d|f}	t        j                  dd||	||      }
t        j                         rt        j                   d||	|
       |
\  }
|
S )	Nr   r   r   r%   s   CollectiveReduceV3rS   rT   r   )r7   r8   r9   rV   rW   rX   rY   rZ   r[   r\   r]   r-   r^   r`   r   r=   rC   )r   re   rf   r   r   r!   r"   rb   rN   rM   rG   s              rO   r   r     sL   	;7)O''9JK/55ugsWEUEUW^WfWfhohthtv}  wF  wF  HO  HU  HU  W^  Wd  Wd  Eg  h'8E''g6F6FG,++,<gmmL'78,+y2C&2Al#)s?'""$lFG=('	.rc   )r   r   FN)r   N)N)r   r   N)r   r   Fr   N)d__doc__collectionstensorflow.pythonr   tensorflow.python.eagerr   r'   r   r+   r   r7   tensorflow.python.frameworkr   rW   tensorflow.security.fuzzing.pyr   _atypesr	   _op_def_registryr
   r-   r   r;   "tensorflow.python.util.deprecationr   tensorflow.python.utilr   	_dispatch tensorflow.python.util.tf_exportr   typingr   r   r   typing_extensionsr   r   Int32Resourcestrfloatr   rP   	to_raw_opr   r0   rd   rj   rh   ri   
namedtuplerq   rt   rl   rs   rw   intr   ry   r{   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rp   rc   rO   <module>r      s  
  6 7 1 7 9 F K 3 I C 8 6 % % '#$?ASUfhy  |J  L[  ]l  m MIc3L.L$M M[dehjqjwjwew[x M  FO  PS  U\  Ub  Ub  Pb  Fc M  s|  }@  BI  BO  BO  }O  sP M  bk  lp  qt  lu  w~  wG  wG  lG  bH M  ]` M  y~ M  OS M  ir  sv  xQ  sQ  iR M^ Ay!?@PhAij 9SB[=[3\ jstw  zA  zG  zG  uG  kH   U^  _b  dk  dq  dq  _q  Ur   BK  LO  QX  Q^  Q^  L^  B_   qz  {  @C  {D  FM  FV  FV  {V  qW   mp   CH   X\   lu  vy  {T  vT  lU B $$?ASUfhy  |J  L[  ]l  m /Ic3L.L$M /]fgjlsl|l|g|]} /  R[  \_  ah  an  an  \n  Ro /  AF /  Xa  be  g@  b@  XA /b Ay!?@PhAij 9SB[=[3\ luvy  |C  |L  |L  wL  mM   aj  kn  pw  p}  p}  k}  a~   QV   fo  ps  uN  pN  fO " "8!7!7;"! 
-3;M1N -^ghkmtmzmzhz^{ -  HQ  RU  W^  Wd  Wd  Rd  He -^ G)$EF~t~~VpGqr 	#w}}J\@] mvwz  }D  }J  }J  xJ  nK   W`  ad  fm  fs  fs  as  Wt   ##=~O`bs  vD  FU  Wf  g E5 E3 ESV Efi E  FI E  bg E  yB  CF  H`  C`  ya EN ?i =>~t~~Nc?de ,D RU be ux   VY   lq   AJ  KN  Ph  Kh  Ai 2 %%A>Sdfw  zH  JY  [j  k ")*K_^m"n ;33E)F ;S\]`bibobo]oSp ;  AJ  KN  PW  P]  P]  K]  A^ ;  gp  qt  vU  qU  gV ;  [u ;  JM ;  fk ;  }F  GJ  Lf  Gf  }g ;z C	"AB>4>>RjCkl 	#w}}BT8U bkloqxq~q~l~b   PY  Z]  _f  _l  _l  Zl  Pm   v  @C  Ed  @d  ve   jD   Z]   pu   EN  OR  Tn  On  Eo 0 ##=~O`bs  vD  FU  Wf  g D30H+H!I DWZ Dgj Dz} D  Z] D  v{ D  MV  WZ  \t  Wt  Mu DL ?i =>~t~~Nc?de 	#?W:W0X fi vy   JM   jm   @E   U^  _b  d|  _|  U} 2 %%A>Sdfw  zH  JY  [j  k 9Ic3M.M$N 9\efikrkxkxfx\y 9  GP  QT  V]  Vc  Vc  Qc  Gd 9  t}  ~A  CJ  CP  CP  ~P  tQ 9  fi 9  BG 9  Yb  cf  hB  cB  YC 9v C	"AB>4>>RjCkl 9SB\=\3] ktux  {B  {H  {H  vH  lI   V_  `c  el  er  er  `r  Vs   CL  MP  RY  R_  R_  M_  C`   vy   LQ   aj  kn  pJ  kJ  aK .   79JL]_mo~  AP  Q DYs,A'AB DPS D`c Dsv D  SV D  ot D  FO  PS  Uj  Pj  Fk DL 9978HY9Z[ Ic;P6P,Q _b or   CF   cf   y~   NW  X[  ]r  Xr  Ns 2 "";=NPacq  tC  ET  U L	#/F*F G LU^_bdkdqdq_qUr L  @I  JM  OV  O\  O\  J\  @] L  mv  wz  |C  |I  |I  wI  mJ L  \e  fj  kn  fo  qx  qA  qA  fA  \B L  WZ L  sx L  IM L  cl  mp  rI  mI  cJ L\ =Y;<^T^^L`=ab y>U9U/V dmnqsz  tA  tA  oA  eB   OX  Y\  ^e  ^k  ^k  Yk  Ol   |E  FI  KR  KX  KX  FX  |Y   kt  uy  z}  u~  @G  @P  @P  uP  kQ   gj   }B   RV   fo  ps  uL  pL  fM B6)C<N2O 6W`adfmfsfsasWt 6  CL  MP  RY  R_  R_  M_  C` 6  ux 6  QV 6  hq  ru  w~  wG  wG  rG  hH 6p $Y9-W#XYgY]YgYg  iK  ZL  $M  3PWP]P]K]A^ fopsu|  vC  vC  qC  gD   R[  \_  ah  an  an  \n  Ro   EH   [`   py  z}  F  O  O  zO  pP .   79KM^`q  tB  DS  Ud  e  pr  KQ  ij  qu YYs,A'AB YPS Y`c Ysv Y  CF Y  RU Y  GJ Y  ch Y  zC  DG  I^  D^  z_ Yv 9978HY9Z[ %Ic;P6P,Q %_b %or %  CF %  RU %  ad %  TW %  jo %  H  IL  Nc  Ic  d %P "))IK]_p  sD  FT  Ve  gv  "w ]	#7U2U(V ]dmnqsz  tA  tA  oA  eB ]  OX  Y\  ^e  ^k  ^k  Yk  Ol ]  |E  FI  KR  KX  KX  FX  |Y ]  kt  uy  z}  u~  @G  @P  @P  uP  kQ ]  ]` ]  lo ]  DG ]  `e ]  vz ]  Y\ ]  ox  y|  ~\  y\  o] ]~ KI&IJ>4>>ZvKwx %yFdAd7e %s|  ~A  CJ  CP  CP  ~P  tQ %  ^g  hk  mt  mz  mz  hz  ^{ %  KT  UX  Za  Zg  Zg  Ug  Kh %  zC  DH  IL  DM  OV  O_  O_  D_  z` %  lo %  {~ %  TW %  jo %  C %  ]` %  py  z}  ]  z]  p^ %P "";=OQbdu  xF  HW  Yh  i \	#/F*F G \U^_bdkdqdq_qUr \  @I  JM  OV  O\  O\  J\  @] \  mv  wz  |C  |I  |I  wI  mJ \  \e  fj  kn  fo  qx  qA  qA  fA  \B \  NQ \  ]` \  ux \  QV \  gk \  JM \  `i  jm  oF  jF  `G \| =Y;<^T^^L`=ab $y>U9U/V $dmnqsz  tA  tA  oA  eB $  OX  Y\  ^e  ^k  ^k  Yk  Ol $  |E  FI  KR  KX  KX  FX  |Y $  kt  uy  z}  u~  @G  @P  @P  uP  kQ $  ]` $  lo $  EH $  [` $  pt $  NQ $  aj  kn  pG  kG  aH $N "";=OQbdu  xF  HW  Yh  i 4	#/F*F G 4W`adfmfvfvavWw 4  LU  VY  [b  [h  [h  Vh  Li 4  vy 4  KP 4  bk  lo  qH  lH  bI 4l =Y;<^T^^L`=ab y>U9U/V fopsu|  vF  vF  qF  gG   [d  eh  jq  jw  jw  ew  [x   EH   [`   py  z}  V  zV  pW rc   