o
    i e$                     @   sH  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  d"de!de"fddZ#ede$e#Z%de!de"fddZ&d#de!fddZ'ede$e'Z(de!fddZ)d#de!fddZ*ede$e*Z+de!fd d!Z,d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ListFtokenis_asyncc                 C   sz  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|ttfsjtd| dd	 |D }|du rwd
}t|d}tjd| ||||d\}	}	}
}|dd }|s|
S t rd|
dd|
dd|
dd|
df}|
j}td||| |S )a  Eagerly executes a python function to compute func(input)->output. The

  semantics of the input, output, and attributes are the same as those for
  PyFunc.

  Args:
    input: A list of `Tensor` objects.
    token: A `string`.
    Tout: A list of `tf.DTypes`.
    is_async: An optional `bool`. Defaults to `False`.
    name: A name for the operation (optional).

  Returns:
    A list of `Tensor` objects of type `Tout`.
  EagerPyFuncr   r   ToutN)r   r   r   namectx@Expected list for 'Tout' argument to 'eager_py_func' Op, not %r.c                 S      g | ]}t |d qS r   _execute	make_type.0_t r   S/var/www/myenv/lib/python3.10/site-packages/tensorflow/python/ops/gen_script_ops.py
<listcomp>@       z!eager_py_func.<locals>.<listcomp>F)inputr   r   r   r   Tin)_contextr   _thread_local_datais_eagerr   TFE_Py_FastPathExecute_core_NotOkStatusException_opsraise_from_not_ok_status_FallbackExceptioneager_py_func_eager_fallback_SymbolicExceptionr   make_str
isinstancelisttuple	TypeError	make_bool_op_def_library_apply_op_helpermust_record_gradientget_attr_get_attr_boolinputsrecord_gradient)r#   r   r   r   r   _ctxtld_resulte__op_outputs_attrs_inputs_flatr   r   r    eager_py_func   sf   


rF   zraw_ops.EagerPyFuncc           
      C   s   t |d}t|ttfstd| dd |D }|d u r d}t |d}t | |\}} t| }d|d|d|d|f}t jd	t	|||||d
}	t 
 rUt d|||	 |	S )Nr   r   c                 S   r   r   r   r   r   r   r    r!   \   r"   z0eager_py_func_eager_fallback.<locals>.<listcomp>Fr   r$   r   s   EagerPyFuncr;   attrsr   r   r   )r   r0   r1   r2   r3   r4   r5   convert_to_mixed_eager_tensorsr   lenr8   r<   )
r#   r   r   r   r   r   	_attr_TinrE   rD   r?   r   r   r    r.   V   s0   r.   c              
   C   sP  t j pt  }|j}|jrTzt|d|| d|d|}|W S  tjy5 } zt	|| W Y d}~nd}~w tj
y>   Y nw z
t| ||||dW S  tjyS   Y nw t|d}t|ttfsgtd| dd |D }tjd| |||d	\}}}	}
|
dd }|s|	S t rd|	dd
|	d
d|	df}|	j}td||| |S )aU  Invokes a python function to compute func(input)->output.

  This operation is considered stateful. For a stateless version, see
  PyFuncStateless.

  Args:
    input: A list of `Tensor` objects.
      List of Tensors that will provide input to the Op.
    token: A `string`.
      A token representing a registered python function in this address space.
    Tout: A list of `tf.DTypes`. Data types of the outputs from the op.
      The length of the list specifies the number of outputs.
    name: A name for the operation (optional).

  Returns:
    A list of `Tensor` objects of type `Tout`.
  PyFuncr   r   Nr   r   r   r   :Expected list for 'Tout' argument to 'py_func' Op, not %r.c                 S   r   r   r   r   r   r   r    r!      r"   zpy_func.<locals>.<listcomp>r#   r   r   r   r$   )r%   r   r&   r'   r   r(   r)   r*   r+   r,   r-   py_func_eager_fallbackr/   r   r0   r1   r2   r3   r4   r6   r7   r8   r9   r;   r<   r#   r   r   r   r=   r>   r?   r@   rA   rB   rC   rD   rE   r   r   r    py_funcl   sX   


rR   zraw_ops.PyFuncc           	      C      t |d}t|ttfstd| dd |D }t | |\}} t| }d|d|d|f}t jdt|||||d}t 	 rGt 
d	||| |S )
Nr   rN   c                 S   r   r   r   r   r   r   r    r!      r"   z*py_func_eager_fallback.<locals>.<listcomp>r$   r   s   PyFuncrG   rL   r   r0   r1   r2   r3   r4   rI   r   rJ   r8   r<   	r#   r   r   r   r   rK   rE   rD   r?   r   r   r    rP      s&   rP   c              
   C   sH  t j pt  }|j}|jrTzt|d|| d|d|}|W S  tjy5 } zt	|| W Y d}~nd}~w tj
y>   Y nw z
t| ||||dW S  tjyS   Y nw t|d}t|ttfsgtd| dd |D }tjd| |||d	\}}}	}
|
dd }t rd|	dd
|	d
d|	df}|	j}td||| |S )zA stateless version of PyFunc.

  Args:
    input: A list of `Tensor` objects.
    token: A `string`.
    Tout: A list of `tf.DTypes`.
    name: A name for the operation (optional).

  Returns:
    A list of `Tensor` objects of type `Tout`.
  PyFuncStatelessr   r   NrM   DExpected list for 'Tout' argument to 'py_func_stateless' Op, not %r.c                 S   r   r   r   r   r   r   r    r!      r"   z%py_func_stateless.<locals>.<listcomp>rO   r$   )r%   r   r&   r'   r   r(   r)   r*   r+   r,   r-    py_func_stateless_eager_fallbackr/   r   r0   r1   r2   r3   r4   r6   r7   r8   r9   r;   r<   rQ   r   r   r    py_func_stateless   sT   


rY   zraw_ops.PyFuncStatelessc           	      C   rS   )
Nr   rW   c                 S   r   r   r   r   r   r   r    r!      r"   z4py_func_stateless_eager_fallback.<locals>.<listcomp>r$   r   s   PyFuncStatelessrG   rV   rT   rU   r   r   r    rX      s(   rX   )FN)N)-__doc__collectionstensorflow.pythonr   tensorflow.python.eagerr   r%   r   r)   r   r   tensorflow.python.frameworkr   _dtypestensorflow.security.fuzzing.pyr   _atypesr   _op_def_registryr	   r+   r
   r6   "tensorflow.python.util.deprecationr   tensorflow.python.utilr   	_dispatch tensorflow.python.util.tf_exportr   typingr   r   strboolrF   	to_raw_opr   r.   rR   rL   rP   rY   rV   rX   r   r   r   r    <module>   s0    ;6.