o
    ?e+                     @   s  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  edej!ej"ej#ej$ej%Z&d'dej'e& de(de)de(dej'e& f
ddZ*ede+e*Z,dej'e& de(de)de(dej'e& f
ddZ-edej!ej"ej#ej$ej%Z.d'dej'e. dej'e. fddZ/ede+e/Z0dej'e. dej'e. fdd Z1ed!ej!ej"ej#ej$ej%Z2d'de ej'e2  de(dej'e2 fd"d#Z3ed$e+e3Z4de ej'e2  de(dej'e2 fd%d&Z5dS )(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TV_NcclAllReduce_Tinput	reductionnum_devicesshared_namereturnc                 C   sP  t j pt  }|j}|jrWzt|d|| d|d|d|
}|W S  tjy7 } zt	|| W Y d}~nd}~w tj
y@   Y nw zt| |||||dW S  tjyV   Y nw t|d}t|d}t|d}tjd| ||||d\}	}	}
}|dd }t rd|
dd|
dd|
dd|
df}|
j}td||| |\}|S )	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_flat r9   c/home/www/facesmatcher.com/pyenv/lib/python3.10/site-packages/tensorflow/python/ops/gen_nccl_ops.pynccl_all_reduce   sX   

r;   zraw_ops.NcclAllReducec           
   	   C   s   t |d}t |d}t |d}t | g|tjtjtjtjtj	g\}\} | g}d|d|d|d|f}t j
dd||||d}	t  rKt d|||	 |	\}	|	S )	Nr   r   r   r   s   NcclAllReduce   r.   attrsr   r   r   )r%   r&   r'   args_to_matching_eager_dtypeshalffloat32float64int32int64r   r*   r/   )
r   r   r   r   r   r   _attr_Tr8   r7   r2   r9   r9   r:   r#   ]   s"   *
r#   TV_NcclBroadcast_Tc              
   C   s  t j pt  }|j}|jrQzt|d|| d|}|W S  tjy3 } zt	|| W Y d}~nd}~w tj
y<   Y nw z	t| |||dW S  tjyP   Y nw t|d}tjd| ||d\}}}}	|	dd }t rd|dd|df}
|j}td||
| |\}|S )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)rI   r   r   )r   rI   r   r   )r   r   r   r   r   r   r   r   r    r!   r"   nccl_broadcast_eager_fallbackr$   r%   
make_shaper(   r)   r*   r,   r+   r.   r/   )r   rI   r   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r9   r:   nccl_broadcastp   sD   rL   zraw_ops.NcclBroadcastc              	   C   s   t |d}t | g|tjtjtjtjtjg\}\} | g}d|d|f}t j	dd||||d}t 
 r;t d||| |\}|S )NrI   r   s   NcclBroadcastr<   r=   rH   )r%   rK   r?   r@   rA   rB   rC   rD   rE   r   r*   r/   )r   rI   r   r   rF   r8   r7   r2   r9   r9   r:   rJ      s   *
rJ   TV_NcclReduce_Tc              
   C   s@  t j pt  }|j}|jrQzt|d|| d|}|W S  tjy3 } zt	|| W Y d}~nd}~w tj
y<   Y nw z	t| |||dW S  tjyP   Y nw t| ttfs^td|  t| }t|d}tjd| ||d\}}}	}
|
dd }t rd|	dd|	dd|	df}|	j}td||| |\}|S )	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+   r,   r-   r.   r/   )r   r   r   r0   r1   r2   r3   _attr_num_devicesr4   r5   r6   r7   r8   r9   r9   r:   nccl_reduce   sX   
rW   zraw_ops.NcclReducec           	   	   C   s   t | ttfstd|  t| }t|d}tt| |tj	tj
tjtjtjg\}} t| }d|d|d|f}tjdd||||d}t rOtd||| |\}|S )	NrO   r   r   r   s
   NcclReducer<   r=   rN   )rQ   rR   rS   rT   rU   r%   r&   r?   r@   rA   rB   rC   rD   rE   r   r*   r/   )	r   r   r   r   rV   rF   r8   r7   r2   r9   r9   r:   rP      s,   *

rP   )N)6__doc__collectionsZtensorflow.pythonr   Ztensorflow.python.eagerr   r   r   r   r   r%   Ztensorflow.python.frameworkr   r@   Ztensorflow.security.fuzzing.pyr   Z_atypesr   Z_op_def_registryr	   r    r
   r(   Z"tensorflow.python.util.deprecationr   Ztensorflow.python.utilr   	_dispatchZ tensorflow.python.util.tf_exportr   typingr   r   ZFloat32ZFloat64ZHalfZInt32ZInt64r   ZTensorFuzzingAnnotationstrintr;   Z	to_raw_opr   r#   rG   rL   rH   rJ   rM   rW   rN   rP   r9   r9   r9   r:   <module>   s6    ,@* 1(8*