o
    ®Ÿ?ej
  ã                   @   s2   d Z ddlmZ G dd„ deƒZ		d	dd„ZdS )
zExecutor for eager execution.é    )Ú
pywrap_tfec                   @   sF   e Zd ZdZdgZdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Z	dd„ Z
dS )ÚExecutorañ  A class for handling eager execution.

  The default behavior for asynchronous execution is to serialize all ops on
  a single thread. Having different `Executor` objects in different threads
  enables executing ops asynchronously in parallel:

  ```python
  def thread_function():
    executor = executor.Executor(enable_async=True):
    context.set_executor(executor)

  a = threading.Thread(target=thread_function)
  a.start()
  b = threading.Thread(target=thread_function)
  b.start()
  ```
  Ú_handlec                 C   s
   || _ d S ©N©r   )ÚselfÚhandle© r	   úa/home/www/facesmatcher.com/pyenv/lib/python3.10/site-packages/tensorflow/python/eager/executor.pyÚ__init__)   s   
zExecutor.__init__c                 C   s0   z|   ¡  t | j¡ W d S  ty   Y d S w r   )Úwaitr   ZTFE_DeleteExecutorr   Ú	TypeError©r   r	   r	   r
   Ú__del__,   s   úzExecutor.__del__c                 C   s   t  | j¡S r   )r   ZTFE_ExecutorIsAsyncr   r   r	   r	   r
   Úis_async9   s   zExecutor.is_asyncc                 C   s   | j S r   r   r   r	   r	   r
   r   <   s   zExecutor.handlec                 C   ó   t  | j¡ dS )z4Waits for ops dispatched in this executor to finish.N)r   Z"TFE_ExecutorWaitForAllPendingNodesr   r   r	   r	   r
   r   ?   ó   zExecutor.waitc                 C   r   )z7Clears errors raised in this executor during execution.N)r   ZTFE_ExecutorClearErrorr   r   r	   r	   r
   Úclear_errorC   r   zExecutor.clear_errorN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   r   r   r   r   r	   r	   r	   r
   r      s    r   Tc                 C   s   t  | ||¡}t|ƒS r   )r   ZTFE_NewExecutorr   )Zenable_asyncZenable_streaming_enqueueZin_flight_nodes_limitr   r	   r	   r
   Únew_executorH   s   ÿr   N)Tr   )r   Ztensorflow.pythonr   Úobjectr   r   r	   r	   r	   r
   Ú<module>   s   5þ