a
    áñhÁ  ã                	   @   s\   d Z dd„ Zdd„ Zzeƒ  dZ dd„ ZW n eefy@   Y n0 dd„ Zd	d
„ Zeƒ  dS )Fc                   C   s   dS )NF© r   r   r   úU/home/yuhw/wc/uboone-dl-vtx/venv/lib/python3.9/site-packages/torchvision/extension.pyÚ_has_ops   s    r   c                  C   s  dd l } dd l}dd l}| j t¡}| jdkrÌdd l}dd l}|j	ddd�}t
|dƒ}| d¡}|rn|j|j_|jdkr„|  |¡ n>|rÂ| |¡}	|	d u rÂ| | ¡ ¡}
|
 jd	|› d
�7  _|
‚| |¡ |jj|jjf}|j ||¡}| d¡}|d u �rt‚|j |j¡ d S )Né    Úntzkernel32.dllT)Úuse_last_errorÚAddDllDirectoryé   )é   é   z Error adding "z" to the DLL directories.Z_C)ÚosÚ	importlibÚtorchÚpathÚdirnameÚ__file__ÚnameÚctypesÚsysÚWinDLLÚhasattrZSetErrorModeÚc_void_pr   ÚrestypeÚversion_infoZadd_dll_directoryZWinErrorZget_last_errorÚstrerrorÚ	machineryÚExtensionFileLoaderÚEXTENSION_SUFFIXESÚ
FileFinderÚ	find_specÚImportErrorÚopsZload_libraryÚorigin)r   r   r   Úlib_dirr   r   Úkernel32Zwith_load_library_flagsZprev_error_modeÚresÚerrÚloader_detailsZ	extfinderZ	ext_specsr   r   r   Ú_register_extensions   s:    






þ

r'   Tc                   C   s   dS )NTr   r   r   r   r   r   6   s    c                   C   s   t ƒ stdƒ‚d S )Na  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.)r   ÚRuntimeErrorr   r   r   r   Ú_assert_has_ops<   s    ÿr)   c                  C   sÌ   t sdS ddl} | jj ¡ }|dkrÈ| jjdurÈt|ƒ}t|ƒdk r^t|d ƒ}t|d ƒ}nt|dd… ƒ}t|d ƒ}| jj}| 	d¡}t|d ƒ}t|d ƒ}||ks´||krÈt
d	 ||||¡ƒ‚|S )
z`
    Make sure that CUDA versions match between the pytorch install and torchvision install
    éÿÿÿÿr   Ni'  é   r	   Ú.r   zÜDetected that PyTorch and torchvision were compiled with different CUDA versions. PyTorch has CUDA Version={}.{} and torchvision has CUDA Version={}.{}. Please reinstall the torchvision that matches your PyTorch install.)Ú_HAS_OPSr   r    ZtorchvisionZ_cuda_versionÚversionZcudaÚstrÚintÚsplitr(   Úformat)r   Ú_versionZ
tv_versionZtv_majorZtv_minorZ	t_versionZt_majorZt_minorr   r   r   Ú_check_cuda_versionI   s(    
ýr4   N)r-   r   r'   r   ÚOSErrorr)   r4   r   r   r   r   Ú<module>   s   *