
    9j
                     \    d dl Z d dlZddlmZ d Zd Z ed      rd Zd Zd	 Z e        y)
    N   )_get_extension_pathc           	      2   	 t        |       }t        j                  j                  |       y# t        t
        f$ rZ}t        j                  j                  d      r1ddl	}|j                  d|  dt        |      j                   d|        Y d}~yd}~ww xY 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   s       U/media/conek/DATA/Code/OCR/venv/lib/python3.12/site-packages/torchvision/extension.py_load_libraryr      s    
	&x0		x(! ::>>IJMM,XJmDGDTDTCUUWXYWZ[\s   *- BABBc                       y)NF r       r   _has_opsr      s    r   _Cc                       y)NTr   r   r   r   r   r      s    r   c                  .    t               st        d      y )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   _assert_has_opsr    #   s    :a	
 		
 r   c                     t               syddlm}  t        j                  j
                  j                         }|dk7  r| t        |      }t        |      dk\  sJ d| d       t        |dd       }t        |d         }| j                  d	      }t        |d         }t        |d
         }||k7  rt        d| d	| d| d	| d	      |S )z`
    Make sure that CUDA versions match between the pytorch install and torchvision install
    r   )cudai.  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_minors           r   _check_cuda_versionr5   1   s     :8yy$$224H2~,8]
:%'i+CH:Mh)ii'z!A'z!}%&,,S1	il#il#h,,39AgY ?  (z8* 5VV  Or   )r   r   _internally_replaced_utilsr   r   r   r    r5   r   r   r   <module>r7      s9    	  ;" 
6  r   