o
    oi
                     @   sV   d dl Z d dlZddlmZ dd Zdd Zedrd	d Zd
d Zdd Ze  dS )    N   )_get_extension_pathc                 C   s|   zt | }tj| W dS  ttfy= } z"tjdr2ddl	}|
d|  dt|j d|  W Y d}~dS d}~ww )	zLoad a library, optionally warning on failure based on env variable.

    Returns True if the library was loaded successfully, False otherwise.
    T-TORCHVISION_WARN_WHEN_EXTENSION_LOADING_FAILSr   NzFailed to load 'z' extension: z: F)r   torchopsload_libraryImportErrorOSErrorosenvirongetwarningswarntype__name__)lib_namelib_pather    r   _/var/www/addictedbytheproject.nl/epg/venv/lib/python3.10/site-packages/torchvision/extension.py_load_library   s   "r   c                   C      dS )NFr   r   r   r   r   _has_ops      r   _Cc                   C   r   )NTr   r   r   r   r   r      r   c                   C   s   t  stdd S )Nag  Couldn't load custom C++ ops. This can happen if your PyTorch and torchvision versions are incompatible, or if you had errors while compiling torchvision from source. For further information on the compatible versions, check https://github.com/pytorch/vision#installation for the compatibility matrix. Please check your PyTorch version with torch.__version__ and your torchvision version with torchvision.__version__ and verify if they are compatible, and if not please reinstall torchvision so that it matches your PyTorch install. Set TORCHVISION_WARN_WHEN_EXTENSION_LOADING_FAILS=1 and retry to get more details.)r   RuntimeErrorr   r   r   r   _assert_has_ops#   s
   r   c               
   C   s   t  sdS ddlm}  tjj }|dkr_| dur_t|}t|dks+J d| dt|dd }t|d	 }| 	d
}t|d }t|d }||kr_t
d| d
| d| d
| d	|S )z`
    Make sure that CUDA versions match between the pytorch install and torchvision install
    r   )cudaNi.  zUnexpected CUDA version z, please file a bug report.      .r   zqDetected that PyTorch and torchvision were compiled with different CUDA major versions. PyTorch has CUDA Version=z" and torchvision has CUDA Version=zE. Please reinstall the torchvision that matches your PyTorch install.)r   torch.versionr   r   r   torchvision_cuda_versionstrintsplitr   )torch_version_cuda_version
tv_versiontv_majortv_minor	t_versiont_majort_minorr   r   r   _check_cuda_version1   s2   
r0   )r
   r   _internally_replaced_utilsr   r   r   r   r0   r   r   r   r   <module>   s    
