
    ȅi                         % S SK r S SKrS SKrS SKJr  S SKJr  S SKrS SKJ	r	J
r
JrJrJrJr  SSKJr   S SKJr  Sq\\   \S'   \b  S	 rOS
 rS r\R2                  \R4                  \R6                  1rS rS r      SS jr\      SS j5       r  " S S\5      r!\!" \RD                  \#   \#5      \RD                  \#'   \$\S'   \$\S'   \$\S'   \$\S'   \\S'   g! \ a    Sr Nf = f)    N)contextmanager)Optional)__allow_nonbracketed_mutation_FP32Precision_get_fp32_precision_getter_set_fp32_precision_setterContextProp
PropModule   )rnn)_cudnn__cudnn_versionc                    ^ [         Gc  [        R                  " 5       q [        R                  " 5       n [        R                  " 5       nU u  p#nUu  pVnX%:w  a  SnO$US:  d  [        R
                  (       d  X6:H  nOX6:  nU(       d  [        R                  R                  SS5      S:X  a  gSU SU  S	3nS
[        R                  ;   aX  [        R                  R                  S
S5      m[        U4S jS 5       5      (       a  [        U SU 35      e[        U S35      e[        U5      e[        R                  R                  5       (       a  [        R                  R                  (       d  [!        [#        [        R                  R%                  5       5       V	s/ s H"  n	[        R                  R'                  U	5      PM$     sn	5      n
[         S:  a  U
S:  a  [        S[          S35      egs  sn	f )NF   &PYTORCH_SKIP_CUDNN_COMPATIBILITY_CHECK01Tz=cuDNN version incompatibility: PyTorch was compiled  against z but found runtime version z. PyTorch already comes bundled with cuDNN. One option to resolving this error is to ensure PyTorch can find the bundled cuDNN. LD_LIBRARY_PATH c              3   ,   >#    U  H	  oT;   v   M     g 7fN ).0	substringld_library_paths     W/home/james-whalen/.local/lib/python3.13/site-packages/torch/backends/cudnn/__init__.py	<genexpr>_init.<locals>.<genexpr>G   s      FW_4FWs   )cudacudnnzLooks like your LD_LIBRARY_PATH contains incompatible version of cudnn. Please either remove it from the path or install cudnn zHone possibility is that there is a conflicting cuDNN in LD_LIBRARY_PATH.ic )r      zcuDNN version z is not compatible with devices with SM < 7.5. Please install a version of PyTorch with a compatible cuDNN version. https://github.com/pytorch/pytorch/blob/main/RELEASE.md#release-compatibility-matrix)r   r   getVersionIntgetRuntimeVersiongetCompileVersionis_cudaosenvirongetanyRuntimeErrortorchr   is_availableversionhipminrangedevice_countget_device_capability)runtime_versioncompile_versionruntime_majorruntime_minor_compile_majorcompile_minorcudnn_compatiblebase_error_msgimin_ccr   s              @r   _initr>   $   s   "$224O$668O$668O.=+M!.=+M! -#( "&..#0#A #0#A #::>>"JCPTWW55D4E F11@0A B34  %

2&(jjnn5F&KO FW   +-.VVeUfh  +-.DE  '~66zz&&((1B1B "'uzz'>'>'@!A!AA 

88;!A #e+&((9 :o p  s   )G/c                      g)NFr   r       r   r>   r>   j   s    r@   c                  .    [        5       (       d  g[        $ )zReturn the version of cuDNN.N)r>   r   r   r@   r   r-   r-   n   s    77r@   c                  6    [         R                  R                  $ )z9Return a bool indicating if CUDNN is currently available.)r+   _C
_has_cudnnr   r@   r   r,   r,   |   s    88r@   c                    [         R                  R                  5       (       d  gU R                  R                  S:w  d  U R
                  [        ;  a  g[        5       (       d  [        R                  " SSS9  g[        5       (       dD  [        R                  " SR                  SSS	.R                  [        R                  S
5      S9SS9  gg)NFr   zPyTorch was compiled without cuDNN/MIOpen support. To use cuDNN/MIOpen, rebuild PyTorch making sure the library is visible to the build system.   )
stacklevelz4cuDNN/MIOpen library not found. Check your {libpath}DYLD_LIBRARY_PATHPATH)darwinwin32r   )libpathT)r+   rC   _get_cudnn_enableddevicetypedtypeCUDNN_TENSOR_DTYPESr,   warningswarnr>   formatr(   sysplatform)tensors    r   is_acceptablerX      s    88&&((}}V#v||;N'N>>N	

 77BII#6HLLLL"3 J 
 	
 r@   c           	      F   [         R                  R                  5       [         R                  R                  5       [	        5       (       d  S O[         R                  R                  5       [         R                  R                  5       [         R                  R                  5       [         R                  R                  SS5      4nU b  [         R                  R                  U 5        Ub  [         R                  R                  U5        Ub.  [	        5       (       a  [         R                  R                  U5        Ub  [         R                  R                  U5        Ub  [         R                  R                  U5        Ub!  [         R                  R                  SSU5        U$ )Nr   all)r+   rC   rM   _get_cudnn_benchmarkr,   _cuda_get_cudnn_benchmark_limit_get_cudnn_deterministic_get_cudnn_allow_tf32r   _set_cudnn_enabled_set_cudnn_benchmark_cuda_set_cudnn_benchmark_limit_set_cudnn_deterministic_set_cudnn_allow_tf32r   )_enabled
_benchmark_benchmark_limit_deterministic_allow_tf32_fp32_precision
orig_flagss          r   	set_flagsrk      s    	##%%%' NN(P(P(R))+&&(++FE:J ##H-%%j1#001AB!)).9&&{3"++FE?Kr@   c           	   #   8  #    [        5          [        U UUUUU5      nS S S 5         S v   [        5          [        W6   S S S 5        g ! , (       d  f       N/= f! , (       d  f       g = f! [        5          [        W6   S S S 5        f ! , (       d  f       f = f= f7fr   )r   rk   )enabled	benchmarkbenchmark_limitdeterministic
allow_tf32fp32_precisionrj   s          r   flagsrs      sy      
'	(

 
)# +,z" -, 
)	( -,*,z" -,,s_   BABA) 
B	A	B
AB
A&"B)B4	B=	B
BBBc                   Z   \ rS rSr\" \R                  R                  \R                  R                  5      r	\" \R                  R                  \R                  R                  5      r\" \R                  R                  \R                  R                  5      rSr\" 5       (       a1  \" \R                  R$                  \R                  R&                  5      r\" \R                  R(                  \R                  R*                  5      r\" SS5      r\" \" SS5      \" SS5      5      rSrg)CudnnModule   Nr   convrZ   r   )__name__
__module____qualname____firstlineno__r	   r+   rC   rM   r_   rm   r]   rb   rp   r[   r`   rn   ro   r,   r\   ra   r^   rc   rq   r   rw   r   r   rr   __static_attributes__r   r@   r   ru   ru      s    %((55uxx7R7RSG))588+L+LM %%uxx'D'DI O~~%HH44HH44
 &&(F(FJ &&)D "651"651Nr@   ru   rm   rp   rn   rq   ro   )NNNNNnone)FF
   FTr}   )%r&   rU   rR   
contextlibr   typingr   r+   torch.backendsr   r   r   r   r	   r
   r   r   torch._Cr   ImportErrorr   int__annotations__r>   r-   halffloatdoublerQ   r,   rX   rk   rs   ru   modulesrx   boolr   r@   r   <module>r      s   	 
  %     "&# %	BL 
JJ	KK	LL 
4 > # #<* 4 $CKK$98DH  
   E  Fs   C C)(C)