
    AVhG+                        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      Z$d'de#e!e$f   de%de&de%de#e!e$f   f
dZ'  ed       ejP                  e'            Z)de#e!e$f   de%de&de%de#e!e$f   f
dZ* edddddd      Z+d'de#e!e+f   de#e!e+f   fd Z,  ed!       ejP                  e,            Z-de#e!e+f   de#e!e+f   fd"Z. ed#ddddd      Z/d'de#e e!   e/f   de%de#e!e/f   fd$Z0  ed%       ejP                  e0            Z1de#e e!   e/f   de%de#e!e/f   fd&Z2y)(zUPython 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_NcclAllReduce_Tz_atypes.Float32z_atypes.Float64z_atypes.Halfz_atypes.Int32z_atypes.Int64input	reductionnum_devicesshared_namereturnc                    t         j                   xs t        j                         }|j                  }|j                  r!	 t	        j
                  |d|| d|d|d|
      }|S t        j                  |d      }t        j                  |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 ]w xY w)	a  Outputs a tensor containing the reduction across all input tensors.

  Outputs a tensor containing the reduction across all input tensors passed to ops
  within the same `shared_name.

  The graph should be constructed so if one op runs with shared_name value `c`,
  then `num_devices` ops will run with shared_name value `c`.  Failure to do so
  will cause the graph execution to fail to complete.

  input: the input to the reduction
  data: the value of the reduction across all `num_devices` devices.
  reduction: the reduction operation to perform.
  num_devices: The number of devices participating in this reduction.
  shared_name: Identifier that shared between ops of the same reduction.

  Args:
    input: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`.
    reduction: A `string` from: `"min", "max", "prod", "sum"`.
    num_devices: An `int`.
    shared_name: A `string`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `input`.
  NcclAllReducer   r   r   N)r   r   r   namectx)r   r   r   r   r   T)_contextr   _thread_local_datais_eagerr   TFE_Py_FastPathExecute_core_NotOkStatusException_opsraise_from_not_ok_status_FallbackExceptionnccl_all_reduce_eager_fallback_SymbolicException_executemake_strmake_int_op_def_library_apply_op_helpermust_record_gradientget_attr_get_attr_type_get_attr_intinputsrecord_gradient)r   r   r   r   r   _ctxtld_resulte__op_outputs_attrs_inputs_flats                 R/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/ops/gen_nccl_ops.pynccl_all_reducer>      s   4 
			0h..0$#\\11otUK{M;@g n 	;7)!!+}=+!!+}=+'88u	%0k"$!QX QK'""$3<<4c  %}.ll=)+F ::Lvw8('	.9 && -
##At,,## 
+
9+!$8 8 ## 
s0    E FE99FFF' 'F>=F>zraw_ops.NcclAllReducec           	      
   t        j                  |d      }t        j                  |d      }t        j                  |d      }t        j                  | g|t        j
                  t        j                  t        j                  t        j                  t        j                  g      \  }\  } | g}d|d|d|d|f}t        j                  dd||||      }	t        j                         rt        j                  d|||	       |	\  }	|	S )	Nr   r   r   r   s   NcclAllReduce   r2   attrsr   r   r   )r)   r*   r+   args_to_matching_eager_dtypeshalffloat32float64int32int64r   r.   r3   )
r   r   r   r   r   r   _attr_Tr<   r;   r6   s
             r=   r'   r'   ^   s   	;7)!!+}=+!!+}=+55ugsW\\SZSbSbdkdsdsu|  vC  vC  EL  ER  ER  EU  V'8E,C-&-q#)s?'""$vw8('	.    TV_NcclBroadcast_Tc                    t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| d|      }|S 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  Sends `input` to all devices that are connected to the output.

  Sends `input` to all devices that are connected to the output.

  The graph should be constructed so that all ops connected to the output have a
  valid device assignment, and the op itself is assigned one of these devices.

  input: The input to the broadcast.
  output: The same as input.
  shape: The shape of the input tensor.

  Args:
    input: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`.
    shape: A `tf.TensorShape` or list of `ints`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `input`.
  NcclBroadcastshapeN)rO   r   r   )r   rO   r   r   )r   r   r   r    r   r!   r"   r#   r$   r%   r&   nccl_broadcast_eager_fallbackr(   r)   
make_shaper,   r-   r.   r0   r/   r2   r3   )r   rO   r   r4   r5   r6   r7   r8   r9   r:   r;   r<   s               r=   nccl_broadcastrR   q   s^   ( 
			0h..0$#\\11otUGU<gn 

eW
-%'88uE>!QXQK'""$3%%c*GS\\'5JKF::Lvw8('	.) && -
##At,,## 
*
u4T3 3## 
s0    C7 7D>
D%%D>=D>E E('E(zraw_ops.NcclBroadcastc           	         t        j                  |d      }t        j                  | g|t        j                  t        j
                  t        j                  t        j                  t        j                  g      \  }\  } | g}d|d|f}t        j                  dd||||      }t        j                         rt        j                  d|||       |\  }|S )NrO   r   s   NcclBroadcastr@   rA   rN   )r)   rQ   rC   rD   rE   rF   rG   rH   rI   r   r.   r3   )r   rO   r   r   rJ   r<   r;   r6   s           r=   rP   rP      s    


eW
-%55ugsW\\SZSbSbdkdsdsu|  vC  vC  EL  ER  ER  EU  V'8E,'5)&-q#)s?'""$vw8('	.rK   TV_NcclReduce_Tc                 V   t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| d|      }|S t        | t        t        f      st!        d| z        t#        |       }t%        j&                  |d      }t)        j*                  d| ||      \  }}}	}
|
dd }t%        j,                         rYd|	j/                  d      d|	j1                  d      d|	j3                  d      f}|	j4                  }t%        j6                  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)	a  Reduces `input` from `num_devices` using `reduction` to a single device.

  Reduces `input` from `num_devices` using `reduction` to a single device.

  The graph should be constructed so that all inputs have a valid device
  assignment, and the op itself is assigned one of these devices.

  input: The input to the reduction.
  data: the value of the reduction across all `num_devices` devices.
  reduction: the reduction operation to perform.

  Args:
    input: A list of at least 1 `Tensor` objects with the same type in: `half`, `float32`, `float64`, `int32`, `int64`.
    reduction: A `string` from: `"min", "max", "prod", "sum"`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `input`.
  
NcclReducer   N)r   r   r   ?Expected list for 'input' argument to 'nccl_reduce' Op, not %r.)r   r   r   r   r   )r   r   r   r    r   r!   r"   r#   r$   r%   r&   nccl_reduce_eager_fallbackr(   
isinstancelisttuple	TypeErrorlenr)   r*   r,   r-   r.   r/   r0   r1   r2   r3   )r   r   r   r4   r5   r6   r7   _attr_num_devicesr8   r9   r:   r;   r<   s                r=   nccl_reducer_      s   ( 
			0h..0$#\\11lD%iAgn 
ED%=	)
	$&+	,- - %j	;7)'88EYTC!QXQK'""$3<<4c  %}.0F ::LlFG5('	.7 && -
##At,,## 
'
94T; ;## 
s0    D7 7E>
E%%E>=E>F F('F(zraw_ops.NcclReducec           	      (   t        | t        t        f      st        d| z        t	        |       }t        j                  |d      }t        j                  t        |       |t        j                  t        j                  t        j                  t        j                  t        j                  g      \  }} t        |       }d|d|d|f}t        j                  dd||||      }t        j                         rt        j                   d|||       |\  }|S )	NrW   r   r   r   s
   NcclReducer@   rA   rV   )rY   rZ   r[   r\   r]   r)   r*   rC   rD   rE   rF   rG   rH   rI   r   r.   r3   )	r   r   r   r   r^   rJ   r<   r;   r6   s	            r=   rX   rX      s   	ED%=	)
	$&+	,- - %j	;7)224;gllT[TcTceletetv}  wD  wD  FM  FS  FS  FV  W.'5e,C-&]Al#)s?'""$lFG5('	.rK   )N)3__doc__collectionstensorflow.pythonr   tensorflow.python.eagerr   r   r   r"   r   r)   tensorflow.python.frameworkr   rD   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   strintr>   	to_raw_opr   r'   rL   rR   rN   rP   rT   r_   rV   rX    rK   r=   <module>rs      s  
  6 7 1 7 9 F K 3 I C 8 6 % % '13DFWYgix  {J  K >9S*<%<= ># >\_ >nq >  BK  LO  Qc  Lc  Bd >@ 3	12>4>>/3RS)C9K4K*L Y\ kn   ~A   QZ  [^  `r  [r  Qs " 13DFWYgix  {J  K /)C);$;< /S\]`bt]tSu /b 3	12>4>>.3QR38J3J)K bklo  rD  mD  cE  +->@QSacr  uD  E6ycO!;< 6 6\efikzfz\{ 6p -Y+,^T^^K-HI
iS	?0J&K X[ ktux  {J  vJ  lK rK   