a
    db                     @   sV   d dl Z d dlZd dlZd dlmZ ddlmZ eeZ	eedd Z
dd ZdS )	    N)register_backend   )fake_tensor_unsupportedc                 C   s   zdd l }W n ty*   td  Y n0 zLt . tj|  |}tj	|}W d    n1 sj0    Y  |W S  t
y   td |  Y S 0 d S )Nr   zUnable to import Intel Extension for PyTorch (IPEX). Please install the right version of IPEX that matches the PyTorch version being used. Refer to https://github.com/intel/intel-extension-for-pytorch for details.z4JIT trace failed during the 'ipex' optimize process.)intel_extension_for_pytorchImportErrorlog	exceptiontorchZno_gradZjittraceevalfreeze	Exceptionwarning)modelinputsr   Ztraced_model r   d/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/torch/_dynamo/backends/ipex.pyipex   s    
*
r   c                   C   s*   zt d W dS  ty$   Y dS 0 d S )Nr   TF)	importlibimport_moduler   r   r   r   r   has_ipex"   s
    
r   )r   loggingr	   Ztorch._dynamor   commonr   	getLogger__name__r   r   r   r   r   r   r   <module>   s   
