o
    iA                     @   s   U d Z ddlZddlZddlZG dd dZe Zdd Zdd Zej	 Z
i Zi Zd	d
 Zdd Zdd Zdd Ze Zejed< e Zejed< dd Zdd Zdd Zdd ZdS )zJIT-related state

This module stores various pieces of Python-global state relating to the JIT.

This is not intended to be imported directly; please the exposed
functionalities in `torch.jit`.
    Nc                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	EnabledProxyzyStores whether the JIT is enabled or not.

    This is just a wrapper for a bool, so that we get reference semantics
    c                 C   s   |  dddd| _d S )NZPYTORCH_JITTz> Using PyTorch JITz> PyTorch JIT DISABLED)	parse_envenabledself r   _/var/www/html/eduruby.in/lip-sync/lip-sync-env/lib/python3.10/site-packages/torch/jit/_state.py__init__   s   
zEnabledProxy.__init__c                 C   sp   t j|}|d u r|S | dv rdS | dv rdS |dkr&t| dS |dkr0t| dS td| d)	N>   true1yesT>   0nofalseFZ1vZ0vzUnknown setting of z. Try using 0 or 1.)osenvirongetlowerprint
ValueError)r   namedefaultZtrue_messageZfalse_messagevaluer   r   r   r      s   zEnabledProxy.parse_envc                 C   s   | j S N)r   r   r   r   r   __bool__)   s   zEnabledProxy.__bool__N)__name__
__module____qualname____doc__r	   r   r   r   r   r   r   r      s
    r   c                   C   
   dt _d S )NF_enabledr   r   r   r   r   disable0      
r"   c                   C   r   )NTr    r   r   r   r   enable4   r#   r$   c                 C   s   |t | < | t| < d S r   )_script_classes_name_to_pyclassqualified_name)python_classZscript_classr   r   r   _add_script_classC   s   r)   c                 C   s(   t | dd }|d urt|} t| d S )NZ_jit_override_qualname)getattr_get_python_classr%   r   )r(   overrider   r   r   _get_script_classH   s   r-   c                 C   s   t | d S r   )r&   r   r'   r   r   r   r+   O   s   r+   c                   C   s   t   t  d S r   )r%   clearr&   r   r   r   r   _clear_class_stateS   s   r0   _jit_caching_layer_jit_function_overload_cachingc                 C   s"   t | d }|rdd |D S d S )Nc                 S   s   g | ]}t |qS r   )
_python_cufind_function).0	qual_namer   r   r   
<listcomp>g   s    z1_try_get_jit_cached_overloads.<locals>.<listcomp>)r2   r   )keyZ
qual_namesr   r   r   _try_get_jit_cached_overloadsd   s   r9   c                 C   s   dd |D t | < d S )Nc                 S   s   g | ]}|j qS r   r.   )r5   fnr   r   r   r7   m   s    z+_set_jit_overload_cache.<locals>.<listcomp>)r2   )r8   Zcompiled_fnsr   r   r   _set_jit_overload_cachel   s   r;   c                 C   s2   t | dddu r
d S t| d }|rt|S d S )NZ __disable_jit_function_caching__FT)r*   r1   r   r3   r4   )r8   r6   r   r   r   _try_get_jit_cached_functionp   s   
r<   c                 C   s    t |tjjs	J |jt| < d S r   )
isinstancetorchZjitZScriptFunctionr'   r1   )r8   r   r   r   r   _set_jit_function_cachez   s   r?   )r   r   weakrefr>   r   r!   r"   r$   Z_CZCompilationUnitr3   r%   r&   r)   r-   r+   r0   WeakKeyDictionaryr1   __annotations__r2   r9   r;   r<   r?   r   r   r   r   <module>   s*    

