U
    ¯Ê¹j›  ã                   @   s(   d Z ddlZddlZdd„ Zdd„ ZdS )zP JIT scripting/tracing utils

Hacked together by / Copyright 2020 Ross Wightman
é    Nc                   C   s<   t tjdƒstdƒ‚tj d¡ tj d¡ tj d¡ dS )zÞ Set JIT executor to legacy w/ support for op fusion
    This is hopefully a temporary need in 1.5/1.5.1/1.6 to restore performance due to changes
    in the JIT exectutor. These API are not supported so could change.
    Ú_jit_set_profiling_executorzOld JIT behavior doesn't exist!FTN)ÚhasattrÚtorchÚ_CÚAssertionErrorr   Ú_jit_set_profiling_modeÚ_jit_override_can_fuse_on_gpu© r	   r	   úM/var/www/html/bwave/python/venv/lib/python3.8/site-packages/timm/utils/jit.pyÚset_jit_legacy
   s    r   c                 C   sv  | dkrnt j d¡ t j d¡ t j d¡ t j d¡ t j d¡ zt j d¡ W n tk
rh   Y nX �n| dks~| dkrÖt j d¡ t j d¡ t j d¡ t j d¡ zt j d¡ W n tk
rÒ   Y nX nœ| dksè| dk�r\dt	j
d	< t j d¡ t j d¡ t j d¡ t j ¡  t j ¡  t j d¡ t j d¡ t j d¡ t j d¡ nd�srtd
| › d�ƒ‚d S )NÚteTFÚoldÚlegacyZnvfuserZnvfÚ1Z PYTORCH_NVFUSER_DISABLE_FALLBACKzInvalid jit fuser (ú))r   r   r   r   Z_jit_override_can_fuse_on_cpur   Z_jit_set_texpr_fuser_enabledZ_jit_set_nvfuser_enabledÚ	ExceptionÚosÚenvironZ_jit_can_fuse_on_cpuZ_jit_can_fuse_on_gpuZ_jit_set_nvfuser_guard_moder   )Zfuserr	   r	   r
   Úset_jit_fuser   s>    



r   )Ú__doc__r   r   r   r   r	   r	   r	   r
   Ú<module>   s   