
    BVhj
                     6    d Z ddlmZ  G d de      Z	 	 ddZy)zExecutor for eager execution.    )
pywrap_tfec                   :    e Zd ZdZdgZd Zd Zd Zd Zd Z	d Z
y	)
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                     || _         y Nr   )selfhandles     P/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/eager/executor.py__init__zExecutor.__init__)   s	    DL    c                     	 | j                          t        j                  | j                         y # t        $ r Y y w xY wr   )waitr   TFE_DeleteExecutorr   	TypeErrorr
   s    r   __del__zExecutor.__del__,   s6    	
iik##DLL1  s   /2 	>>c                 @    t        j                  | j                        S r   )r   TFE_ExecutorIsAsyncr   r   s    r   is_asynczExecutor.is_async9   s    ))$,,77r   c                     | j                   S r   r	   r   s    r   r   zExecutor.handle<   s    <<r   c                 B    t        j                  | j                         y)z4Waits for ops dispatched in this executor to finish.N)r   "TFE_ExecutorWaitForAllPendingNodesr   r   s    r   r   zExecutor.wait?   s    11$,,?r   c                 B    t        j                  | j                         y)z7Clears errors raised in this executor during execution.N)r   TFE_ExecutorClearErrorr   r   s    r   clear_errorzExecutor.clear_errorC   s    %%dll3r   N)__name__
__module____qualname____doc__	__slots__r   r   r   r   r   r    r   r   r   r      s/    $ k)
8@4r   r   c                 F    t        j                  | ||      }t        |      S r   )r   TFE_NewExecutorr   )enable_asyncenable_streaming_enqueuein_flight_nodes_limitr   s       r   new_executorr)   H   s'     %%l4L&;=&	&	r   N)Tr   )r!   tensorflow.pythonr   objectr   r)   r#   r   r   <module>r,      s'    $ (14v 14j +/'(r   