o
    i                     @   s   d Z ddlZddlmZ ddlmZmZ ddlmZ edZ	edZ
e	dd	ee
e	f d
edee
e	f fddZe	dd	dd
edeee
e	f gee
e	f f fddZ	dd	ee
e	f dB d
edee
e	f eee
e	f gee
e	f f B fddZdS )za
APIs related to torch.compile which lazily import torch._dynamo to avoid
circular dependencies.
    N)Callable)overloadTypeVar)	ParamSpec_T_PTfn	recursivereturnc                 C      d S N r   r	   r   r   P/sda-disk/www/egybert/egybert_env/lib/python3.10/site-packages/torch/_compile.py_disable_dynamo      r   c                 C   r   r   r   r   r   r   r   r      r   c                    sD    durt  dtjdtjdtf fdd}|S t jtdS )au  
    This API should be only used inside torch, external users should still use
    torch._dynamo.disable. The main goal of this API is to avoid circular
    imports issues that is common while using _dynamo.disable inside torch
    itself.

    This API avoids it by lazily importing torch._dynamo from the import time to
    the invocation of the decorated function.
    Nargskwargsr
   c                     sB   t  dd }|d u rdd l}|jj dd}| _|| i |S )N__dynamo_disabler   F)wrapping)getattrtorch._dynamo_dynamodisabler   )r   r   
disable_fntorchr   r   r   inner*   s   z_disable_dynamo.<locals>.inner)r	   )	functoolswrapsr   r   r   r   partialr   )r   r	   r   r   r   r   r      s
   ")T)NT)__doc__r   collections.abcr   typingr   r   typing_extensionsr   r   r   boolr   r   r   r   r   <module>   sB    

(