Ë
    øÿæiE¥ ã                   ój  — U d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddlZddlmZ ddlmZmZmZmZmZ ddlmZmZm Z! dejD                  fd„Z#ddl$m%Z&m'Z'm(Z( dd	l)m*Z*m+Z+m,Z,m-Z-m.Z. dd
l/m0Z0 erddl1m2Z2m3Z3 g d¢Z4e4 e5e4«      k7  r e6d«      ‚	 ddl7m8Z8  e8jr                  «        [8e
j                  dk(  rdÙd„Z; e;«        [;de<de<de<de=e<   fd„Z>dÚde<de<de"ddfd„Z?dÛde@dz  ddfd„ZAdÙd„ZBe.s ej†                  d«      rg e	jˆ                  «       dk7  rS e
jŠ                  «       ZF e
jŽ                  ej�                  ej’                  z  «       ddlJ­  e
jŽ                  eF«       [Fne-r eB«        ddlJ­  G d„ d«      ZK G d „ d!«      ZL G d"„ d#«      ZMd$„ ZNd%„ ZOd&„ ZPd'„ ZQdeReReSd(f   eReSd(f   f   fd)„ZTd*„ ZUd+„ ZVd,„ ZWd-\  ZXZYZZd.D ]'  ZYd/eY› �ZZ eWeY«      ZXeZxeX_[        eX_\        eX e]«       eZ<   Œ) [X[Y[Z[W e]«       d0   Z^e4j¿                  d1«       d2„ Z`d3„ Za	 dd4lJmbZb dd6lhmcZc d7\  ZYZi ejec«      D ]‰  ZYeYd   d8k7  rceYj×                  d9«      sRe4j¿                  eY«        eleceY«      Zi emei«      s ejÜ                  ei«      sŒQeijÞ                  e\k7  sŒaeYd:vsŒfe\ei_o        ŒneYd;k(  sŒt epe
jâ                  e\   eY«       Œ‹ [Y[iesdÛd<„Zr erec«       [rd=ede<fd>„Zsd=ede!d?   fd@„Ztd=edejD                  fdA„Zu ejì                  «       awdÜdB„ZxdÝdD„ZydEeSd?   e<z  ddfdF„ZzdÞdG„Z{dHdIœdJejD                  dKejD                  ddfdL„Z|dejD                  fdM„Z}dejD                  fdN„Z~dOejþ                  e<z  ddfdP„Z€dejþ                  fdQ„Z�de<fdR„Z‚dSe<ddfdT„ZƒdUejD                  ddfdV„Z„dejD                  fdW„Z…dXejD                  eMz  dYeg e<f   fdZ„Z†dÛd[„Z‡ ed\eˆ¬]«      dÛdd^œd_„«       Z‰dÛd`„ZŠdÛda„Z‹dÛdb„ZŒdÛdc„Z�dÛdd„ZŽdÛde„Z�ddflm�Z�m‘Z‘m’Z’m“Z“ dZ”de•dg<   e4�j-                  g dh¢«       ddil—m˜Z˜ ddjlhm™Z™ ddklšm›Z›mœZœm�Z�mžZžmŸZŸ  G dl„ dme›«      Z  G dn„ doe›«      Z¡ G dp„ dqe›«      Z¢ G dr„ dse›«      Z£ G dt„ due›«      Z¤ G dv„ dwe›«      Z¥ G dx„ dye›«      Z¦ G dz„ d{e›«      Z§ G d|„ d}e›«      Z¨ G d~„ de›«      Z© G d€„ d�e›«      Zª G d‚„ dƒe›«      Z« G d„„ d…e›«      Z¬ G d†„ d‡e›«      Z­ G dˆ„ d‰e›«      Z® G dŠ„ d‹e›«      Z¯ G dŒ„ d�e›«      Z°eŸe¡e¢e¤e¥e¦e§e e£e¨e¬e­e®e©e«eªe¯e°ežhZ±e²eSežeŸz        e•dŽ<    e²«       Z³e²eSd?      e•d�<   dd�lhm´Z´mµZµm¶Z¶ dd‘l·m¸Z¸ dd’l¹mºZºm»Z» dd“l¼m½Z½m¾Z¾m¿Z¿mÀZÀmÁZÁ dd”lÂmÃZÃmÄZÄ d•„ ZÅ ecjÄ                   eÅ«       «       [ÅerddlÆ­ eÇZÈ[Çd–ZÉd7\  ZYZi ejec�j”                  «      D ]v  ZYeY�j—                  d—«      seYeÉv rŒ elec�j”                  eY«      Zie\ei_o        eYd˜k(  rei e]«       eY<   d8eYz   ZYei e]«       eY<   eY�j—                  d8«      rŒfe4j¿                  eY«       Œx [Y[iddlhZhe4�j-                  d™„  ejeh«      D «       «       ddšlÌmÍZÍ dd›lhmÎZÎmÏZÏ ddlÐ­ [œ[›dœ„ ZÑdd�lÒmÓZÓmÔZÔmÕZÕmÖZÖ ddžlhm×Z×mØZØmÙZÙmÚZÚmÛZÛmÜZÜmÝZÝmÞZÞmßZßmàZàmáZámâZâmãZãmäZämåZåmæZæmçZçmèZèméZémêZêmëZëmìZìmíZímîZîmïZïmðZðmñZñmòZòmóZómôZô ddŸlõmöZö dd lhm÷Z÷ ddløZhddlùZhddlúZhddlûZh ec�jø                   e=e±«      «       dd¡lhmýZýmþZþmÿZÿ�m �Z  �[ [ÿ[þ[ýdejD                  fd¢„�Zdd£lh�m�Z�m�Z dd¤�l�m�Z dd¥�l�m�Z e
jâ                  �j                  e\› d¦��e«       e
jâ                  �j                  e\› d§��e«       dd¨lh�m	�Z	 dd©lh�m
�Z
 �e�Zddª�l�m�Z  �eeh�j                  «       �[dd«�l�m�Z �e�j$                  �j&                  �Z�e�j$                  �j(                  �Zdd¬lh�m�Z dd­�l�m�Z�m�Z�m�Z�m�Z�m�Z dd®�l�m�Z�m�Z  G d¯„ d°«      �Z  G d±„ d²�e «      �Z! G d³„ d´«      �Z" edµ«      �Z# ed¶«      �Z$edHdd·dddHd¸œd¹e�e#�e$f   dºejD                  d»ejD                  dz  d¼e<ez  dJe<dz  d½�e%e<e<ejþ                  z  ejD                  z  ez  f   dz  d¾ejD                  de�e#�e$f   fd¿„«       �Z&e	 dÛdHdd·dddHd¸œd¹ddºejD                  d»ejD                  dz  d¼e<ez  dJe<dz  d½�e%e<e<ejþ                  z  ejD                  z  ez  f   dz  d¾ejD                  dee�e#�e$f   ge�e#�e$f   f   fdÀ„«       �Z&	 dÛdHdd·dddHd¸œd¹e�e#�e$f   dz  dºejD                  d»ejD                  dz  d¼e<ez  dJe<dz  d½�e%e<e<ejþ                  z  ejD                  z  ez  f   dz  d¾ejD                  dee�e#�e$f   ge�e#�e$f   f   e�e#�e$f   z  fdÁ„�Z&dÂ„ �Z'ddÃlh�m(�Z(�m)�Z)�m*�Z*�m+�Z+ ddÄ�l,�m-�Z-�m.�Z. ddÅ�l/�m0�Z0 es* �e1ehjÆ                  dÆ«      rdd�l2mßc �m3�Z4 �[4ddÇlh�m3�Z3 dÈe�jj                  v rdd�l6mÞc �m7�Z8  �e8�jr                  «        dd�l:ZhddÉlh�m;�Z; eh�j¸                  �jÌ                  �jy                  «        ddÊlh�m=�Z=  G dË„ dÌ«      �Z>eh�j¸                  �jÌ                  �j~                  eh�j¸                  �j¼                  �j~                  eh�j¸                  �j€                  �j‚                  eh�j¸                  �j„                  �j‚                  dÍœ�ZCerddÎlh�mD�ZD�mE�ZE�mF�ZF�mG�ZG n	h dÏ£�ZHdÐ„ �ZIe�j”                  dÛdCeh�j–                  e<z  dz  fdÑ„«       �ZL	 	 dßdÒejþ                  dz  dÓejþ                  dz  fdÔ„�ZMddÕlh�mN�ZN  �eN�jž                  «        dÖ„ �ZPdejD                  fd×„�ZQdØ„ �ZR �eQ«       r	 �eP«        yy# e:$ r Y �Œ0w xY w# e:$ r; ddlJmcZd edjÊ                  €' e: ejÌ                  d5«      jÏ                  «       «      d‚‚ w xY w)àa�  
The torch package contains data structures for multi-dimensional
tensors and defines mathematical operations over these tensors.
Additionally, it provides many utilities for efficient serialization of
Tensors and arbitrary types, and other useful utilities.

It has a CUDA counterpart, that enables you to run your tensor computations
on an NVIDIA GPU with compute capability >= 3.0.
é    N)ÚCallable)ÚAnyÚ
get_originÚoverloadÚTYPE_CHECKINGÚTypeVar)Ú
deprecatedÚ	ParamSpecÚTypeIsÚreturnc                   ó   — y)NF© r   ó    úc/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/torch/__init__.pyÚ_running_with_deployr   ,   s   € Ør   )Ú_functionalize_syncÚ_import_dotted_nameÚclassproperty)Úget_file_pathÚ#prepare_multiprocessing_environmentÚ1profiler_allow_cudagraph_cupti_lazy_reinit_cuda12ÚUSE_GLOBAL_DEPSÚUSE_RTLD_GLOBAL_WITH_LIBTORCH)Ú__version__)ÚDeviceÚIntLikeType)GÚBoolStorageÚ
BoolTensorÚByteStorageÚ
ByteTensorÚCharStorageÚ
CharTensorÚDoubleStorageÚDoubleTensorÚFloatStorageÚFloatTensorÚ
GradScalerÚ
IntStorageÚ	IntTensorÚLongStorageÚ
LongTensorÚShortStorageÚShortTensorÚSymBoolÚSymFloatÚSymIntÚTensorÚTypedStorageÚUntypedStorageÚ$are_deterministic_algorithms_enabledÚautocastÚchunkÚcompileÚcondÚenable_gradÚexportÚget_default_deviceÚget_deterministic_debug_modeÚget_device_moduleÚget_float32_matmul_precisionÚget_rng_stateÚinference_modeÚinitial_seedÚ-is_deterministic_algorithms_warn_only_enabledÚ
is_storageÚ	is_tensorÚis_warn_always_enabledÚloadÚlobpcgÚmanual_seedÚmatmulÚno_gradÚrandÚrandnÚsaveÚseedÚset_default_deviceÚset_default_tensor_typeÚset_deterministic_debug_modeÚset_float32_matmul_precisionÚset_printoptionsÚset_rng_stateÚset_warn_alwaysÚsplitÚstackÚ	sym_floatÚsym_fresh_sizeÚsym_intÚsym_iteÚsym_maxÚsym_minÚsym_notÚsym_sumÚtypenameÚunravel_indexÚuse_deterministic_algorithmsÚvmapz__all__ must be kept sortedé   )Ú
_rocm_initÚwin32c            
      ó
  — dd l } ddlm} t        j                  dd«      }t        j
                  j                  t        j                  dd«      }t        j
                  j                  t        j
                  j                  t        «      d«      }t        j
                  j                  | j                  d«      dd«      }t        j
                  j                  t        j                  d«      }t        j                  t        j                  k7  r0t        j
                  j                  t        j                  dd«      }nd	}|||||fD �cg c]#  }t        j
                  j                  |«      r|‘Œ% }	}t        j                  d
„ |	D «       «      sUt        j
                  j                  t        j                  dt        j
                  j                  |dd«      «      dd«      }
nd	}
|r�t        j                   d„ |	D «       «      rq|j#                  dd«      }d|z   }t        j
                  j                  |ddd|› �«      }t        j
                  j                  t        j                  ||«      d«      }nd	}|	j%                  d„ |
|fD «       «       t'        j(                  dd¬«      }t+        |d«      }|j-                  d«      }t&        j.                  |j0                  _        |rt&        j.                  |j4                  _        |	D ]  }t        j6                  |«       Œ 	 t'        j8                  d«       t'        j8                  d«       t;        j<                  «       dk7  rt'        j8                  d«       tI        jH                  t        j
                  j                  |d!«      «      }d"}|D ]û  }d"}|rb|j5                  |d d#«      }t'        jJ                  «       }|€5|d$k7  r0t'        jL                  |«      }|xjN                  d%|› d&�z  c_'        |‚|�d}|rŒl|s9d'j                  |	t        jP                  d(   gz   «      t        jP                  d(<   d}|j1                  |«      }|�Œ»t'        jL                  t'        jJ                  «       «      }|xjN                  d%|› d&�z  c_'        |‚ |j-                  |«       y c c}w # t>        $ r0 tA        tC        jD                  d «      jG                  «       «       Y �Œ„w xY w))Nr   ©ÚcudaÚProgramFileszC:\Program FilesÚLibraryÚbinÚlibÚuserbaseÚ c              3   ó–   K  — | ]A  }t         j                  j                  t         j                  j                  |d «      «      –— ŒC y­w)znvToolsExt64_1.dllN)ÚosÚpathÚexistsÚjoin©Ú.0Úps     r   Ú	<genexpr>z&_load_dll_libraries.<locals>.<genexpr>È   s1   è ø€ ð 
ÙKTÀaŒB�G‰G�N‰Nœ2Ÿ7™7Ÿ<™<¨Ð+?Ó@×AÉ9ùs   ‚AA	ÚNVTOOLSEXT_PATHzNVIDIA CorporationÚ
NvToolsExtÚx64c              3   ó„   K  — | ]8  }t        j                   t        j                  j                  |d «      «       –— Œ: y­w)zcudart64*.dllN)Úglobrq   rr   rt   ru   s     r   rx   z&_load_dll_libraries.<locals>.<genexpr>Ö   s/   è ø€ ð )
ÙENÀ”—	‘	œ"Ÿ'™'Ÿ,™, q¨/Ó:Ó;Ô;ÁYùs   ‚>A Ú.Ú_ÚCUDA_PATH_VzNVIDIA GPU Computing ToolkitÚCUDAÚvc              3   ó`   K  — | ]&  }t         j                  j                  |«      sŒ#|–— Œ( y ­w©N)rq   rr   rs   ru   s     r   rx   z&_load_dll_libraries.<locals>.<genexpr>â   s$   è ø€ ð 
Ù7�!¼2¿7¹7¿>¹>È!Õ;LŒAÑ7ùs   ‚$.§.zkernel32.dllT)Úuse_last_errorÚAddDllDirectoryrd   zvcruntime140.dllzmsvcp140.dllÚARM64zvcruntime140_1.dllzâ
                    Microsoft Visual C++ Redistributable is not installed, this may lead to the DLL load failure.
                    It can be downloaded at https://aka.ms/vs/17/release/vc_redist.x64.exe
                    z*.dllFi   é~   z Error loading "z" or one of its dependencies.Ú;ÚPATH))Ú	sysconfigÚtorch.versionri   rq   Úgetenvrr   rt   ÚsysÚexec_prefixÚdirnameÚ__file__Úget_config_varÚbase_exec_prefixrs   ÚbuiltinsÚanyÚallÚreplaceÚextendÚctypesÚWinDLLÚhasattrÚSetErrorModeÚc_void_pÚLoadLibraryWÚrestypeÚLoadLibraryExWÚadd_dll_directoryÚCDLLÚplatformÚmachineÚOSErrorÚprintÚtextwrapÚdedentÚstripr}   Úget_last_errorÚWinErrorÚstrerrorÚenviron)r‹   Úcuda_versionÚpfiles_pathÚpy_dll_pathÚth_dll_pathÚusebase_pathÚpy_root_bin_pathÚbase_py_dll_pathrw   Ú	dll_pathsÚnvtoolsext_dll_pathÚcuda_version_1Úcuda_path_varÚdefault_pathÚ	cuda_pathÚkernel32Úwith_load_library_flagsÚprev_error_modeÚdll_pathÚdllsÚpath_patchedÚdllÚ	is_loadedÚresÚ
last_errorÚerrs                             r   Ú_load_dll_librariesrÆ   ¦   s-  € Ûå6ä—i‘i Ð0CÓDˆÜ—g‘g—l‘l¤3§?¡?°I¸uÓEˆÜ—g‘g—l‘l¤2§7¡7§?¡?´8Ó#<¸eÓDˆÜ—w‘w—|‘|Ø×$Ñ$ ZÓ0°)¸Uó
ˆô Ÿ7™7Ÿ<™<¬¯©¸Ó?Ðô �?‰?œc×2Ñ2Ò2Ü!Ÿw™wŸ|™|¬C×,@Ñ,@À)ÈUÓSÑà!Ðð
 ØØ ØØ ñó

ñ�ô �w‰w�~‰~˜aÔ ò ðð 	ð 

ô �|‰|ñ 
ÙKTó
ô 
ô #%§'¡'§,¡,Ü—	‘	Ø%Ü—G‘G—L‘L Ð.BÀLÓQóð Øó#Ñð #%ÐáœHŸL™Lñ )
ÙENó)
ô 
ð *×1Ñ1°#°sÓ;ˆNØ)¨NÑ:ˆMÜŸ7™7Ÿ<™<ØÐ;¸VÀqÈÈÐEWóˆLô Ÿ™Ÿ™¤R§Y¡Y¨}¸lÓ%KÈUÓS‰IàˆIà×Ññ 
Ø+¨YÑ7ó
ô 	
ô —=‘= ÀÔEˆÜ")¨(Ð4EÓ"FÐØ"×/Ñ/°Ó7ˆä(.¯©ˆ×ÑÔ%Ù"Ü.4¯o©oˆH×#Ñ#Ô+ã!ˆHÜ× Ñ  Õ*ð "ð	Ü�K‰KÐ*Ô+Ü�K‰K˜Ô'Ü×ÑÓ! WÒ,Ü—‘Ð0Ô1ô �y‰yœŸ™Ÿ™ k°7Ó;Ó<ˆØˆÛˆCØˆIÙ&Ø×-Ñ-¨c°4¸ÓD�Ü#×2Ñ2Ó4�
Ø�; :°Ò#4Ü Ÿ/™/¨*Ó5�CØ—L’LØ*¨3¨%Ð/LÐMñ•Lð �IØ�_Ø $�IÚÙ#Ø),¯©°)¼r¿z¹zÈ&Ñ?QÐ>RÑ2RÓ)S”B—J‘J˜vÑ&Ø#'�LØ×+Ñ+¨CÓ0�Ø‘;Ü Ÿ/™/¬&×*?Ñ*?Ó*AÓB�CØ—L’LØ*¨3¨%Ð/LÐMñ•Lð �Ið/ ð2 	×Ñ˜oÕ.ùò

øôt ò 	ÜÜ—‘ðó÷
 ‘%“'÷ð	ús   Å(SÌ$AS Ó5S?Ó>S?rr   Ú
lib_folderÚlib_namec           
      ó’  — ddl m} t        j                  t        j                  j                  | d|d|«      «      }|�P|j                  d«      d   }|t        j                  t        j                  j                  | dd|› �d|«      «      z  }t        j                  t        j                  j                  | |d|«      «      }||z   S )Nr   rh   Únvidiarm   r~   Úcu)rŒ   ri   r}   rq   rr   rt   rV   )rr   rÇ   rÈ   r®   Únvidia_lib_pathsÚmaj_cuda_versionÚ	lib_pathss          r   Ú_get_cuda_dep_pathsrÏ   !  s±   € õ
 3ä—y‘yÜ
�‰�‰�T˜8 Z°¸ÓAóÐð ÐØ'×-Ñ-¨cÓ2°1Ñ5ÐØœDŸI™IÜ�G‰G�L‰L˜˜x¨2Ð.>Ð-?Ð)@À%ÈÓRó
ñ 	
Ðô —	‘	œ"Ÿ'™'Ÿ,™, t¨Z¸ÀÓIÓJ€Ià˜iÑ'Ð'r   Úrequiredc                 ó@  — t        j                  «       dk7  r t        dt        j                  «       › �«      ‚d}t        j                  D ]  }t        || |«      }|sŒ|d   } n |s |rt        |› dt        j                  › �«      ‚|rt        j                  |«       yy)z9Preloads cuda library if it could not be found otherwise.ÚLinuxz$Should only be called on Linux, got Nr   z not found in the system path )	r£   ÚsystemÚAssertionErrorrŽ   rr   rÏ   Ú
ValueErrorr™   r¢   )rÇ   rÈ   rÐ   Úlib_pathrr   Úcandidate_lib_pathss         r   Ú_preload_cuda_librØ   5  s–   € ô ‡�Ó˜GÒ#ÜÐCÄHÇOÁOÓDUÐCVÐWÓXÐXà€HÜ—”ˆÜ1°$¸
ÀHÓMÐÚØ*¨1Ñ-ˆHÙð	 ñ
 ™Ü˜H˜:Ð%CÄCÇHÁHÀ:ÐNÓOÐOÙÜ�‰�HÕð r   rÅ   c                 óÜ   — g d¢}| �<|D ��cg c],  \  }}|j                  dd«      d   | j                  d   v sŒ+|‘Œ. c}}s| ‚|D ]  \  }}t        ||«       Œ t        ddd¬«       y c c}}w )	N))ÚcublaszlibcublasLt.so.*[0-9])rÚ   zlibcublas.so.*[0-9])Úcudnnzlibcudnn.so.*[0-9])Ú
cuda_nvrtczlibnvrtc.so.*[0-9])rÜ   zlibnvrtc-builtins.so.*[0-9])Úcuda_runtimezlibcudart.so.*[0-9])Ú
cuda_cuptizlibcupti.so.*[0-9])Úcufftzlibcufft.so.*[0-9])Úcurandzlibcurand.so.*[0-9])Ú	nvjitlinkzlibnvJitLink.so.*[0-9])Úcusparsezlibcusparse.so.*[0-9])Ú
cusparseltzlibcusparseLt.so.*[0-9])Úcusolverzlibcusolver.so.*[0-9])Úncclzlibnccl.so.*[0-9])Únvshmemzlibnvshmem_host.so.*[0-9])Úcufilezlibcufile.so.*[0-9]r~   rd   r   ÚnvtxzlibnvToolsExt.so.*[0-9]F)rÐ   )rV   ÚargsrØ   )rÅ   Ú	cuda_libsr   rm   rÇ   rÈ   s         r   Ú_preload_cuda_depsrë   G  s€   € ò(€Ið0 €Ù#ô Ù#‘��3 s§y¡y°°aÓ'8¸Ñ';¸s¿x¹xÈ¹{Ò'JŠ˜)ó ð ˆ	ó !*Ñˆ
�HÜ˜* hÕ/ð !*ô �fÐ7À%ÖHùó s
   Œ,A(¹A(c                  ó¬  — t        j                  «       dk(  ry t        j                  «       dk(  rdnd} d| › �}t        j                  j	                  t
        «      }t        j                  j                  t        j                  j                  |«      d|«      }	 t        j                  |t        j                  ¬«       	 t        d«      5 }|j                  «       }d d d «       d	vry t        «        y # 1 sw Y   ŒxY w# t        $ r Y y w xY w# t        $ r:}t        |«       t        j                  |t        j                  ¬«       Y d }~y d }~ww xY w)
NÚWindowsÚDarwinz.dylibz.soÚlibtorch_global_depsrm   )Úmodez/proc/self/mapszlibcudart.so)r£   rÓ   rq   rr   Úabspathr‘   rt   r�   r™   r¢   ÚRTLD_GLOBALÚopenÚreadrë   Ú	Exceptionr¥   )Úlib_extrÈ   ÚhereÚglobal_deps_lib_pathÚfÚ_mapsrÅ   s          r   Ú_load_global_depsrû   n  s  € Ü‡�Ó˜IÒ%Øô #Ÿ/™/Ó+¨xÒ7‰h¸U€GØ% g YÐ/€HÜ�7‰7�?‰?œ8Ó$€DÜŸ7™7Ÿ<™<¬¯©¯©¸Ó(=¸uÀhÓOÐðCÜ�‰Ð(¬v×/AÑ/AÕBð
	ÜÐ'Ô(¨AØŸ™›�÷ )ð  UÑ*ØäÕ ÷ )Ð(ûô ò 	Ùð	ûô ò Cô 	˜3ÔÜ�‰Ð(¬v×/AÑ/A×BÒBûð	CúsT   Â%D ÃD ÃC5ÃD Ã*
D Ã5C>Ã:D Ä	DÄ
D ÄDÄD Ä	EÄ0EÅEÚTORCH_USE_RTLD_GLOBALrí   )Ú*c                   ó  — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd.d„Zd„ Z	d	„ Z
d
„ Zd„ Zd„ Zd„ Zdedej"                  fd„Zdej"                  fd„Zdej"                  fd„Zdej"                  fd„Zdej"                  fd„Zd/d„Zd/d„Zd/d„Zd0d„Zd/d„Zd/d„Zd/d„Zd1d„Zd1d„Zd1d„Z d1d„Z!d „ Z"d!„ Z#d"„ Z$d#„ Z%d0d$„Z&d0d%„Z'd/d&„Z(d/d'„Z)d(„ Z*d)„ Z+dejX                  fd*„Z-de.d ejX                  f   fd+„Z/dejX                  fd,„Z0d/d-„Z1y)2r0   zÇ
    Like an int (including magic methods), but redirects all operations on the
    wrapped node. This is used in particular to symbolically record operations
    in the symbolic shape workflow.
    c                 ó   — || _         y r„   ©Únode©Úselfr  s     r   Ú__init__zSymInt.__init__Ä  ó   € ð ˆ�	r   c                 ó2   — t        j                  | dk7  «      S ©Nr   )r”   Úbool©r  s    r   Ú__bool__zSymInt.__bool__É  s   € Ü�}‰}˜T Q™YÓ'Ð'r   c                 ó6   — | j                   j                  «       S r„   ©r  Úint_r	  s    r   Ú__int__zSymInt.__int__Ì  ó   € Ø�y‰y�~‰~ÓÐr   c                 ó6   — | j                   j                  «       S r„   r  r	  s    r   Ú	__index__zSymInt.__index__Ï  r  r   Nc                 ó   — | S r„   r   )r  Úndigitss     r   Ú	__round__zSymInt.__round__Ô  ó   € Øˆr   c                 óä   — t        |t        j                  t        f«      rt	        | «      j                  |«      S t        |t        j                  t        f«      st        S | j                  |«      S r„   )
Ú
isinstancer”   Úfloatr/   rX   Ú__float_truediv__Úintr0   ÚNotImplementedÚ__int_truediv__©r  Úothers     r   Ú__truediv__zSymInt.__truediv__×  sT   € Ü�eœhŸn™n¬hÐ7Ô8Ü˜T“?×4Ñ4°UÓ;Ð;Ü˜%¤(§,¡,´Ð!7Ô8Ü!Ð!Ø×#Ñ# EÓ*Ð*r   c                 óä   — t        |t        j                  t        f«      rt	        | «      j                  |«      S t        |t        j                  t        f«      st        S | j                  |«      S r„   )
r  r”   r  r/   rX   Ú__rfloat_truediv__r  r0   r  Ú__rint_truediv__r  s     r   Ú__rtruediv__zSymInt.__rtruediv__Þ  sT   € Ü�eœhŸn™n¬hÐ7Ô8Ü˜T“?×5Ñ5°eÓ<Ð<Ü˜%¤(§,¡,´Ð!7Ô8Ü!Ð!Ø×$Ñ$ UÓ+Ð+r   c                 ó  — t        |t        j                  t        f«      r*t	        t        j                  t	        | «      |z  «      «      S t        |t        j                  t        f«      st        S | j                  |«      S r„   )r  r”   r  r/   rX   ÚmathÚfloorr  r0   r  Ú__int_floordiv__r  s     r   Ú__floordiv__zSymInt.__floordiv__å  s\   € Ü�eœhŸn™n¬hÐ7Ô8ÜœTŸZ™Z¬	°$«¸%Ñ(?Ó@ÓAÐAÜ˜%¤(§,¡,´Ð!7Ô8Ü!Ð!Ø×$Ñ$ UÓ+Ð+r   c                 ó  — t        |t        j                  t        f«      r*t	        t        j                  |t	        | «      z  «      «      S t        |t        j                  t        f«      st        S | j                  |«      S r„   )r  r”   r  r/   rX   r%  r&  r  r0   r  Ú__rint_floordiv__r  s     r   Ú__rfloordiv__zSymInt.__rfloordiv__ì  s\   € Ü�eœhŸn™n¬hÐ7Ô8ÜœTŸZ™Z¨´	¸$³Ñ(?Ó@ÓAÐAÜ˜%¤(§,¡,´Ð!7Ô8Ü!Ð!Ø×%Ñ% eÓ,Ð,r   c                 ó4  — t        |t        j                  t        f«      rt	        | «      j                  |«      S t        |t        j                  t        f«      st        S |dk\  r| j                  |«      S t	        | «      j                  t	        |«      «      S r  )
r  r”   r  r/   rX   Ú__pow__r  r0   r  Ú__pow_by_natural__r  s     r   r-  zSymInt.__pow__÷  sy   € Ü�eœhŸn™n¬hÐ7Ô8Ü˜T“?×*Ñ*¨5Ó1Ð1Ü˜%¤(§,¡,´Ð!7Ô8Ü!Ð!ð �AŠ:Ø×*Ñ*¨5Ó1Ð1ô ˜T“?×*Ñ*¬9°UÓ+;Ó<Ð<r   c                 ó4  — t        |t        j                  t        f«      rt	        | «      j                  |«      S t        |t        j                  t        f«      st        S | dk\  r| j                  |«      S t	        | «      j                  t	        |«      «      S r  )
r  r”   r  r/   rX   Ú__rpow__r  r0   r  Ú__rpow_by_natural__r  s     r   r0  zSymInt.__rpow__  su   € Ü�eœhŸn™n¬hÐ7Ô8Ü˜T“?×+Ñ+¨EÓ2Ð2Ü˜%¤(§,¡,´Ð!7Ô8Ü!Ð!Ø�1Š9Ø×+Ñ+¨EÓ2Ð2ä˜T“?×+Ñ+¬I°eÓ,<Ó=Ð=r   r  r   c                 ó   — t        d«      ‚©Nútype stub not overridden©Ú	TypeErrorr  s     r   Ú__eq__zSymInt.__eq__  ó   € ÜÐ2Ó3Ð3r   c                 ó   — t        d«      ‚r3  r5  r  s     r   Ú__lt__zSymInt.__lt__  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   Ú__gt__zSymInt.__gt__  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   Ú__le__zSymInt.__le__"  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   Ú__ge__zSymInt.__ge__%  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   Ú__add__zSymInt.__add__(  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   Ú__radd__zSymInt.__radd__+  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   Ú__rmul__zSymInt.__rmul__.  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   Ú__mod__zSymInt.__mod__1  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   Ú__mul__zSymInt.__mul__4  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   r.  zSymInt.__pow_by_natural__7  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   r1  zSymInt.__rpow_by_natural__:  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   r  zSymInt.__int_truediv__=  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   r"  zSymInt.__rint_truediv__@  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   r'  zSymInt.__int_floordiv__C  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   r*  zSymInt.__rint_floordiv__F  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   Ú__sym_max__zSymInt.__sym_max__I  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   Ú__sym_min__zSymInt.__sym_min__L  r8  r   c                 ó   — t        d«      ‚r3  r5  r	  s    r   Ú__sym_float__zSymInt.__sym_float__O  r8  r   c                 ó   — t        d«      ‚r3  r5  r	  s    r   Ú__neg__zSymInt.__neg__R  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   Ú__sub__zSymInt.__sub__U  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   Ú__rsub__zSymInt.__rsub__X  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   Ú__and__zSymInt.__and__[  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   Ú__or__zSymInt.__or__^  r8  r   c                 ó6   — | j                   j                  «       S r„   ©r  Ú_graph_reprr	  s    r   Ú__repr__zSymInt.__repr__a  ó   € Ø�y‰y×$Ñ$Ó&Ð&r   c                 ó.   — | j                   j                  S r„   ©r  Úexprr	  s    r   Ú_sympy_zSymInt._sympy_d  ó   € Ø�y‰y�~‰~Ðr   c                 ó’   — | j                   j                  «       r#t        | j                   j                  «       «      S t	        d«      ‚)Nz"unhashable type: non-nested SymInt)r  Úis_nested_intÚhashÚ
nested_intr6  r	  s    r   Ú__hash__zSymInt.__hash__g  s8   € Ø�9‰9×"Ñ"Ô$Ü˜Ÿ	™	×,Ñ,Ó.Ó/Ð/ô Ð@ÓAÐAr   c                 ó
   — | dfS )z,Represent this int as an exact integer ratiord   r   r	  s    r   Úas_integer_ratiozSymInt.as_integer_ratios  s   € à�Qˆwˆr   c                 óH   — t        j                  | «      j                  «       S r„   )r”   r  Ú
bit_lengthr	  s    r   rs  zSymInt.bit_lengthw  s   € ô
 �|‰|˜DÓ!×,Ñ,Ó.Ð.r   c                 ó   — | S r„   r   r	  s    r   Ú	conjugatezSymInt.conjugate~  r  r   r„   )r   r0   )r  r   r   r0   ©r   r/   )2Ú__name__Ú
__module__Ú__qualname__Ú__doc__r  r
  r  r  r  r  r#  r(  r+  r-  r0  Úobjectr”   r  r7  r:  r<  r>  r@  rB  rD  rF  rH  rJ  r.  r1  r  r"  r'  r*  rR  rT  rV  rX  rZ  r\  r^  r`  rd  ri  r  ro  Útuplerq  rs  ru  r   r   r   r0   r0   ½  s?  „ ñòò
(ò ò ó
ò+ò,ò,ò-ò=ò0>ð4˜Fð 4 x§}¡}ó 4ð4˜xŸ}™}ó 4ð4˜xŸ}™}ó 4ð4˜xŸ}™}ó 4ð4˜xŸ}™}ó 4ó4ó4ó4ó4ó4ó4ó4ó4ó4ó4ó4ò4ò4ò4ò4ó4ó4ó4ó4ò'òðB˜(Ÿ,™,ó Bð %¨°(·,±,Ð(>Ñ"?ó ð/˜HŸL™Ló /ôr   r0   c                   ó’  — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zdedej                   fd„Zdej                   fd„Zdej                   fd„Zdej                   fd„Zdej                   fd„Zd#d„Zd#d„Zd#d„Zd#d„Zd„ Zd„ Zd„ Zd„ Zd„ Zdeej@                  ej@                  f   fd„Z!d„ Z"d„ Z#d„ Z$d#d „Z%de&fd!„Z'y")$r/   zÈ
    Like a float (including magic methods), but redirects all operations on the
    wrapped node. This is used in particular to symbolically record operations
    in the symbolic shape workflow.
    c                 ó   — || _         y r„   r   r  s     r   r  zSymFloat.__init__‰  r  r   c                 óª   — t        |t        j                  t        j                  t        t
        f«      st        S | j                  t        |«      «      S r„   )	r  r”   r  r  r0   r/   r  r  rX   r  s     r   r  zSymFloat.__truediv__Ž  s9   € Ü˜%¤(§,¡,´·±ÄÌÐ!QÔRÜ!Ð!Ø×%Ñ%¤i°Ó&6Ó7Ð7r   c                 óª   — t        |t        j                  t        j                  t        t
        f«      st        S | j                  t        |«      «      S r„   )	r  r”   r  r  r0   r/   r  r!  rX   r  s     r   r#  zSymFloat.__rtruediv__“  s9   € Ü˜%¤(§,¡,´·±ÄÌÐ!QÔRÜ!Ð!Ø×&Ñ&¤y°Ó'7Ó8Ð8r   c                 óÊ   — t        |t        j                  t        j                  t        t
        f«      st        S t        t        j                  | t        |«      z  «      «      S r„   ©
r  r”   r  r  r0   r/   r  rX   r%  r&  r  s     r   r(  zSymFloat.__floordiv__˜  sA   € Ü˜%¤(§,¡,´·±ÄÌÐ!QÔRÜ!Ð!ÜœŸ™ D¬9°UÓ+;Ñ$;Ó<Ó=Ð=r   c                 óÊ   — t        |t        j                  t        j                  t        t
        f«      st        S t        t        j                  t        |«      | z  «      «      S r„   r‚  r  s     r   r+  zSymFloat.__rfloordiv__�  sA   € Ü˜%¤(§,¡,´·±ÄÌÐ!QÔRÜ!Ð!ÜœŸ™¤I¨eÓ$4°tÑ$;Ó<Ó=Ð=r   c                 ó6   — | j                   j                  «       S r„   ©r  Úbool_r	  s    r   r
  zSymFloat.__bool__¢  ó   € Ø�y‰y�‰Ó Ð r   c                 ó:   — | j                   j                  dd«      S )Nro   r   )r  Úguard_floatr	  s    r   Ú	__float__zSymFloat.__float__¥  s   € Ø�y‰y×$Ñ$ R¨Ó+Ð+r   c                 ó>   — | j                  «       j                  «       S r„   )Ú	__trunc__r  r	  s    r   r  zSymFloat.__int__¨  s   € Ø�~‰~Ó×'Ñ'Ó)Ð)r   c                 óÈ   — t        |t        j                  t        j                  t        t
        f«      st        S t        j                  | dk\  «       | j                  |«      S r  )
r  r”   r  r  r0   r/   r  ÚtorchÚ_checkÚ__float_pow__r  s     r   r-  zSymFloat.__pow__­  sD   € Ü˜%¤(§,¡,´·±ÄÌÐ!QÔRÜ!Ð!Ü�‰�T˜Q‘YÔØ×!Ñ! %Ó(Ð(r   c                 óÈ   — t        |t        j                  t        j                  t        t
        f«      st        S t        j                  |dk\  «       | j                  |«      S r  )
r  r”   r  r  r0   r/   r  rŽ  r�  Ú__rfloat_pow__r  s     r   r0  zSymFloat.__rpow__³  sD   € Ü˜%¤(§,¡,´·±ÄÌÐ!QÔRÜ!Ð!Ü�‰�U˜a‘ZÔ Ø×"Ñ" 5Ó)Ð)r   r  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   r7  zSymFloat.__eq__»  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   r:  zSymFloat.__lt__¾  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   r<  zSymFloat.__gt__Á  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   r>  zSymFloat.__le__Ä  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   r@  zSymFloat.__ge__Ç  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   r�  zSymFloat.__float_pow__Ê  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   r’  zSymFloat.__rfloat_pow__Í  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   r  zSymFloat.__float_truediv__Ð  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   r!  zSymFloat.__rfloat_truediv__Ó  r8  r   c                 ó   — t        d«      ‚r3  r5  r	  s    r   rŒ  zSymFloat.__trunc__Ö  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   rR  zSymFloat.__sym_max__Ù  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   rT  zSymFloat.__sym_min__Ü  r8  r   c                 ó   — t        d«      ‚r3  r5  r	  s    r   Ú__sym_int__zSymFloat.__sym_int__ß  r8  r   c                 ó   — t        d«      ‚)z'Return True if the float is an integer.r4  r5  r	  s    r   Ú
is_integerzSymFloat.is_integerâ  s   € äÐ2Ó3Ð3r   c                 óH   — t        j                  | «      j                  «       S )z.Represent this float as an exact integer ratio)r”   r  rq  r	  s    r   rq  zSymFloat.as_integer_ratioæ  s   € ä�~‰~˜dÓ#×4Ñ4Ó6Ð6r   c                 ó6   — | j                   j                  «       S r„   rb  r	  s    r   rd  zSymFloat.__repr__ê  re  r   c                 ó.   — | j                   j                  S r„   rg  r	  s    r   ri  zSymFloat._sympy_í  rj  r   c                 ó>   — t        t        j                  | «      «      S r„   )rm  r”   r  r	  s    r   ro  zSymFloat.__hash__ð  s   € Ü”H—N‘N 4Ó(Ó)Ð)r   c                 ó   — | S )z+Returns the complex conjugate of the float.r   r	  s    r   ru  zSymFloat.conjugateó  s   € àˆr   c                 óV   — | j                   j                  dd«      j                  «       S )z4Returns the hexadecimal representation of the float.ro   r   )r  r‰  Úhexr	  s    r   r©  zSymFloat.hex÷  s"   € à�y‰y×$Ñ$ R¨Ó+×/Ñ/Ó1Ð1r   Nrv  )(rw  rx  ry  rz  r  r  r#  r(  r+  r
  rŠ  r  r-  r0  r{  r”   r  r7  r:  r<  r>  r@  r�  r’  r  r!  rŒ  rR  rT  r   r¢  r|  r  rq  rd  ri  ro  ru  Ústrr©  r   r   r   r/   r/   ‚  sû   „ ñòò
8ò
9ò
>ò
>ò
!ò,ò*ò
)ò*ð4˜Fð 4 x§}¡}ó 4ð4˜xŸ}™}ó 4ð4˜xŸ}™}ó 4ð4˜xŸ}™}ó 4ð4˜xŸ}™}ó 4ó4ó4ó4ó4ò4ò4ò4ò4ò4ð7 %¨¯©°h·l±lÐ(BÑ"Có 7ò'òò*óð2�Sô 2r   r/   c                   óx   — e Zd ZdZd„ Zd„ Zd„ Zdd„Zdd„Zdd„Z	d	„ Z
dej                  fd
„Zd„ Zd„ Zd„ Zd„ Zy)r.   am  
    Like a bool (including magic methods), but redirects all operations on the
    wrapped node. This is used in particular to symbolically record operations
    in the symbolic shape workflow.

    Unlike regular bools, regular boolean operators will force extra guards instead
    of symbolically evaluate.  Use the bitwise operators instead to handle this.
    c                 ó   — || _         y r„   r   r  s     r   r  zSymBool.__init__  r  r   c                 ó6   — | j                   j                  «       S r„   r…  r	  s    r   r
  zSymBool.__bool__  r‡  r   c                 ó\   — t        j                  | j                  j                  «       «      S r„   )r”   r  r  r†  r	  s    r   r  zSymBool.__int__  s   € Ü�|‰|˜DŸI™IŸO™OÓ-Ó.Ð.r   r   c                 ó   — t        d«      ‚r3  r5  r  s     r   r^  zSymBool.__and__  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   r`  zSymBool.__or__  r8  r   c                 ó   — t        d«      ‚r3  r5  r	  s    r   Ú__sym_not__zSymBool.__sym_not__)  r8  r   c                 ó   — t        d«      ‚r3  r5  )r  Úthen_valÚelse_vals      r   Ú__sym_ite__zSymBool.__sym_ite__,  r8  r   c                 ó   — t        d«      ‚r3  r5  r  s     r   r7  zSymBool.__eq__/  r8  r   c                 ó6   — | j                   j                  «       S r„   rb  r	  s    r   rd  zSymBool.__repr__2  re  r   c                 ó.   — | j                   j                  S r„   rg  r	  s    r   ri  zSymBool._sympy_5  rj  r   c                 ó¸   — | j                   j                  «       r#t        | j                   j                  «       «      S t        t	        j
                  | «      «      S r„   )r  Úis_constantrm  r†  r”   r  r	  s    r   ro  zSymBool.__hash__8  s>   € Ø�9‰9× Ñ Ô"Ü˜Ÿ	™	Ÿ™Ó)Ó*Ð*ô œŸ™ dÓ+Ó,Ð,r   c                 óN   — ddl m}  || j                  j                  «       «      S )z–
        Provides a SymFloat representation (0.0 or 1.0) for this SymBool.
        Called by torch.sym_float() when casting SymBool to float.
        r   )Ú	wrap_node)Útorch.fx.experimental.sym_noder½  r  rX   )r  r½  s     r   rV  zSymBool.__sym_float__?  s   € õ
 	=á˜Ÿ™×,Ñ,Ó.Ó/Ð/r   N)r   r.   )rw  rx  ry  rz  r  r
  r  r^  r`  r²  r¶  r”   r  r7  rd  ri  ro  rV  r   r   r   r.   r.   ü  sN   „ ñòò
!ò/ó4ó4ó(4ò4ð4˜xŸ}™}ó 4ò'òò-ó0r   r.   c                 óÜ   — ddl }t        j                  | «      rt        j                  t        | f| «      S t        | d«      r| j                  «       S t        | |j                  «      r|  S |  S )zhSymInt-aware utility for logical negation.

    Args:
        a (SymBool or bool): Object to negate
    r   Nr²  )	ÚsympyÚ	overridesÚhas_torch_function_unaryÚhandle_torch_functionr^   r›   r²  r  ÚBasic)ÚarÀ  s     r   r^   r^   I  s^   € ó ä×)Ñ)¨!Ô,Ü×.Ñ.¬w¸¸¸aÓ@Ð@Üˆq�-Ô Ø�}‰}‹ÐÜ�!�U—[‘[Ô!Øˆrˆ	Øˆ5€Lr   c                 óê   — t        j                  | «      rt        j                  t        | f| «      S t	        | t
        «      r| S t        | d«      r| j                  «       S t        j                  | «      S )zoSymInt-aware utility for float casting.

    Args:
        a (SymInt, SymFloat, or object): Object to cast
    rV  )
rÁ  rÂ  rÃ  rX   r  r/   r›   rV  r”   r  ©rÅ  s    r   rX   rX   Z  s^   € ô ×)Ñ)¨!Ô,Ü×.Ñ.¬y¸1¸$ÀÓBÐBÜ�!”XÔØˆÜ	��OÔ	$Ø�‰Ó Ð Ü�>‰>˜!ÓÐr   c                 óü   — t        j                  | «      rt        j                  t        | f| «      S t	        | t
        «      r| S t	        | t        «      rt        j                  | «      S t        j                  | «      S )zmSymInt-aware utility for int casting.

    Args:
        a (SymInt, SymFloat, or object): Object to cast
    )rÁ  rÂ  rÃ  rZ   r  r0   r/   r%  Útruncr”   r  rÇ  s    r   rZ   rZ   i  s^   € ô ×)Ñ)¨!Ô,Ü×.Ñ.¬w¸¸¸aÓ@Ð@Ü�!”VÔØˆÜ	�A”xÔ	 Ü�z‰z˜!‹}ÐÜ�<‰<˜‹?Ðr   c                 óh  — t        j                  | |f«      rt        j                  t        | |f| |«      S t	        | t
        t        f«      r| j                  |«      S t	        |t
        t        f«      r|j                  | «      S t        «       \  }}t	        | |«      st        d|› dt        | «      › �«      ‚t	        ||«      st        d|› dt        |«      › �«      ‚t	        | |«      st	        ||«      r)t        j                  t        j                  | |«      «      S t        j                  | |«      S )a  
    SymInt-aware utility for max which avoids branching on a < b.
    Unlike builtins.max(), this only works for int/float, and it always
    promotes to float if any argument is float (unlike builtins.max, which
    will faithfully preserve the type of the input argument).
    ú	expected ú, got )rÁ  Úhas_torch_functionrÃ  r\   r  r0   r/   rR  Ú__all_and_float_typesrÔ   Útyper”   r  Úmax©rÅ  ÚbÚ	all_typesÚfloat_typess       r   r\   r\   x  s  € ô ×#Ñ# Q¨ FÔ+Ü×.Ñ.¬w¸¸A¸ÀÀ1ÓEÐEÜ�!”fœhÐ'Ô(Ø�}‰}˜QÓÐÜ	�Aœ¤Ð)Ô	*ð �}‰}˜QÓÐô 3Ó4Ñ€Iˆ{ä�a˜Ô#Ü˜y¨¨°6¼$¸q»'¸ÐCÓDÐDÜ�a˜Ô#Ü˜y¨¨°6¼$¸q»'¸ÐCÓDÐDÜ�!�[Ô!¤Z°°;Ô%?Ü�~‰~œhŸl™l¨1¨aÓ0Ó1Ð1ä�|‰|˜A˜qÓ!Ð!r   .c                  ó>  — 	 dd l } | j                  | j                  t        j                  t        j
                  f}| j                  t        j
                  f}||fS # t        $ r7 t        j                  t        j
                  f}t        j
                  f}Y ||fS w xY wr  )ÚnumpyÚintegerÚfloatingr”   r  r  ÚModuleNotFoundError)ÚnprÓ  rÔ  s      r   rÎ  rÎ  •  sŠ   € ð(Ûð �J‰JØ�K‰KÜ�L‰LÜ�N‰Nð	'
ˆ	ð *,¯©´h·n±nÐ(Eˆð
 �kÐ!Ð!øô	 ò (Ü—\‘\¤8§>¡>Ð2ˆ	Ü—~‘~Ð'‰à�kÐ!Ð!ð	(ús   ‚AA Á:BÂBc                 óh  — t        j                  | |f«      rt        j                  t        | |f| |«      S t	        | t
        t        f«      r| j                  |«      S t	        |t
        t        f«      r|j                  | «      S t        «       \  }}t	        | |«      st        d|› dt        | «      › �«      ‚t	        ||«      st        d|› dt        |«      › �«      ‚t	        | |«      st	        ||«      r)t        j                  t        j                  | |«      «      S t        j                  | |«      S )zSymInt-aware utility for min().rË  rÌ  )rÁ  rÍ  rÃ  r]   r  r0   r/   rT  rÎ  rÔ   rÏ  r”   r  ÚminrÑ  s       r   r]   r]   §  s  € ä×#Ñ# Q¨ FÔ+Ü×.Ñ.¬w¸¸A¸ÀÀ1ÓEÐEÜ�!”fœhÐ'Ô(Ø�}‰}˜QÓÐÜ	�Aœ¤Ð)Ô	*Ø�}‰}˜QÓÐä2Ó4Ñ€Iˆ{ä�a˜Ô#Ü˜y¨¨°6¼$¸q»'¸ÐCÓDÐDÜ�a˜Ô#Ü˜y¨¨°6¼$¸q»'¸ÐCÓDÐDÜ�!�[Ô!¤Z°°;Ô%?Ü�~‰~œhŸl™l¨1¨aÓ0Ó1Ð1ä�|‰|˜A˜qÓ!Ð!r   c                 ó²  ‡‡— t        j                  | «      rt        j                  t        | | «      S dŠ| D ]V  }t	        |t
        t        j                  f«      st        j                  | «      c S t	        |t
        «      sŒK|j                  ŠŒX ‰€t        j                  | «      S ddl
mŠm}  |‰j                  t        ˆˆfd„| D «       «      «      «      S )z‹
    N-ary add which is faster to compute for long lists than iterated binary
    addition.  Only does something special for integers.
    Nr   )Úto_noder½  c              3   ó0   •K  — | ]  } ‰‰|«      –— Œ y ­wr„   r   )rv   rÅ  ÚfoundrÞ  s     €€r   rx   zsym_sum.<locals>.<genexpr>Ï  s   øè ø€ Ð(IÁD¸q©°¸×):ÁDùs   ƒ)rÁ  rÍ  rÃ  r_   r  r0   r”   r  Úsumr  r¾  rÞ  r½  r|  )ré   rÅ  r½  rà  rÞ  s      @@r   r_   r_   ¼  s¤   ù€ ô
 ×#Ñ# DÔ)Ü×.Ñ.¬w¸¸dÓCÐCà€EÛˆÜ˜!œf¤h§l¡lÐ3Ô4Ü—<‘< Ó%Ò%Ü�aœÕ Ø—F‘F‰Eð	 ð
 €}Ü�|‰|˜DÓ!Ð!çAá�U—]‘]¤5Ô(IÁDÓ(IÓ#IÓJÓKÐKr   c                 ó   ‡ ‡— ˆˆ fd„Š‰S )Nc                 ó  •— t        j                  | «      rt        j                  ‰| f| «      S t        | t        «      rt        j                  | «      } t        | d‰› d�«      r t        | d‰› d�«      «       S  t        t        ‰«      | «      S )NÚ__sym_Ú__)
rÁ  rÂ  rÃ  r  r0   rŽ  rX   r›   Úgetattrr%  )rÅ  ÚfnÚnames    €€r   rç  z_get_sym_math_fn.<locals>.fnÔ  s‚   ø€ Ü×-Ñ-¨aÔ0Ü×2Ñ2°2¸°t¸QÓ?Ð?Ü�aœÔ Ü—‘ Ó"ˆAÜ�1˜˜t˜f BÐ'Ô(Ø0”7˜1  t f¨BÐ/Ó0Ó2Ð2Ø"Œw”t˜TÓ" 1Ó%Ð%r   r   )rè  rç  s   `@r   Ú_get_sym_math_fnré  Ó  s   ù€ õ&ð €Ir   )Nro   ro   )ÚsqrtÚcosÚcoshÚsinÚsinhÚtanÚtanhÚasinÚacosÚatanÚlog2Ú_sym_Ú	_sym_sqrtÚsym_sqrtc                 ó¢  — t        j                  | ||f«      r t        j                  t        | ||f| ||«      S t	        | t
        t        j                  f«      st        dt        | «      › �«      ‚t        |«      t        |«      ur#t        dt        |«      › dt        |«      › �«      ‚t	        | t
        «      r| j                  ||«      S | r|S |S )z>SymInt-aware utility for ternary operator (``t if b else f``.)zexpected SymBool or bool, got ztype mismatch: z vs )rÁ  rÍ  rÃ  r[   r  r.   r”   r  rÔ   rÏ  r¶  )rÒ  Útrù   s      r   r[   r[   û  s·   € ä×#Ñ# Q¨¨1 IÔ.Ü×.Ñ.¬w¸¸A¸q¸	À1ÀaÈÓKÐKÜ�aœ'¤8§=¡=Ð1Ô2ÜÐ=¼dÀ1»g¸YÐGÓHÐHÜˆAƒw”d˜1“gÑÜ˜¬t°A«w¨i°t¼DÀ»G¸9ÐEÓFÐFÜ�!”WÔØ�}‰}˜Q Ó"Ð"Ùˆ1Ð�qÐr   c                 óH   — t        j                  | «      j                  «       S r„   )rŽ  ÚtensorÚitem)rh  s    r   rY   rY   	  s   € Ü�<‰<˜Ó×"Ñ"Ó$Ð$r   )Ú_initExtensionaí  
                Failed to load PyTorch C extensions:
                    It appears that PyTorch has loaded the `torch/_C` folder
                    of the PyTorch repository rather than the C extensions which
                    are expected in the `torch._C` namespace. This can occur when
                    using the `install` workflow. e.g.
                        $ python -m pip install --no-build-isolation -v . && python -c "import torch"

                    This error can generally be solved using the `develop` workflow
                        $ python -m pip install --no-build-isolation -v -e . && python -c "import torch"  # This should succeed
                    or by running Python from a different directory.
                )Ú_C)ro   Nr   ÚBase>   Ú	GeneratorÚDisableTorchFunctionÚDisableTorchFunctionSubclassÚ
TensorBasec                 óZ  — |€
t        «       }| |v ry |j                  | «       | j                  }t        | «      D ]o  }t	        | |«      }t	        |dd«      }t        j                  |«      sŒ2|j                  |«      sŒDt        j                  j                  ||«       t        ||«       Œq y )Nrw  ro   )ÚsetÚaddrw  Údirræ  ÚinspectÚismoduleÚ
startswithrŽ   ÚmodulesÚ
setdefaultÚ _import_extension_to_sys_modules)ÚmoduleÚmemoÚmodule_namerè  ÚmemberÚmember_names         r   r  r  F  sŽ   € Øˆ<Ü“5ˆDØ�T‰>ØØ�‰�ÔØ—o‘oˆÜ˜–KˆDÜ˜V TÓ*ˆFÜ! &¨*°bÓ9ˆKÜ×Ñ Õ'¨K×,BÑ,BÀ;Õ,OÜ—‘×&Ñ& {°FÔ;ä0°¸Õ>ñ  r   Úobjc                óZ  — t        | t        j                  «      r| j                  «       S t	        | dd«      xs d}d}t        | d«      r| j                  }nIt        | d«      r| j                  }n0| j                  j                  xs d}| j                  j                  }|dv r|S |› d|› �S )aÍ  
    String representation of the type of an object.

    This function returns a fully qualified string representation of an object's type.
    Args:
        obj (object): The object whose type to represent
    Returns:
        str: the type of the object `o`
    Example:
        >>> x = torch.tensor([1, 2, 3])
        >>> torch.typename(x)
        'torch.LongTensor'
        >>> torch.typename(torch.nn.Parameter)
        'torch.nn.parameter.Parameter'
    rx  ro   ry  rw  >   ro   r”   r~   )
r  rŽ  r1   rÏ  ræ  r›   ry  rw  Ú	__class__rx  )r  r  Úqualnames      r   r`   r`   ]  s    € ô  �#”u—|‘|Ô$Ø�x‰x‹zÐä�S˜,¨Ó+Ò1¨r€FØ€Häˆs�NÔ#Ø×#Ñ#‰Ü	��jÔ	!Ø—<‘<‰à—‘×)Ñ)Ò/¨RˆØ—=‘=×-Ñ-ˆàÐ!Ñ!ØˆØˆX�Q�x�jÐ!Ð!r   ztorch.Tensorc                ó6   — t        | t        j                  «      S )zÃReturns True if `obj` is a PyTorch tensor.

    Args:
        obj (object): Object to test
    Example::

        >>> x = torch.tensor([1, 2, 3])
        >>> torch.is_tensor(x)
        True

    )r  rŽ  r1   ©r  s    r   rD   rD   €  s   € ô �cœ5Ÿ<™<Ó(Ð(r   c                ó$   — t        | «      t        v S )aÎ  Returns True if `obj` is a PyTorch storage object.

    Args:
        obj (Object): Object to test
    Example::

        >>> import torch
        >>> # UntypedStorage (recommended)
        >>> tensor = torch.tensor([1, 2, 3])
        >>> storage = tensor.untyped_storage()
        >>> torch.is_storage(storage)
        True
        >>>
        >>> # TypedStorage (legacy)
        >>> typed_storage = torch.TypedStorage(5, dtype=torch.float32)
        >>> torch.is_storage(typed_storage)
        True
        >>>
        >>> # regular tensor (should return False)
        >>> torch.is_storage(tensor)
        False
        >>>
        >>> # non-storage object
        >>> torch.is_storage([1, 2, 3])
        False
    )rÏ  Ú_storage_classesr  s    r   rC   rC   �  s   € ô6 �‹9Ô(Ð(Ð(r   c            	      ó  ‡— ddl m}  ddlmŠ d„ }t	        t        ˆfd„t         | «       «      «      d«      }|r|j                  } ||«      S t        t        dd«      }|� ||j                  «      S t        j                  d«      S )	z?Gets the default ``torch.Tensor`` to be allocated on ``device``r   )Ú _get_current_function_mode_stack©ÚDeviceContextc                 ó\   — | j                   �| S t        j                  g «      j                  S r„   )ÚindexrŽ  rû  Údevice)r!  s    r   Ú_get_device_with_indexz2get_default_device.<locals>._get_device_with_index·  s(   € Ø�<‰<Ð#ØˆMô —<‘< Ó#×*Ñ*Ð*r   c                 ó   •— t        | ‰«      S r„   )r  )rð   r  s    €r   Ú<lambda>z$get_default_device.<locals>.<lambda>Â  s   ø€ œ D¨-Ô8r   NÚdevice_contextÚcpu)Útorch.overridesr  Útorch.utils._devicer  ÚnextÚfilterÚreversedr!  ræ  Ú_GLOBAL_DEVICE_CONTEXTrŽ  )r  r"  Údevice_moder!  r%  r  s        @r   r;   r;   °  sŠ   ø€ õ AÝ1ò+ô ÜÛ8ÜÑ5Ó7Ó8ó	
ð 	ó€Kñ Ø×#Ñ#ˆÙ% fÓ-Ð-äÔ3Ð5EÀtÓL€NØÐ!Ù% n×&;Ñ&;Ó<Ð<Ü�<‰<˜ÓÐr   r!  c                 óà   — t        t        d«      r%t        j                  }|�|j                  ddd«       | €d}|t        _        yddlm}  || «      }|j                  «        |t        _        y)a  Sets the default ``torch.Tensor`` to be allocated on ``device``.  This
    does not affect factory function calls which are called with an explicit
    ``device`` argument.  Factory calls will be performed as if they
    were passed ``device`` as an argument.

    To only temporarily change the default device instead of setting it
    globally, use ``with torch.device(device):`` instead.

    The default device is initially ``cpu``.  If you set the default tensor
    device to another device (e.g., ``cuda``) without a device index, tensors
    will be allocated on whatever the current device for the device type,
    even after :func:`torch.cuda.set_device` is called.

    .. warning::

        This function imposes a slight performance cost on every Python
        call to the torch API (not just factory functions).  If this
        is causing problems for you, please comment on
        https://github.com/pytorch/pytorch/issues/92701

    .. note::

        This doesn't affect functions that create tensors that share the same memory as the input, like:
        :func:`torch.from_numpy` and :func:`torch.frombuffer`

    Args:
        device (device or string): the device to set as default

    Example::

        >>> # xdoctest: +SKIP("requires cuda, changes global state")
        >>> torch.get_default_device()
        device(type='cpu')
        >>> torch.set_default_device('cuda')  # current device is 0
        >>> torch.get_default_device()
        device(type='cuda', index=0)
        >>> torch.set_default_device('cuda')
        >>> torch.cuda.set_device('cuda:1')  # current device is 1
        >>> torch.get_default_device()
        device(type='cuda', index=1)
        >>> torch.set_default_device('cuda:1')
        >>> torch.get_default_device()
        device(type='cuda', index=1)

    r%  Nr   r  )r›   r,  r%  Ú__exit__r(  r  Ú	__enter__)r!  r%  r  s      r   rO   rO   Ñ  sm   € ô^ Ô%Ð'7Ô8Ü/×>Ñ>ˆØÐ%Ø×#Ñ# D¨$°Ô5à€~Øˆð -;ÔÕ)õ	 	6á& vÓ.ˆØ× Ñ Ô"Ø,:ÔÕ)r   rù  c                ód   — t        | t        «      rt        | «      } t        j                  | «       y)a¥  
    .. warning::

        This function is deprecated as of PyTorch 2.1, please use :func:`torch.set_default_dtype()` and
        :func:`torch.set_default_device()` as alternatives.

    Sets the default ``torch.Tensor`` type to floating point tensor type
    ``t``. This type will also be used as default floating point type for
    type inference in :func:`torch.tensor`.

    The default floating point tensor type is initially ``torch.FloatTensor``.

    Args:
        t (type or string): the floating point tensor type or its name

    Example::

        >>> # xdoctest: +SKIP("Other tests may have changed the default type. Can we reset it?")
        >>> torch.tensor([1.2, 3]).dtype    # initial default for floating point is torch.float32
        torch.float32
        >>> torch.set_default_tensor_type(torch.DoubleTensor)
        >>> torch.tensor([1.2, 3]).dtype    # a new floating point tensor
        torch.float64

    N)r  rª  r   rþ  Ú_set_default_tensor_type)rù  s    r   rP   rP     s&   € ô4 �!”SÔÜ Ó"ˆÜ×Ñ Õ"r   c                ó.   — t        j                  | «       y)a	  

    Sets the default floating point dtype to :attr:`d`. Supports floating point dtype
    as inputs. Other dtypes will cause torch to raise an exception.

    When PyTorch is initialized its default floating point dtype is torch.float32,
    and the intent of set_default_dtype(torch.float64) is to facilitate NumPy-like
    type inference. The default floating point dtype is used to:

    1. Implicitly determine the default complex dtype. When the default floating type is float16,
       the default complex dtype is complex32. For float32, the default complex dtype is complex64.
       For float64, it is complex128. For bfloat16, an exception will be raised because
       there is no corresponding complex type for bfloat16.
    2. Infer the dtype for tensors constructed using Python floats or complex Python
       numbers. See examples below.
    3. Determine the result of type promotion between bool and integer tensors and
       Python floats and complex Python numbers.

    Args:
        d (:class:`torch.dtype`): the floating point dtype to make the default.

    Example:
        >>> # xdoctest: +SKIP("Other tests may have changed the default type. Can we reset it?")
        >>> # initial default for floating point is torch.float32
        >>> # Python floats are interpreted as float32
        >>> torch.tensor([1.2, 3]).dtype
        torch.float32
        >>> # initial default for floating point is torch.complex64
        >>> # Complex Python numbers are interpreted as complex64
        >>> torch.tensor([1.2, 3j]).dtype
        torch.complex64

        >>> torch.set_default_dtype(torch.float64)
        >>> # Python floats are now interpreted as float64
        >>> torch.tensor([1.2, 3]).dtype  # a new floating point tensor
        torch.float64
        >>> # Complex Python numbers are now interpreted as complex128
        >>> torch.tensor([1.2, 3j]).dtype  # a new complex tensor
        torch.complex128

        >>> torch.set_default_dtype(torch.float16)
        >>> # Python floats are now interpreted as float16
        >>> torch.tensor([1.2, 3]).dtype  # a new floating point tensor
        torch.float16
        >>> # Complex Python numbers are now interpreted as complex128
        >>> torch.tensor([1.2, 3j]).dtype  # a new complex tensor
        torch.complex32

    N)rþ  Ú_set_default_dtype)Úds    r   Úset_default_dtyper6  .  s   € ôd ×Ñ˜!Õr   F©Ú	warn_onlyrð   r8  c                óR   — ddl mc m} | |_        t	        j
                  | |¬«       y)aŒ  Sets whether PyTorch operations must use "deterministic"
    algorithms. That is, algorithms which, given the same input, and when
    run on the same software and hardware, always produce the same output.
    When enabled, operations will use deterministic algorithms when available,
    and if only nondeterministic algorithms are available they will throw a
    :class:`RuntimeError` when called.

    .. note:: This setting alone is not always enough to make an application
        reproducible. Refer to :ref:`reproducibility` for more information.

    .. note:: :func:`torch.set_deterministic_debug_mode` offers an alternative
        interface for this feature.

    The following normally-nondeterministic operations will act
    deterministically when ``mode=True``:

        * :class:`torch.nn.Conv1d` when called on CUDA tensor
        * :class:`torch.nn.Conv2d` when called on CUDA tensor
        * :class:`torch.nn.Conv3d` when called on CUDA tensor
        * :class:`torch.nn.ConvTranspose1d` when called on CUDA tensor
        * :class:`torch.nn.ConvTranspose2d` when called on CUDA tensor
        * :class:`torch.nn.ConvTranspose3d` when called on CUDA tensor
        * :class:`torch.nn.ReplicationPad1d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.ReplicationPad2d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.ReplicationPad3d` when attempting to differentiate a CUDA tensor
        * :func:`torch.bmm` when called on sparse-dense CUDA tensors
        * :func:`torch.Tensor.__getitem__` when attempting to differentiate a CPU tensor
          and the index is a list of tensors
        * :func:`torch.Tensor.index_put` with ``accumulate=False``
        * :func:`torch.Tensor.index_put` with ``accumulate=True`` when called on a CPU
          tensor
        * :func:`torch.Tensor.put_` with ``accumulate=True`` when called on a CPU
          tensor
        * :func:`torch.Tensor.scatter_add_` when called on a CUDA tensor
        * :func:`torch.gather` when called on a CUDA tensor that requires grad
        * :func:`torch.index_add` when called on CUDA tensor
        * :func:`torch.index_select` when attempting to differentiate a CUDA tensor
        * :func:`torch.repeat_interleave` when attempting to differentiate a CUDA tensor
        * :func:`torch.Tensor.index_copy` when called on a CPU or CUDA tensor
        * :func:`torch.Tensor.scatter` when `src` type is Tensor and called on CUDA tensor
        * :func:`torch.Tensor.scatter_reduce` when ``reduce='sum'`` or ``reduce='mean'`` and called on CUDA tensor

    The following normally-nondeterministic operations will throw a
    :class:`RuntimeError` when ``mode=True``:

        * :class:`torch.nn.AvgPool3d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.AdaptiveAvgPool2d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.AdaptiveAvgPool3d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.MaxPool3d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.AdaptiveMaxPool2d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.FractionalMaxPool2d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.FractionalMaxPool3d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.MaxUnpool1d`
        * :class:`torch.nn.MaxUnpool2d`
        * :class:`torch.nn.MaxUnpool3d`
        * :func:`torch.nn.functional.interpolate` when attempting to differentiate a CUDA tensor
          and one of the following modes is used:

          - ``linear``
          - ``bilinear``
          - ``bicubic``
          - ``trilinear``

        * :class:`torch.nn.ReflectionPad1d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.ReflectionPad2d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.ReflectionPad3d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.NLLLoss` when called on a CUDA tensor
        * :class:`torch.nn.CTCLoss` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.EmbeddingBag` when attempting to differentiate a CUDA tensor when
          ``mode='max'``
        * :func:`torch.Tensor.put_` when ``accumulate=False``
        * :func:`torch.Tensor.put_` when ``accumulate=True`` and called on a CUDA tensor
        * :func:`torch.histc` when called on a CUDA tensor
        * :func:`torch.bincount` when called on a CUDA tensor and ``weights``
          tensor is given
        * :func:`torch.median` with indices output when called on a CUDA tensor
        * :func:`torch.nn.functional.grid_sample` when attempting to differentiate a CUDA tensor
        * :func:`torch.cumsum` when called on a CUDA tensor when dtype is floating point or complex
        * :func:`torch.Tensor.scatter_reduce` when ``reduce='prod'`` and called on CUDA tensor
        * :func:`torch.Tensor.resize_` when called with a quantized tensor

    In addition, several operations fill uninitialized memory when this setting
    is turned on and when
    :attr:`torch.utils.deterministic.fill_uninitialized_memory` is turned on.
    See the documentation for that attribute for more information.

    Note that deterministic operations tend to have worse performance than
    nondeterministic operations.


    When this setting is turned on, the Inductor deterministic mode is also tuned on
    automatically. In deterministic mode, Inductor would avoid doing on device benchmarking
    that affect numerics. This includes:

      - don't pad matmul input shapes. Without enabling deterministic mode, Inductor would do
        benchmarking to check if padding matmul shape is beneficial.
      - don't autotune templates. Inductor has templates for kernels like matmul/conv/attention.
        Without enabling deterministic mode, Inductor would do autotuning to
        pick the best configs for those templates and adopt it if it's faster
        than the kernel in eager mode. In deterministic mode, we pick the eager kernel.
      - don't autotune triton configs for reduction. Reduction numerics are
        very sensitive to triton configs. In deterministic mode, Inductor
        will use some heuristics to pick the most promising configs rather
        than do autotuning.
      - Skip autotuning for reduction in coordinate descent tuning.
      - Don't benchmarking for the computation/communication reordering pass
      - Disable the feature that dynamically scale down RBLOCK triton config for higher
        occupancy.


    .. note::

        This flag does not detect or prevent nondeterministic behavior caused
        by calling an inplace operation on a tensor with an internal memory
        overlap or by giving such a tensor as the :attr:`out` argument for an
        operation. In these cases, multiple writes of different data may target
        a single memory location, and the order of writes is not guaranteed.

    Args:
        mode (:class:`bool`): If True, makes potentially nondeterministic
            operations switch to a deterministic algorithm or throw a runtime
            error. If False, allows nondeterministic operations.

    Keyword args:
        warn_only (:class:`bool`, optional): If True, operations that do not
            have a deterministic implementation will throw a warning instead of
            an error. Default: ``False``

    Example::

        >>> # xdoctest: +SKIP
        >>> torch.use_deterministic_algorithms(True)

        # Backward mode nondeterministic error
        >>> torch.nn.AvgPool3d(1)(torch.randn(3, 4, 5, 6, requires_grad=True).cuda()).sum().backward()
        ...
        RuntimeError: avg_pool3d_backward_cuda does not have a deterministic implementation...
    r   Nr7  )Útorch._inductor.configÚ	_inductorÚconfigÚdeterministicrþ  Ú_set_deterministic_algorithms)rð   r8  Úinductor_configs      r   rb   rb   c  s#   € ÷^ 5Ð4à$(€OÔ!Ü×$Ñ$ T°YÖ?r   c                  ó*   — t        j                  «       S )z˜Returns True if the global deterministic flag is turned on. Refer to
    :func:`torch.use_deterministic_algorithms` documentation for more details.
    )rþ  Ú_get_deterministic_algorithmsr   r   r   r4   r4   ø  ó   € ô ×+Ñ+Ó-Ð-r   c                  ó*   — t        j                  «       S )z£Returns True if the global deterministic flag is set to warn only.
    Refer to :func:`torch.use_deterministic_algorithms` documentation for more
    details.
    )rþ  Ú'_get_deterministic_algorithms_warn_onlyr   r   r   rB   rB   ÿ  s   € ô
 ×5Ñ5Ó7Ð7r   Ú
debug_modec                 óž  — t        | t        j                  t        f«      st	        dt        | «      › �«      ‚t        | t        «      r&| dk(  rd} n| dk(  rd} n| dk(  rd} nt        d| › �«      ‚| dk(  rt        j                  d	«       y| dk(  rt        j                  d
d
¬«       y| dk(  rt        j                  d
«       yt        d| › �«      ‚)aö  Sets the debug mode for deterministic operations.

    .. note:: This is an alternative interface for
        :func:`torch.use_deterministic_algorithms`. Refer to that function's
        documentation for details about affected operations.

    Args:
        debug_mode(str or int): If "default" or 0, don't error or warn on
            nondeterministic operations. If "warn" or 1, warn on
            nondeterministic operations. If "error" or 2, error on
            nondeterministic operations.
    z'debug_mode must be str or int, but got Údefaultr   Úwarnrd   Úerroré   zQinvalid value of debug_mode, expected one of `default`, `warn`, `error`, but got FTr7  z:invalid value of debug_mode, expected 0, 1, or 2, but got N)	r  r”   r  rª  r6  rÏ  ÚRuntimeErrorrþ  r>  )rE  s    r   rQ   rQ     s×   € ô  �j¤8§<¡<´Ð"5Ô6ÜÐAÄ$ÀzÓBRÐASÐTÓUÐUä�*œcÔ"Ø˜Ò"Ø‰JØ˜6Ò!Ø‰JØ˜7Ò"Ø‰Jäð,Ø,6¨<ð9óð ð
 �Q‚Ü
×(Ñ(¨Õ/Ø	�qŠÜ
×(Ñ(¨¸Ö>Ø	�qŠÜ
×(Ñ(¨Õ.äØHÈÈÐUó
ð 	
r   c                  óX   — t        j                  «       rt        j                  «       ryyy)zªReturns the current value of the debug mode for deterministic
    operations. Refer to :func:`torch.set_deterministic_debug_mode`
    documentation for more details.
    rd   rJ  r   )rþ  rA  rD  r   r   r   r<   r<   3  s%   € ô 
×'Ñ'Ô)Ü×5Ñ5Ô7Øààr   c                  ó*   — t        j                  «       S )z¢Returns the current value of float32 matrix multiplication precision. Refer to
    :func:`torch.set_float32_matmul_precision` documentation for more details.
    )rþ  Ú_get_float32_matmul_precisionr   r   r   r>   r>   B  rB  r   Ú	precisionc                 ó.   — t        j                  | «       y)aŒ  Sets the internal precision of float32 matrix multiplications.

    Running float32 matrix multiplications in lower precision may significantly increase
    performance, and in some programs the loss of precision has a negligible impact.

    Supports three settings:

        * "highest", float32 matrix multiplications use the float32 datatype (24 mantissa
          bits with 23 bits explicitly stored) for internal computations.
        * "high", float32 matrix multiplications either use the TensorFloat32 datatype (10
          mantissa bits explicitly stored) or treat each float32 number as the sum of two bfloat16 numbers
          (approximately 16 mantissa bits with 14 bits explicitly stored), if the appropriate fast matrix multiplication
          algorithms are available.  Otherwise float32 matrix multiplications are computed
          as if the precision is "highest".  See below for more information on the bfloat16
          approach.
        * "medium", float32 matrix multiplications use the bfloat16 datatype (8 mantissa
          bits with 7 bits explicitly stored) for internal computations, if a fast matrix multiplication algorithm
          using that datatype internally is available. Otherwise float32
          matrix multiplications are computed as if the precision is "high".

    When using "high" precision, float32 multiplications may use a bfloat16-based algorithm
    that is more complicated than simply truncating to some smaller number mantissa bits
    (e.g. 10 for TensorFloat32, 7 for bfloat16 explicitly stored).  Refer to [Henry2019]_ for a complete
    description of this algorithm.  To briefly explain here, the first step is to realize
    that we can perfectly encode a single float32 number as the sum of three bfloat16
    numbers (because float32 has 23 mantissa bits while bfloat16 has 7 explicitly stored, and both have the
    same number of exponent bits).  This means that the product of two float32 numbers can
    be exactly given by the sum of nine products of bfloat16 numbers.  We can then trade
    accuracy for speed by dropping some of these products.  The "high" precision algorithm
    specifically keeps only the three most significant products, which conveniently excludes
    all of the products involving the last 8 mantissa bits of either input.  This means that
    we can represent our inputs as the sum of two bfloat16 numbers rather than three.
    Because bfloat16 fused-multiply-add (FMA) instructions are typically >10x faster than
    float32 ones, it's faster to do three multiplications and 2 additions with bfloat16
    precision than it is to do a single multiplication with float32 precision.

    .. [Henry2019] http://arxiv.org/abs/1904.06376

    .. note::

        This does not change the output dtype of float32 matrix multiplications,
        it controls how the internal computation of the matrix multiplication is performed.

    .. note::

        This does not change the precision of convolution operations. Other flags,
        like `torch.backends.cudnn.allow_tf32`, may control the precision of convolution
        operations.

    .. note::

        This flag currently only affects one native device type: CUDA.
        If "high" or "medium" are set then the TensorFloat32 datatype will be used
        when computing float32 matrix multiplications, equivalent to setting
        `torch.backends.cuda.matmul.allow_tf32 = True`. When "highest" (the default)
        is set then the float32 datatype is used for internal computations, equivalent
        to setting `torch.backends.cuda.matmul.allow_tf32 = False`.

    Args:
        precision(str): can be set to "highest" (default), "high", or "medium" (see above).

    N)rþ  Ú_set_float32_matmul_precision)rO  s    r   rR   rR   I  s   € ô~ ×$Ñ$ YÕ/r   rÒ  c                ó.   — t        j                  | «       y)a”  When this flag is False (default) then some PyTorch warnings may only
    appear once per process. This helps avoid excessive warning information.
    Setting it to True causes these warnings to always appear, which may be
    helpful when debugging.

    Args:
        b (:class:`bool`): If True, force warnings to always be emitted
                           If False, set to the default behaviour
    N)rþ  Ú_set_warnAlways)rÒ  s    r   rU   rU   ‹  s   € ô ×Ñ�qÕr   c                  ó*   — t        j                  «       S )z‰Returns True if the global warn_always flag is turned on. Refer to
    :func:`torch.set_warn_always` documentation for more details.
    )rþ  Ú_get_warnAlwaysr   r   r   rE   rE   ˜  s   € ô ×ÑÓÐr   r8   Úmessagec                 óP  — t        |t        j                  t        f«      st	        dt        |«      › �«      ‚ddlm}  ||«      ry t        | t        «      rt        | t        «      rt        d| › �«      ‚|€d}n&t        |«      st	        d«      ‚t         |«       «      } | |«      ‚)Nzcond must be a bool, but got r   )Úexpect_truez@error_type must be a subclass of Exception but not Warning, got zˆExpected cond to be True, but got False. (Could this error message be improved? If so, please report an enhancement request to PyTorch.)zmessage must be a callable)r  r”   r  r.   r6  rÏ  Ú%torch.fx.experimental.symbolic_shapesrX  Ú
issubclassrõ   ÚWarningrÔ   Úcallablerª  )Ú
error_typer8   rV  rX  Úmessage_evaluateds        r   Ú_check_withr_  §  s§   € ô
 �dœXŸ]™]¬GÐ4Ô5ÜÐ7¼¸T»
°|ÐDÓEÐEåAá�4ÔØô �j¤)Ô,´
¸:ÄwÔ0OÜØNÈzÈlÐ[ó
ð 	
ð €ðñ 	ô ˜Ô ÜÐ8Ó9Ð9ä¡£	›NÐá
Ð&Ó
'Ð'r   c                 ó&   — t        t        | |«       y)a¤  Throws error containing an optional message if the specified condition
    is False.

    Error type: ``RuntimeError``

    C++ equivalent: ``TORCH_CHECK``

    Args:
        cond (:class:`bool`): If False, throw error

        message (Callable, optional): Callable that returns either a string or
            an object that has a ``__str__()`` method to be used as the error
            message. Default: ``None``
    N)r_  rK  ©r8   rV  s     r   r�  r�  Ê  s   € ô ”˜d GÕ,r   z{_check_is_size will be removed in a future PyTorch release along with guard_size_oblivious.     Use _check(i >= 0) instead.)Úcategory)rÐ  c                ó€   — t        | dk\  |«       ddlm}  || «       |�t        | |k  |«       ddlm}  || |«       yy)a{  Checks that a given integer is a valid size (i.e., is non-negative).
    You should use this over ``_check(i >= 0)`` because it can prevent
    ``GuardOnDataDependentSymNode`` exceptions by opting yourself into alternate
    semantics for ``guard_size_oblivious`` tests that treat values 0 and 1
    equivalently to all other values.

    When max is not None, this specifies an upper bound equivalent to
    ``_check(i <= max)``.  This bound is also subject to alternate semantics:
    in ``guard_size_oblivious`` tests, we assume that a constant max bound is
    treated equivalently to all other values.  Symbolic max bounds are not yet
    supported.

    NB: Do NOT use this in contexts where a -1 size would be valid (indicating
    to infer the size from context, or if you should wrap-around or truncate).
    Only use this if the only valid value is an honest to goodness size.
    r   )Ú_advise_is_sizeN)Ú_advise_is_bounded)r�  rY  rd  re  )ÚirV  rÐ  rd  re  s        r   Ú_check_is_sizerg  Ü  sB   € ô. ˆ1�‰6�7ÔÝEá�AÔà
€Üˆq�C‰x˜Ô!åLá˜1˜cÕ"ð r   c                 ó&   — t        t        | |«       y)a¨  Throws error containing an optional message if the specified condition
    is False.

    Error type: ``IndexError``

    C++ equivalent: ``TORCH_CHECK_INDEX``

    Args:
        cond (:class:`bool`): If False, throw error

        message (Callable, optional): Callable that returns either a string or
            an object that has a ``__str__()`` method to be used as the error
            message. Default: ``None``
    N)r_  Ú
IndexErrorra  s     r   Ú_check_indexrj     ó   € ô ”
˜D 'Õ*r   c                 ó&   — t        t        | |«       y)a¨  Throws error containing an optional message if the specified condition
    is False.

    Error type: ``ValueError``

    C++ equivalent: ``TORCH_CHECK_VALUE``

    Args:
        cond (:class:`bool`): If False, throw error

        message (Callable, optional): Callable that returns either a string or
            an object that has a ``__str__()`` method to be used as the error
            message. Default: ``None``
    N)r_  rÕ   ra  s     r   Ú_check_valuerm    rk  r   c                 ó&   — t        t        | |«       y)a¦  Throws error containing an optional message if the specified condition
    is False.

    Error type: ``TypeError``

    C++ equivalent: ``TORCH_CHECK_TYPE``

    Args:
        cond (:class:`bool`): If False, throw error

        message (Callable, optional): Callable that returns either a string or
            an object that has a ``__str__()`` method to be used as the error
            message. Default: ``None``
    N)r_  r6  ra  s     r   Ú_check_typero  $  s   € ô ”	˜4 Õ)r   c                 ó&   — t        t        | |«       y)a»  Throws error containing an optional message if the specified condition
    is False.

    Error type: ``NotImplementedError``

    C++ equivalent: ``TORCH_CHECK_NOT_IMPLEMENTED``

    Args:
        cond (:class:`bool`): If False, throw error

        message (Callable, optional): Callable that returns either a string or
            an object that has a ``__str__()`` method to be used as the error
            message. Default: ``None``
    N)r_  ÚNotImplementedErrorra  s     r   Ú_check_not_implementedrr  6  s   € ô ÜØàõ	r   c                 ó  — t        |«      st        dt        |«      › �«      ‚|j                  t        j
                  k(  st        d|j                  › �«      ‚t        |  |j                  «       j                  «       |«       y )Nzcond must be a tensor, but got z0cond tensor must have dtype torch.bool, but got )	rD   r6  rÏ  ÚdtyperŽ  r  r_  Ú_is_all_truerü  )r]  r8   rV  s      r   Ú_check_tensor_all_withrv  M  sh   € Ü�TŒ?ÜÐ9¼$¸t»*¸ÐFÓGÐGà�:‰:œŸ™Ò#ÜÐJÈ4Ï:É:È,ÐWÓXÐXä�
Ð-˜D×-Ñ-Ó/×4Ñ4Ó6¸Õ@r   c                 ó&   — t        t        | |«       y)aö  Throws error containing an optional message if the specified condition
    is False.

    Error type: ``RuntimeError``

    C++ equivalent: ``TORCH_CHECK_TENSOR_ALL``

    Args:
        cond (:class:`torch.Tensor`): Tensor of dtype ``torch.bool``. If any
            element is ``False``, throw error

        message (Callable, optional): Callable that returns either a string or
            an object that has a ``__str__()`` method to be used as the error
            message. Default: ``None``
    N)rv  rK  ra  s     r   Ú_check_tensor_allrx  X  s   € ô  œ<¨¨wÕ7r   )ÚeÚinfÚnanÚpiÚnewaxis)ry  r|  r{  rz  r}  )r1   )Ústorage)Ú_LegacyStorageÚ_StorageBaseÚ_warn_typed_storage_removalr2   r3   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)r   c                 ó2   — t        d¬«       | j                  S ©Né   ©Ú
stacklevel©r�  Ú_dtyper	  s    r   rt  zByteStorage.dtypeŒ  ó   € ä#¨qÕ1Ø�{‰{Ðr   c                 ó"   — t         j                  S r„   )rŽ  Úuint8r	  s    r   r‰  zByteStorage._dtype‘  ó   € ä�{‰{Ðr   N©rw  rx  ry  r   rt  r‰  r   r   r   r   r   ‹  ó(   „ Øñó ðð ñó ñr   r   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)r#   c                 ó2   — t        d¬«       | j                  S r„  rˆ  r	  s    r   rt  zDoubleStorage.dtype—  rŠ  r   c                 ó"   — t         j                  S r„   )rŽ  Údoubler	  s    r   r‰  zDoubleStorage._dtypeœ  ó   € ä�|‰|Ðr   NrŽ  r   r   r   r#   r#   –  ó(   „ Øñó ðð ñó ñr   r#   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)r%   c                 ó2   — t        d¬«       | j                  S r„  rˆ  r	  s    r   rt  zFloatStorage.dtype¢  rŠ  r   c                 ó"   — t         j                  S r„   )rŽ  r  r	  s    r   r‰  zFloatStorage._dtype§  r�  r   NrŽ  r   r   r   r%   r%   ¡  r�  r   r%   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)ÚHalfStoragec                 ó2   — t        d¬«       | j                  S r„  rˆ  r	  s    r   rt  zHalfStorage.dtype­  rŠ  r   c                 ó"   — t         j                  S r„   )rŽ  Úhalfr	  s    r   r‰  zHalfStorage._dtype²  ó   € ä�z‰zÐr   NrŽ  r   r   r   rš  rš  ¬  ó(   „ Øñó ðð ñó ñr   rš  c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)r*   c                 ó2   — t        d¬«       | j                  S r„  rˆ  r	  s    r   rt  zLongStorage.dtype¸  rŠ  r   c                 ó"   — t         j                  S r„   )rŽ  Úlongr	  s    r   r‰  zLongStorage._dtype½  rž  r   NrŽ  r   r   r   r*   r*   ·  rŸ  r   r*   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)r(   c                 ó2   — t        d¬«       | j                  S r„  rˆ  r	  s    r   rt  zIntStorage.dtypeÃ  rŠ  r   c                 ó"   — t         j                  S r„   )rŽ  r  r	  s    r   r‰  zIntStorage._dtypeÈ  s   € ä�y‰yÐr   NrŽ  r   r   r   r(   r(   Â  s(   „ Øñó ðð ñó ñr   r(   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)r,   c                 ó2   — t        d¬«       | j                  S r„  rˆ  r	  s    r   rt  zShortStorage.dtypeÎ  rŠ  r   c                 ó"   — t         j                  S r„   )rŽ  Úshortr	  s    r   r‰  zShortStorage._dtypeÓ  r�  r   NrŽ  r   r   r   r,   r,   Í  r�  r   r,   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)r!   c                 ó2   — t        d¬«       | j                  S r„  rˆ  r	  s    r   rt  zCharStorage.dtypeÙ  rŠ  r   c                 ó"   — t         j                  S r„   )rŽ  Úint8r	  s    r   r‰  zCharStorage._dtypeÞ  rž  r   NrŽ  r   r   r   r!   r!   Ø  rŸ  r   r!   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)r   c                 ó2   — t        d¬«       | j                  S r„  rˆ  r	  s    r   rt  zBoolStorage.dtypeä  rŠ  r   c                 ó"   — t         j                  S r„   )rŽ  r  r	  s    r   r‰  zBoolStorage._dtypeé  rž  r   NrŽ  r   r   r   r   r   ã  rŸ  r   r   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)ÚBFloat16Storagec                 ó2   — t        d¬«       | j                  S r„  rˆ  r	  s    r   rt  zBFloat16Storage.dtypeï  rŠ  r   c                 ó"   — t         j                  S r„   )rŽ  Úbfloat16r	  s    r   r‰  zBFloat16Storage._dtypeô  ó   € ä�~‰~Ðr   NrŽ  r   r   r   r³  r³  î  ó(   „ Øñó ðð ñó ñr   r³  c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)ÚComplexDoubleStoragec                 ó2   — t        d¬«       | j                  S r„  rˆ  r	  s    r   rt  zComplexDoubleStorage.dtypeú  rŠ  r   c                 ó"   — t         j                  S r„   )rŽ  Úcdoubler	  s    r   r‰  zComplexDoubleStorage._dtypeÿ  s   € ä�}‰}Ðr   NrŽ  r   r   r   rº  rº  ù  s(   „ Øñó ðð ñó ñr   rº  c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)ÚComplexFloatStoragec                 ó2   — t        d¬«       | j                  S r„  rˆ  r	  s    r   rt  zComplexFloatStorage.dtype  rŠ  r   c                 ó"   — t         j                  S r„   )rŽ  Úcfloatr	  s    r   r‰  zComplexFloatStorage._dtype
  r”  r   NrŽ  r   r   r   r¿  r¿    r•  r   r¿  c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)ÚQUInt8Storagec                 ó2   — t        d¬«       | j                  S r„  rˆ  r	  s    r   rt  zQUInt8Storage.dtype  rŠ  r   c                 ó"   — t         j                  S r„   )rŽ  Úquint8r	  s    r   r‰  zQUInt8Storage._dtype  r”  r   NrŽ  r   r   r   rÄ  rÄ    r•  r   rÄ  c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)ÚQInt8Storagec                 ó2   — t        d¬«       | j                  S r„  rˆ  r	  s    r   rt  zQInt8Storage.dtype  rŠ  r   c                 ó"   — t         j                  S r„   )rŽ  Úqint8r	  s    r   r‰  zQInt8Storage._dtype   r�  r   NrŽ  r   r   r   rÉ  rÉ    r�  r   rÉ  c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)ÚQInt32Storagec                 ó2   — t        d¬«       | j                  S r„  rˆ  r	  s    r   rt  zQInt32Storage.dtype&  rŠ  r   c                 ó"   — t         j                  S r„   )rŽ  Úqint32r	  s    r   r‰  zQInt32Storage._dtype+  r”  r   NrŽ  r   r   r   rÎ  rÎ  %  r•  r   rÎ  c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)ÚQUInt4x2Storagec                 ó2   — t        d¬«       | j                  S r„  rˆ  r	  s    r   rt  zQUInt4x2Storage.dtype1  rŠ  r   c                 ó"   — t         j                  S r„   )rŽ  Úquint4x2r	  s    r   r‰  zQUInt4x2Storage._dtype6  r·  r   NrŽ  r   r   r   rÓ  rÓ  0  r¸  r   rÓ  c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)ÚQUInt2x4Storagec                 ó2   — t        d¬«       | j                  S r„  rˆ  r	  s    r   rt  zQUInt2x4Storage.dtype<  rŠ  r   c                 ó"   — t         j                  S r„   )rŽ  Úquint2x4r	  s    r   r‰  zQUInt2x4Storage._dtypeA  r·  r   NrŽ  r   r   r   rØ  rØ  ;  r¸  r   rØ  r  Ú_tensor_classes)ÚampÚrandomÚserialization)rS   )r5   r'   )r?   rA   rH   rN   rT   )rF   rM   c                  óð   — t        j                  «       dk(  ryt        ddd«      } t        t        d«      «       t        j
                  j                  | «      st        d| z   «      ‚| j                  d«      S )Nrí   r   rŽ  rl   Útorch_shm_managerz$Unable to find torch_shm_manager at zutf-8)	r£   rÓ   r   r   rq   rr   rs   rK  Úencode)rr   s    r   Ú_manager_pathrã  m  s`   € Ü‡�Ó˜IÒ%ØÜ˜ %Ð)<Ó=€DÜ'¬°gÓ(>Ô?Ü�7‰7�>‰>˜$ÔÜÐAÀDÑHÓIÐIØ�;‰;�wÓÐr   )Ú
unique_dimrå  Úsegment_reducec              #   ór   K  — | ]/  }t        t        t        |«      t        j                  «      sŒ,|–— Œ1 y ­wr„   )r  ræ  rŽ  rt  )rv   rè  s     r   rx   rx   ¥  s(   è ø€ ð ÙˆT¤:¬g´e¸TÓ.BÄEÇKÁKÕ#P„D‘Zùs   ‚-7°7)Ú_disable_dynamo)Ú_VFÚ
functionalc                 óº   — t        | «      t        j                  ur3t        j                  | f«      rt        j
                  t        | f| |«      S | st        |«      ‚y)zAA wrapper around Python's assert which is symbolically traceable.N)rÏ  rŽ  r1   rÁ  rÍ  rÃ  Ú_assertrÔ   )Ú	conditionrV  s     r   rë  rë  Å  sY   € äˆIƒœeŸl™lÑ*¬y×/KÑ/KØ	ˆô0ô ×.Ñ.Ü�i�\ 9¨gó
ð 	
ñ Ü˜WÓ%Ð%ð r   )r9   r@   rJ   Úset_grad_enabled)Ú
__config__Ú
__future__Ú_awaitsÚacceleratorÚautogradÚbackendsr&  ri   ÚdistributedÚdistributionsÚfftÚfuturesÚhubÚjitÚlinalgÚmpsÚmtiaÚmultiprocessingÚnestedÚnnÚoptimrÁ  ÚprofilerÚsparseÚspecialÚtestingÚtypesÚutilsÚversionÚxpu)Úwindows)Úao)Ú
_size_docsÚ_storage_docsÚ_tensor_docsÚ_torch_docsc                   ó   — y)z?Returns whether PyTorch was built with _GLIBCXX_USE_CXX11_ABI=1Tr   r   r   r   Úcompiled_with_cxx11_abir  	  s   € àr   )Ú_libraryÚ_ops)Úops)Úclassesz.opsz.classes)Úquantization)Úquasirandom)Úregister_after_fork)rG   )Úmasked)Ú_symeigÚeigÚlstsqÚmatrix_rankÚsolve)Úfrom_dlpackÚ	to_dlpackc                   ó\   — e Zd ZdZd„ Zd„ Zdedz  fd„Zdeee	f   dz  fd„Z
d	„ Zd
„ Zd„ Zy)Ú_TorchCompileInductorWrapperÚinductorc                 óÌ  — ddl m} i | _        || _        | j	                  |«       | j                  |«       | j                  |j                  d«      «       d }t        t        d«      r'ddl	m
}  |t        t        j                  dd«      «      }| j                  j                  dd	«      r9|r|d
k  s
t        «       s'dt        j                   d<   dt        j                   d<   y y y )Nr   ©ÚCompilerBisectorr"  r  )ÚTorchVersionri   z0.0útriton.cudagraphsFz12.6Ú1ÚDISABLE_CUPTI_LAZY_REINITÚ0ÚTEARDOWN_CUPTI)Ú!torch._inductor.compiler_bisectorr%  r<  ÚdynamicÚ
apply_modeÚapply_optionsÚget_config_changer›   rŽ  Útorch.torch_versionr&  ræ  r  Úgetr   rq   r­   )r  rð   Úoptionsr-  r%  r®   r&  s          r   r  z%_TorchCompileInductorWrapper.__init__X	  s¾   € ÝFà')ˆŒØˆŒØ�‰˜ÔØ×Ñ˜7Ô#Ø×ÑÐ+×=Ñ=¸jÓIÔJàˆÜ”5˜)Ô$Ý8á'¬´·±¸vÀuÓ(MÓNˆLà�;‰;�?‰?Ð.°Ô6Ù˜l¨VÒ3ÜDÔFà69ŒB�J‰JÐ2Ñ3ð
 ,/ŒB�J‰JÐ'Ò(ð Gð 7r   c                 óŽ   — t        |t        «      xr4 | j                  |j                  k(  xr | j                  |j                  k(  S r„   )r  r!  r<  r-  r  s     r   r7  z#_TorchCompileInductorWrapper.__eq__r	  s<   € ä�uÔ:Ó;ò .Ø—‘˜uŸ|™|Ñ+ò.à—‘ §¡Ñ-ð	
r   rð   Nc                 óf   — |r/|dk7  r)ddl m} | j                   ||| j                  «      «       y y y )NrG  r   )Úlist_mode_options)Útorch._inductorr6  r/  r-  )r  rð   r6  s      r   r.  z'_TorchCompileInductorWrapper.apply_modey	  s0   € Ù�D˜IÒ%Ý9à×ÑÑ0°°t·|±|ÓDÕEð &ˆ4r   r3  c           
      óÒ  — |sy ddl m} |j                  «       }|j                  «       D ]»  \  }}|j	                  dd«      }||vr(t        d|› dt        |j                  «       «      › �«      ‚|j                  |«      }t        |«      €Mt        ||«      sAt        |«      j                  }t        ||   «      j                  }	t        d|› d|› d	|	› �«      ‚|| j                  |<   Œ½ y )
Nr   ©r<  Ú-r   zUnexpected optimization option z, known options are zUnexpected type of attr rÌ  z should be )r7  r<  Úget_config_copyÚitemsr—   rK  ÚlistÚkeysÚget_typeÚ_get_originr  rÏ  rw  )
r  r3  r<  Úcurrent_configÚkeyÚvalÚ	attr_nameÚ	attr_typeÚval_type_strÚexpected_type_strs
             r   r/  z*_TorchCompileInductorWrapper.apply_options	  sô   € ÙØå*à*0×*@Ñ*@Ó*BˆàŸ™ž‰HˆC�ØŸ™ C¨Ó-ˆIØ Ñ.Ü"Ø5°c°UÐ:NÌtÐTb×TgÑTgÓTiÓOjÐNkÐlóð ð Ÿ™¨	Ó2ˆIô ˜9Ó%Ð-Ü! # yÔ1Ü#'¨£9×#5Ñ#5�LÜ(,¨^¸IÑ-FÓ(G×(PÑ(PÐ%Ü&Ø2°3°%°v¸l¸^È;ÐWhÐViÐjóð ð &)ˆD�K‰K˜	Ò"ñ# (r   c                 ó8   — ddl m}  |||| j                  ¬«      S )Nr   )Ú
compile_fx©Úconfig_patches)Útorch._inductor.compile_fxrI  r<  )r  Úmodel_Úinputs_rI  s       r   Ú__call__z%_TorchCompileInductorWrapper.__call__š	  s   € Ý9á˜& '¸$¿+¹+ÔFÐFr   c                 ó4   — ddl m}  || j                  ¬«      S )Nr   )Úget_patched_config_dictrJ  )rL  rQ  r<  )r  rQ  s     r   Úget_compiler_configz0_TorchCompileInductorWrapper.get_compiler_configŸ	  s   € ÝFá&°d·k±kÔBÐBr   c                 ó®   — ddl m} d| j                  v s|j                  j                  r+| j                  j	                  dd«      rddlm}  |«        y y y )Nr   r9  r'  T)Úreset_cudagraph_trees)r7  r<  ÚtritonÚ
cudagraphsr2  Útorch._inductor.cudagraph_treesrT  )r  r<  rT  s      r   Úresetz"_TorchCompileInductorWrapper.reset¤	  sD   € Ý*à $§+¡+Ñ-°·±×1IÒ1IØ�{‰{�‰Ð2°DÔ9ÝQá%Õ'ð :ð 2Jr   )rw  rx  ry  Úcompiler_namer  r7  rª  r.  ÚdictÚ_Anyr/  rO  rR  rX  r   r   r   r!  r!  U	  sM   „ Ø€Mò/ò4
ðF˜s T™zó Fð) T¨#¨t¨)¡_°tÑ%;ó )ò6Gò
Có
(r   r!  c                   ó,   ‡ — e Zd ZdZˆ fd„Zˆ fd„Zˆ xZS )Ú_TorchCompileAOTInductorWrapperÚaotinductorc                 ót   •— t         ‰| �  |||«       | j                  ddi«       | j                  ddi«       y )NÚcpp_wrapperTzaot_inductor.package)Úsuperr  r/  )r  rð   r3  r-  r  s       €r   r  z(_TorchCompileAOTInductorWrapper.__init__±	  s;   ø€ Ü‰Ñ˜˜w¨Ô0Ø×Ñ˜M¨4Ð0Ô1Ø×ÑÐ2°DÐ9Õ:r   c                 óÔ  •— ddl m} ddlm} ddlm} ddlm}  ||«      }|r|j                  j                  |dd«      n |«       }|j                  d«      5  |5  t        j                  j                  j                  dd«      5  t        ‰	| �=  ||«      cd d d «       cd d d «       cd d d «       S # 1 sw Y   nxY w	 d d d «       n# 1 sw Y   nxY wd d d «       y # 1 sw Y   y xY w)	Nr   )Únullcontext)Úmock)Údetect_fake_mode)ÚVÚallow_non_fake_inputsTÚenable_autograd_for_aot)Ú
contextlibrc  Úunittestrd  Útorch._guardsre  Útorch._inductor.virtualizedrf  Úpatchr{  Úset_aot_compilationrŽ  r;  r<  ra  rO  )
r  rM  rN  rc  rd  re  rf  Ú	fake_modeÚctxr  s
            €r   rO  z(_TorchCompileAOTInductorWrapper.__call__¶	  s¶   ø€ Ý*Ý!å2Ý1á$ WÓ-ˆ	ñ ð �J‰J×Ñ˜iÐ)@À$ÔGá“ð 	ð ×!Ñ! $Õ'ÚÜ�O‰O×"Ñ"×(Ñ(Ð)BÀDÕIä‘7Ñ# F¨GÓ4÷ JÐI÷ ˆC÷ (Ñ'çIÐIúÐI÷ �C‰Cú÷ (×'Ñ'úsB   ÁCÁ+C	ÂB3Â	C	Â 	CÂ3B<Â8C	Ã 	CÃ	C	ÃCÃC')rw  rx  ry  rY  r  rO  Ú__classcell__)r  s   @r   r]  r]  ®	  s   ø„ Ø!€Mô;÷
5ð 5r   r]  c                   ó$   — e Zd Zd„ Zd„ Zd„ Zd„ Zy)Ú_TorchCompileWrapperc                 ó"  — ddl m} t        |t        «      r|| _        n.t        |d«      r|j                  | _        nt        |«      | _        || _         ||«      | _        i | _	        |r|dk7  r|| j                  d<   |r|| j                  d<   y y )Nr   )Úlookup_backendrw  rG  rð   r3  )
Útorch._dynamo.backends.registryru  r  rª  rY  r›   rw  r-  Úcompiler_fnÚkwargs)r  Úbackendrð   r3  r-  ru  s         r   r  z_TorchCompileWrapper.__init__Ì	  s„   € ÝBä�gœsÔ#Ø!(ˆDÕÜ�W˜jÔ)Ø!(×!1Ñ!1ˆDÕä!$ W£ˆDÔØˆŒÙ)¨'Ó2ˆÔØˆŒá�D˜IÒ%Ø"&ˆD�K‰K˜ÑÙØ%,ˆD�K‰K˜	Ò"ð r   c                 óÄ   — t        |t        «      xrO | j                  |j                  k(  xr4 | j                  |j                  k(  xr | j                  |j                  k(  S r„   )r  rs  rw  rx  r-  r  s     r   r7  z_TorchCompileWrapper.__eq__Þ	  sW   € ä�uÔ2Ó3ò .Ø× Ñ  E×$5Ñ$5Ñ5ò.à—‘˜uŸ|™|Ñ+ò.ð —‘ §¡Ñ-ð		
r   c                 ó>   —  | j                   ||fi | j                  ¤ŽS r„   )rw  rx  )r  rM  rN  s      r   rO  z_TorchCompileWrapper.__call__æ	  s    € Øˆt×Ñ ¨Ñ?°4·;±;Ñ?Ð?r   c                 óf   — t        | j                  d«      r| j                  j                  «        y y )NrX  )r›   rw  rX  r	  s    r   rX  z_TorchCompileWrapper.reseté	  s)   € Ü�4×#Ñ# WÔ-Ø×Ñ×"Ñ"Õ$ð .r   N)rw  rx  ry  r  r7  rO  rX  r   r   r   rs  rs  Ë	  s   „ ò-ò$
ò@ó%r   rs  Ú_InputTÚ_RetTr"  ©Ú	fullgraphr-  ry  rð   r3  ÚdisableÚmodelr€  r-  ry  r3  r�  c                 ó   — y r„   r   ©r‚  r€  r-  ry  rð   r3  r�  s          r   r7   r7   ò	  s   € ð !$r   c                 ó   — y r„   r   r„  s          r   r7   r7   ÿ	  s	   € ð ILr   c                óÀ  ‡‡‡‡‡‡— ddl }t        j                  d«       t        j                  dk\  rt        d«      ‚|j                  d«      dk(  rt        j                  dk  rt        d	«      ‚| €3d
t        t        t        f   dt        t        t        f   fˆˆˆˆˆˆfd„}|S ‰�‰�t        d«      ‚‰€‰€dŠddl
m}	 |	j                  «       x}
r6ddlmc m} |j                   j"                  r|
dk(  rt%        ‰t&        «      r|
Šd}d}‰r4t%        ‰t(        «      r$‰j+                  dd«      }‰j+                  dd«      }t,        j.                  j1                  «       r&ddlm}  |«       st7        j8                  dd¬«       | S ‰dk(  r|rt;        ‰‰‰«      Šnt=        ‰‰‰«      Šnt?        ‰‰‰‰«      Št-        j@                  jC                  ‰‰‰‰|¬«      | «      S )a›  
    Optimizes given model/function using TorchDynamo and specified backend.
    If you are compiling an :class:`torch.nn.Module`, you can also use :meth:`torch.nn.Module.compile`
    to compile the module inplace without changing its structure.

    Concretely, for every frame executed within the compiled region, we will attempt
    to compile it and cache the compiled result on the code object for future
    use.  A single frame may be compiled multiple times if previous compiled
    results are not applicable for subsequent calls (this is called a "guard
    failure"), you can use TORCH_LOGS=guards to debug these situations.
    Multiple compiled results can be associated with a frame up to
    ``torch._dynamo.config.recompile_limit``, which defaults to 8; at which
    point we will fall back to eager.  Note that compile caches are per
    *code object*, not frame; if you dynamically create multiple copies of a
    function, they will all share the same code cache.

    Args:
       model (Callable or None): Module/function to optimize
       fullgraph (bool): If False (default), torch.compile attempts to discover compilable regions
        in the function that it will optimize. If True, then we require that the entire function be
        capturable into a single graph. If this is not possible (that is, if there are graph breaks),
        then this will raise an error. This also opts into unbacked semantics, notably it will turn on
        capture_scalar_outputs and capture_dynamic_output_shape_ops on by default.
       dynamic (bool or None): Use dynamic shape tracing.  When this is True, we will up-front attempt
        to generate a kernel that is as dynamic as possible to avoid recompilations when
        sizes change.  This may not always work as some operations/optimizations will
        force specialization; use TORCH_LOGS=dynamic to debug overspecialization.
        When this is False, we will NEVER generate dynamic kernels, we will always specialize.
        By default (None), we automatically detect if dynamism has occurred and compile a more
        dynamic kernel upon recompile.
       backend (str or Callable): backend to be used

        - "inductor" is the default backend, which is a good balance between performance and overhead

        - Non experimental in-tree backends can be seen with `torch._dynamo.list_backends()`

        - Experimental or debug in-tree backends can be seen with `torch._dynamo.list_backends(None)`

        - To register an out-of-tree custom backend:
          https://docs.pytorch.org/docs/main/user_guide/torch_compiler/torch.compiler_custom_backends.html#registering-custom-backends
       mode (str): Can be either "default", "reduce-overhead", "max-autotune" or "max-autotune-no-cudagraphs"

        - "default" is the default mode, which is a good balance between performance and overhead

        - "reduce-overhead" is a mode that reduces the overhead of python with CUDA graphs,
          useful for small batches.  Reduction of overhead can come at the cost of more memory
          usage, as we will cache the workspace memory required for the invocation so that we
          do not have to reallocate it on subsequent runs.  Reduction of overhead is not guaranteed
          to work; today, we only reduce overhead for CUDA only graphs which do not mutate inputs.
          There are other circumstances where CUDA graphs are not applicable; use TORCH_LOGS=perf_hints
          to debug.

        - "max-autotune" is a mode that leverages Triton or template based matrix multiplications
          on supported devices and Triton based convolutions on GPU.
          It enables CUDA graphs by default on GPU.

        - "max-autotune-no-cudagraphs" is a mode similar to "max-autotune" but without CUDA graphs

        - To see the exact configs that each mode sets you can call `torch._inductor.list_mode_options()`

       options (dict): A dictionary of options to pass to the backend. Some notable ones to try out are

        - `epilogue_fusion` which fuses pointwise ops into templates. Requires `max_autotune` to also be set

        - `max_autotune` which will profile to pick the best matmul configuration

        - `fallback_random` which is useful when debugging accuracy issues

        - `shape_padding` which pads matrix shapes to better align loads on GPUs especially for tensor cores

        - `triton.cudagraphs` which will reduce the overhead of python with CUDA graphs

        - `trace.enabled` which is the most useful debugging flag to turn on

        - `trace.graph_diagram` which will show you a picture of your graph after fusion

        - `guard_filter_fn` that controls which dynamo guards are saved with compilations.
          This is an unsafe feature and there is no backward compatibility guarantee provided
          for dynamo guards as data types.
          For stable helper functions to use, see the documentations in `torch.compiler`, for example:
          - `torch.compiler.skip_guard_on_inbuilt_nn_modules_unsafe`
          - `torch.compiler.skip_guard_on_all_nn_modules_unsafe`
          - `torch.compiler.keep_tensor_guards_unsafe`

        - For inductor you can see the full list of configs that it supports by calling `torch._inductor.list_options()`
       disable (bool): Turn torch.compile() into a no-op for testing

    Example::

        @torch.compile(options={"triton.cudagraphs": True}, fullgraph=True)
        def foo(x):
            return torch.sin(x) + torch.cos(x)

    r   Nztorch.compile)r…  é   z.torch.compile is not supported on Python 3.15+ÚPy_GIL_DISABLEDrd   )r…  é   r…  zetorch.compile is not supported on Python < 3.13.3 built with GIL disabled. Please use Python 3.13.3+.r‚  r   c           	      óB   •— | €t        d«      ‚t        | ‰‰‰‰‰‰¬«      S )NzModel can't be Noner  )rK  r7   )r‚  ry  r�  r-  r€  rð   r3  s    €€€€€€r   rç  zcompile.<locals>.fn‰
  s6   ø€ Øˆ}Ü"Ð#8Ó9Ð9ÜØØ#ØØØØØôð r   zVEither mode or options can be specified, but both can't be specified at the same time.rG  r$  r"  FÚguard_filter_fnÚuse_aoti)Ú_in_hop_compilez?torch.compile is ignored when called inside torch.export regionrJ  r†  )ry  Únopythonr-  r�  r‹  )"r‹   rþ  Ú_log_api_usage_oncerŽ   Úversion_inforK  r’   Ú	_Callabler}  r~  r,  r%  Úget_backendr:  r;  r<  Útest_configsÚ'bisect_keep_custom_backend_for_inductorr  rª  rZ  ÚpoprŽ  ÚcompilerÚis_exportingÚtorch._higher_order_ops.utilsr�  ÚwarningsrH  r]  r!  rs  Ú_dynamoÚoptimize)r‚  r€  r-  ry  rð   r3  r�  r‹   rç  r%  Úbisect_backendr?  r‹  rŒ  r�  s    ``````        r   r7   r7   
  sé  ý€ óV ä×Ñ˜?Ô+Ü
×Ñ˜7Ò"ÜÐKÓLÐLØ	×	!Ñ	!Ð"3Ó	4¸Ò	9¼c×>NÑ>Nð Rò ?ô
 ð)ó
ð 	
ð €}ð	”i¤¬ Ñ/ð 	´I¼gÄu¸nÑ4M÷ 	ò 	ð ˆ	àÐ˜GÐ/ÜØdó
ð 	
ð €|˜˜ØˆåBà)×5Ñ5Ó7Ð7€~Ð7ß8Ð8ð
 ×(Ñ(×PÒPØ *Ò,Ü˜w¬Ô,à$ˆGà€OØ€HÙ”:˜g¤tÔ,Ø!Ÿ+™+Ð&7¸Ó>ˆØ—;‘;˜z¨5Ó1ˆä‡~�~×"Ñ"Ô$ÝAáÔ Ü�M‰MØQØõð
 ˆLà�*ÒÙÜ5°d¸GÀWÓM‰Gä2°4¸À'ÓJ‰Gä& w°°g¸wÓGˆä�=‰=×!Ñ!ØØØØØ'ð "ó ð óð r   c           	      ó.  — t        j                  | «      j                  } t        j                  t
           }t        || «      rt        d| › dt        || «      › d�«      ‚t        || |«       dj                  t
        | g«      }|t        j                  |<   y)zùRegister an external runtime module of the specific :attr:`device_type`
    supported by torch.

    After the :attr:`module` is registered correctly, the user can refer
    the external runtime module as part of torch with attribute torch.xxx.
    zThe runtime module of 'z$' has already been registered with 'Ú'r~   N)rŽ  r!  rÏ  rŽ   r  rw  r›   rK  ræ  Úsetattrrt   )Údevice_typer  ÚmÚtorch_module_names       r   Ú_register_device_moduler£  Ï
  s�   € ô —,‘,˜{Ó+×0Ñ0€KÜ�‰”HÑ€AÜˆq�+ÔÜØ% k ]ð 3%Ü%,¨Q°Ó%<Ð$=¸Qð@ó
ð 	
ô ˆAˆ{˜FÔ#ØŸ™¤(¨KÐ!8Ó9ÐØ%+„C‡K�KÐ!Ò"r   )r:   ÚfuncÚlibraryÚreturn_types)r8   Ú
while_loop)rc   Ú
_c10d_init)Ú_meta_registrationsÚTORCH_CUDA_SANITIZER)Úfx)r–  c                   óx   — e Zd ZU ej                  j                  dd«      Zi Zee	e
e
f   ef   ed<   ed„ «       Zy)Ú_TritonLibraryrU  ÚDEFÚ	ops_tablec                 óÜ   — ||f| j                   vrL| j                  j                  |«       | j                  j                  d|z   ||«       || j                   ||f<   | j                   ||f   S )Nztriton::)r¯  rm   ÚdefineÚimpl)ÚclsÚop_keyÚfull_schemaÚop_implÚdispatch_keys        r   Ú
registerOpz_TritonLibrary.registerOp  sc   € à�LÐ!¨¯©Ñ6Ø�G‰G�N‰N˜;Ô'Ø�G‰G�L‰L˜ fÑ,¨g°|ÔDØ4;ˆC�M‰M˜6 <Ð0Ñ1à�}‰}˜f lÐ3Ñ4Ð4r   N)rw  rx  ry  rŽ  r¥  rk   rm   r¯  rZ  r|  rª  r‘  Ú__annotations__Úclassmethodr¸  r   r   r   r­  r­    sF   … Ø
�-‰-×
Ñ
 ¨%Ó
0€CØ24€Iˆt�E˜#˜s˜(‘O YÐ.Ñ/Ó4àñ5ó ñ5r   r­  )Úhas_mpsÚhas_cudaÚ	has_cudnnÚ
has_mkldnn)rš  r;  Ú_subclassesÚonnx>   rÀ  rš  Ú_exportr;  c           	      ó   — t         j                  | «      }|�=dd l} |j                  d| › d|j                  › d|j
                  › d�d¬«        |«       S | t        v rt        j                  d| › �t
        «      S t        dt
        › d	| › d�«      ‚)
Nr   rž  z' is deprecated, please use 'r~   z()'rJ  r†  zmodule 'z' has no attribute ')
Ú_deprecated_attrsr2  r™  rH  rx  rw  Ú_lazy_modulesÚ	importlibÚimport_moduleÚAttributeError)rè  Úreplacementr™  s      r   Ú__getattr__rÉ  1  s�   € ä'×+Ñ+¨DÓ1ˆØÐ"ÛàˆH�M‰MØ�D�6Ð6°{×7MÑ7MÐ6NÈaÐP[×PdÑPdÐOeÐehÐiØõñ “=Ð ð ”=Ñ Ü×*Ñ*¨Q¨t¨f¨:´xÓ@Ð@ä˜x¬ zÐ1EÀdÀVÈ1ÐMÓNÐNr   c                 ór  — t        | t        j                  «      r| j                  }njt        | t        «      r t        j                  | «      j                  }n:| €)t        j
                  j                  «       j                  }nt        d| › d�«      ‚t        t        |d«      }|€t        d|› d|› d�«      ‚|S )zÒ
    Returns the module associated with a given device(e.g., torch.device('cuda'), "mtia:0", "xpu", ...).
    If no device is given, return the module for the current accelerator or CPU if none is present.
    NzInvalid value of device 'z$', expect torch.device, str, or NonezDevice 'z<' does not have a corresponding module registered as 'torch.z'.)	r  rŽ  r!  rÏ  rª  rþ  Ú_get_acceleratorrK  ræ  )r!  Údevice_module_nameÚdevice_modules      r   r=   r=   D  s·   € ô �&œ%Ÿ,™,Ô'Ø#Ÿ[™[ÑÜ	�FœCÔ	 Ü"Ÿ\™\¨&Ó1×6Ñ6ÑØ	ˆä"ŸX™X×6Ñ6Ó8×=Ñ=ÑäØ'¨ xÐ/SÐTó
ð 	
ô œEÐ#5°tÓ<€MØÐÜØÐ)Ð*Ð*fÐgyÐfzÐz|Ð}ó
ð 	
ð Ðr   rÜ  rÐ  c                 ó4   — t        j                  | ||¬«       y)ae  
    This indicates that a given int is size-like, and can be used in any context where a size is expected.
    You will typically use this when reading out integers from Tensors, e.g., max.item() or lengths.tolist()
    which then need to be used as tensor constructors. Providing these assertions to PyTorch can help resolve
      GuardOnDataDependentSymNode errors upon export, since we cannot guard on unbacked SymInts.

    This function has unusual semantics in some circumstances in framework
    code, we will treat this int as >= 2 (when we do a size-oblivious guard).
    This makes it easier to use the unbacked int in size contexts,
    as we will often attempt to guard on a size being zero/one
    (e.g., when computing the contiguity of a tensor, or testing if
    broadcasting can occur), which will not work on unbacked SymInts.
    However, if we conservatively assume that the size is not zero/one, we will
    end up with a graph that will still work even if the size is zero/one.

    For more details, see https://docs.google.com/document/d/1HSuTTVvYH1pTew89Rtpeu84Ht3nQEFTYhAX3Ypa_xJs/edit
    ```
    )rÜ  rÐ  N)rŽ  Úsym_constrain_range_for_size)ÚsymbolrÜ  rÐ  s      r   Ú_constrain_as_sizerÑ  ]  s   € ô. 
×&Ñ& v°3¸CÖ@r   )Ú_loggingc                  óº   — ddl m}  d} | |¬«      }|D ]  }	 |j                  «       } |«        Œ y# t        $ r}t	        d|j
                  › d�«      |‚d}~ww xY w)zœ
    Leverage the Python plugin mechanism to load out-of-the-tree device extensions.
    See this RFC: https://github.com/pytorch/pytorch/issues/122468
    r   )Úentry_pointsztorch.backends)Úgroupz&Failed to load the backend extension: zN. You can disable extension auto-loading with TORCH_DEVICE_BACKEND_AUTOLOAD=0.N)Úimportlib.metadatarÔ  rF   rõ   rK  rè  )rÔ  Ú
group_nameÚbackend_extensionsÚbackend_extensionÚ
entrypointrÅ   s         r   Ú_import_device_backendsrÛ  }  sz   € õ
 0à!€JÙ%¨JÔ7Ðã/Ðð		à*×/Ñ/Ó1ˆJá�Lñ 0øô ò 	ÜØ8Ð9J×9OÑ9OÐ8Pð Q_ð `óð ðûð	ús   ˜2²	A»AÁAc                  ó4   — t        j                  dd«      dk(  S )ab  
    Whether autoloading out-of-the-tree device extensions is enabled.
    The switch depends on the value of the environment variable
    `TORCH_DEVICE_BACKEND_AUTOLOAD`.

    Returns:
        bool: Whether to enable autoloading the extensions. Enabled by default.

    Examples:
        >>> torch._is_device_backend_autoload_enabled()
        True
    ÚTORCH_DEVICE_BACKEND_AUTOLOADr(  )rq   r�   r   r   r   Ú#_is_device_backend_autoload_enabledrÞ  ”  s   € ô �9‰9Ð4°cÓ:¸cÑAÐAr   c                 ó"  — t        | «      }|t        j                  u r&t        j                  | t        j
                  d¬«      S |t        j                  u r&t        j                  | t        j                  d¬«      S t        j                  | «      S )zú
    Like torch.as_tensor, but when given Python data types it will keep
    them in full precision.  Used for calling convention for Dynamo.
    Python scalars (float, int) are always created on CPU to avoid being
    affected by DeviceContext.
    r&  )rt  r!  )rÏ  r”   r  rŽ  Ú	as_tensorÚfloat64r  Úint64)rù  Útys     r   Ú_as_tensor_fullprecrä  ¥  sb   € ô 
ˆa‹€BØ	ŒX�^‰^ÑÜ�‰˜q¬¯©¸eÔDÐDØ	Œx�|‰|Ñ	Ü�‰˜q¬¯©¸EÔBÐBä�‰˜qÓ!Ð!r   )r   N)Tr„   )r   ztorch.device)r!  r   r   N)r5  ztorch.dtyper   N)NN(S  rz  r”   r™   Ú	functoolsr}   rÅ  r  r%  rq   r£   rŽ   r§   Ú	threadingr™  Úcollections.abcr   r‘  Útypingr   r[  r   r@  r   Ú	_overloadr   r   Ú_TypeVarÚtyping_extensionsr	   Ú_deprecatedr
   Ú
_ParamSpecr   Ú_TypeIsr  r   Útorch._utilsr   Ú_syncr   r   Útorch._utils_internalr   r   r   r   r   r1  r   Útorch.typesr   r   Ú__all__ÚsortedrÔ   ro   re   Ú
initializeÚImportErrorrÆ   rª  r=  rÏ   rØ   r¥   rë   rû   r�   rÓ   ÚgetdlopenflagsÚ	old_flagsÚsetdlopenflagsrò   Ú	RTLD_LAZYÚtorch._Cr0   r/   r.   r^   rX   rZ   r\   r|  rÏ  rÎ  r]   r_   ré  Ú__fnÚ__nameÚ
__sym_namery  rw  Úglobalsr÷  Úappendr[   rY   rý  rþ  Ú_C_for_compiled_checkr‘   r¨   r©   rŽ  Ú__objr  Úendswithræ  r\  Úisclassrx  Údelattrr  r  r`   rD   rC   Úlocalr,  r;   rO   rP   r6  rb   r4   rB   r  rQ   r<   r>   rR   rU   rE   r_  r�  ÚFutureWarningrg  rj  rm  ro  rr  rv  rx  ry  rz  r{  r|  r}  r¹  r˜   Útorch._tensorr1   r~  Útorch.storager  r€  r�  r2   r3   r   r#   r%   rš  r*   r(   r,   r!   r   r³  rº  r¿  rÄ  rÉ  rÎ  rÓ  rØ  r  r  rÜ  rÝ  rÞ  rß  Útorch._tensor_strrS   Ú	torch.ampr5   r'   Útorch.randomr?   rA   rH   rN   rT   Útorch.serializationrF   rM   rã  Útorch._C._VariableFunctionsrå  Ú_segment_reduceÚPRIVATE_OPSÚ_VariableFunctionsr
  Útorch._compilerç  rè  ré  Útorch.functionalrë  Útorch.autogradr9   r@   rJ   rí  rî  rï  rð  rñ  rò  ró  r&  ri   rô  rõ  rö  r÷  rø  rù  rú  rû  rü  rý  rþ  rÿ  r   rÁ  r  r  r  r  r  r  r  r  Útorch.signalr	  r
  Útorch.nn.intrinsicÚtorch.nn.qatÚtorch.nn.quantizableÚtorch.nn.quantizedÚ_init_namesr  r  r  r  r  r  r  Ú
torch._opsr  Útorch._classesr  r  r  r  Úcontiguous_formatÚlegacy_contiguous_formatÚtorch.multiprocessing._atforkr  Úget_num_threadsÚtorch._lobpcgrG   ÚatenÚquantized_lstmÚquantized_grur  Útorch._linalg_utilsr  Úsymeigr  r  r  r  Útorch.utils.dlpackr  r  r!  r]  rs  r}  r~  rZ  r7   r£  r:   r¤  r¥  r¦  Útorch._higher_order_opsr8   r§  Ú
torch.funcrc   r›   Ú%torch.distributed._meta_registrationsr©  Úcoll_meta_registrationsr­   Útorch.cuda._sanitizerÚ
_sanitizerÚcsanÚenable_cuda_sanitizerr¾  r«  Ú_initr–  r­  Úis_builtrÛ   Úis_availableÚmkldnnrÃ  rš  r;  r¿  rÀ  rÄ  rÉ  Úcacher!  r=   rÑ  rÒ  Ú
_init_logsrÛ  rÞ  rä  r   r   r   Ú<module>r6     s  ðòó Û Û Û Û Û Û Û 	Û Û 
Û Û Û Ý 1÷õ ÷ñ ð˜hŸm™mó ÷ñ ÷
õ õ ;ñ ß/òH€ðV ‰f�W‹oÒÙ
Ð6Ó
7Ð7ðÝð €J×ÑÔØð ‡<�<�7Òóu/ñn ÔØð(˜cð (¨sð (¸cð (ÀdÈ3Áió (ñ( #ð °ð Àð ÐPTó ñ$#I˜G d™Nð #I°dó #IóN"CñJ " Y R§Y¡YÐ/FÔ%GØ€H‡O�OÓ˜Ò"ð$ #�×"Ñ"Ó$€IØ€C×Ñ�r—~‘~¨¯©Ñ4Ô5äà€C×Ñ�yÔ!Ùñ ÙÔÜ÷Bñ B÷Jw2ñ w2÷tJ0ñ J0òZò"òò"ð:"˜u U¨4°¨9Ñ%5°u¸TÀ3¸YÑ7GÐ%GÑHó "ò$"ò*Lò.
ð (Ñ €€fˆjó€Fð ˜˜Ð!€JÙ˜FÓ#€DØ(2Ð2€DÔ˜œØ �GƒIˆjÒð!ð& 	ˆ&�*Ð.ñ ‹9�[Ñ!€Ø ‡�ˆzÔ ò
ò%ð
å'õ2 ð �€ˆÙ�"Žg€FØˆa�y�CÒ §¡°Ô 7Ø�‰�vÔÙ˜˜FÓ#ˆÙ�EŒ?˜o˜gŸo™o¨eÕ4Ø×Ñ 8Ó+àð "ò ð
 (0�EÕ$Ø	�<Ó	á�—‘˜HÑ% vÕ.ð ð" ˆEáó
?ñ % RÔ(Ø(ð "�$ð  "˜có  "ðF)�4ð )˜w ~Ñ6ó )ð)�Dð ) §¡ó )ð< )˜Ÿ™Ó*Ð óóB;;ð|#˜t NÑ3°cÑ9ð #Àó #ó>2ðp  %òR@Ø
�-‰-ðR@ð �}‰}ðR@ð 
ó	R@ðj.¨h¯m©mó .ð8°x·}±}ó 8ð)
¨X¯\©\¸CÑ-?ð )
ÀDó )
ðX h§l¡ló ð. có .ð?0¨Cð ?0°Dó ?0ðD
�x—}‘}ð 
¨Dó 
ð  §¡ó  ð (à
�-‰-˜'Ñ
!ð (ð �r˜3�wÑó (óF-ñ$ ð!àôð
#¨4ó #óð
#ó>+ó$+ó$*ó$ó.Aó8÷2 !Ó  ð €ˆÓ à ‡‚Ò3Ô 4õ !õ %÷õ ô�.ô ô�Nô ô�>ô ô�.ô ô�.ô ô�ô ô�>ô ô�.ô ô�.ô ô�nô ô˜>ô ô˜.ô ô�Nô ô�>ô ô�Nô ô�nô ô�nô ð ØØØØØØØØØØØØØØØØØØð'>Ð �#�d˜<¨.Ñ8Ñ9Ñ:ó ñ. .1«U€��T˜.Ñ)Ñ*Ó 2÷ OÑ NÝ .ß *ß VÕ Vß *ò ð €× Ñ ‘-“/Ô "àñ ô .ð %€OØð €à�€ˆÙ�"×'Ò'Ö(€FØ×Ò˜Ô &¨KÑ"7ØÙ�B×)Ò)¨6Ó2€EØ€EÔàÐ!Ò!à!‰‹	�&ÑØ�v‘ˆØ�GƒIˆfÑØ×Ò˜SÕ!Ø�‰�vÕð )ð ˆEó ð ‡‚ñ Ù˜”Zóô õ +÷ 7Ü ð Øò	&÷*ó ÷÷ ÷ ÷ ÷ ÷ ÷ ÷ õ@ ,õ
 ó Û Û Û ð €‡‚‰tÐ$Ó%Ô &÷ GÕ Fñ �˜}¨jð §¡ô ÷
 5Ó 4÷ "Ð !ß -Ð -à ‡�× Ò ˜(˜ 4Ð(©#Ô .Ø ‡�× Ò ˜(˜ 8Ð,©gÔ 6÷ /÷ -ñ
 -Ñ ÷ >Ð =ò �E×)Ò)Ô *Ù÷ +Ð *ñ —’×(Ò(�Ù—’×&Ò&�÷
 #÷÷ ÷ ð ÷ 6Ô 5÷V(ò V(ôr5Ñ&Bõ 5÷: %ò  %ñF �YÓ
�Ù�Ó�ð ð  %Ø$(Ø)ØØPTØ"ò	$Ø‘W™e�^Ñ$ð	$ð �}‰}ð	$ð �]‰]˜TÑ!ð		$ð
 �9‰_ð	$ð �‰*ð	$ñ �#�s˜XŸ\™\Ñ)¨H¯M©MÑ9¸IÑEÐEÑFÈÑMð	$ð �]‰]ð	$ð ‰w™ˆ~Ñò	$ó ñ	$ð àð	Lð  %Ø$(Ø)ØØPTØ"ò	LØð	Lð �}‰}ð	Lð �]‰]˜TÑ!ð		Lð
 �9‰_ð	Lð �‰*ð	Lñ �#�s˜XŸ\™\Ñ)¨H¯M©MÑ9¸IÑEÐEÑFÈÑMð	Lð �]‰]ð	Lð �	™'¡5˜.Ñ)Ð*¨I±g¹u°nÑ,EÐEÑFò	Ló ñ	Lð /3ð@ð  %Ø$(Ø)ØØPTØ"ò@Ø‘W™e�^Ñ$ tÑ+ð@ð �}‰}ð@ð �]‰]˜TÑ!ð	@ð
 �9‰_ð@ð �‰*ð@ñ �#�s˜XŸ\™\Ñ)¨H¯M©MÑ9¸IÑEÐEÑFÈÑMð@ð �]‰]ð@ð ˆy™¡%˜Ñ(Ð)¨9±W¹e°^Ñ+DÐDÑEØ‘™�Ññ ô@óF,÷(÷ ó ÷ KÔ Jß #Ð #ñ ò ˆu�x‰x˜Ô&ßOÓOá#ß)ð ˜RŸZšZÑ'ß(Ó(à�D×ÒÔ ô &ß ð ‡‚× Ò × Ò Ô ç &÷5ò 5ð  �~Š~×!Ò!×*Ò*Ø—’×#Ò#×,Ò,Ø—’×%Ò%×2Ò2Ø—.’.×'Ò'×4Ò4ñ	Ñ ñ ÷÷ ô ò�MóOð& ‡‚ñ˜eŸlšl¨SÑ0°4Ñ7ò ó ñð4  $Ø#ñAà	�‰˜Ñ	ðAð 
�‰˜Ñ	ôA÷4 ð �× Ò Ô óð.B¨X¯]©]ô Bó""ò& 'Ô(ÚÕð )øðwX ò 	Úð	ûðj ò 
Ý,à×%Ñ%Ð-ÙØˆH�O‰Oðó÷ ‰e‹gó
ð ð	ð  
ð)
ús   Â&o& È.o2 ï&o/ï.o/ï2A p2