U
    E‹Ñh  ã                   @   s   d Z ddlZddd„ZdS )za
APIs related to torch.compile which lazily import torch._dynamo to avoid
circular dependencies.
é    NTc                    s6   ˆ dk	r$t  ˆ ¡‡ ‡fdd„ƒ}|S t jtˆd�S 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.
    Nc                     s:   t ˆ dd ƒ}|d kr0dd l}|j ˆ ˆ¡}|ˆ _|| |ŽS )NÚ__dynamo_disabler   )ÚgetattrZtorch._dynamoZ_dynamoÚdisabler   )ÚargsÚkwargsZ
disable_fnZtorch©ÚfnÚ	recursive© ú</tmp/user/2202/pip-unpacked-wheel-bf9o3bgk/torch/_compile.pyÚinner   s    z_disable_dynamo.<locals>.inner)r	   )Ú	functoolsÚwrapsÚpartialÚ_disable_dynamo)r   r	   r   r
   r   r   r   	   s
    
r   )NT)Ú__doc__r   r   r
   r
   r
   r   Ú<module>   s   