
    קg                     @     G d  d          Z  e             Zd Zd ZdS )c                   >    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	S )
CompilationCallbackHandlerc                 "    g | _         g | _        d S )N)start_callbacksend_callbacksselfs    R/var/www/html/ai-engine/env/lib/python3.11/site-packages/torch/_dynamo/callback.py__init__z#CompilationCallbackHandler.__init__   s    !    c                 :    | j                             |           |S )z
        Register a callback function to be called when the compilation starts.

        Args:
        - callback (callable): The callback function to register.
        )r   appendr   callbacks     r	   register_start_callbackz2CompilationCallbackHandler.register_start_callback   s      	##H---r   c                 :    | j                             |           |S )z
        Register a callback function to be called when the compilation ends.

        Args:
        - callback (callable): The callback function to register.
        )r   r   r   s     r	   register_end_callbackz0CompilationCallbackHandler.register_end_callback   s      	!!(+++r   c                 :    | j                             |           dS )z
        Remove a registered start callback function.

        Args:
        - callback (callable): The callback function to remove.
        N)r   remover   s     r	   remove_start_callbackz0CompilationCallbackHandler.remove_start_callback   s!     	##H-----r   c                 :    | j                             |           dS )z
        Remove a registered end callback function.

        Args:
        - callback (callable): The callback function to remove.
        N)r   r   r   s     r	   remove_end_callbackz.CompilationCallbackHandler.remove_end_callback$   s!     	!!(+++++r   c                 .    | j         D ]} |             dS )z9
        Execute all registered start callbacks.
        N)r   r   s     r	   run_start_callbacksz.CompilationCallbackHandler.run_start_callbacks-   s-     , 	 	HHJJJJ	 	r   c                 .    | j         D ]} |             dS )z7
        Execute all registered end callbacks.
        N)r   r   s     r	   run_end_callbacksz,CompilationCallbackHandler.run_end_callbacks4   s-     * 	 	HHJJJJ	 	r   c                 j    | j                                          | j                                         dS )z1
        Clear all registered callbacks.
        N)r   clearr   r   s    r	   r   z CompilationCallbackHandler.clear;   s4     	""$$$  """""r   N)__name__
__module____qualname__r
   r   r   r   r   r   r   r    r   r	   r   r      s                 . . ., , ,    # # # # #r   r   c                 :    t                               |            | S )zU
    Decorator to register a callback function for the start of the compilation.
    )callback_handlerr   r   s    r	   on_compile_startr%   F   s     ,,X666Or   c                 :    t                               |            | S )zS
    Decorator to register a callback function for the end of the compilation.
    )r#   r   r$   s    r	   on_compile_endr'   N   s     **8444Or   N)r   r#   r%   r'   r!   r   r	   <module>r(      sg   ># ># ># ># ># ># ># >#B .-//       r   