+
    ˜°³jXB  ã                   ó6  € ^ RI t ^ RIt^ RIHtHt ^ RIt^ RIt^ RIt^ RIH	t	 ^ RI
t
^ RIHtHt ^ RIt^ RIt]P                   ! ]4      tR tR t]! 4       tR t]]]]! R4      ]]3t^ tR t ! R	 R
]4      t RRRR/R lt!R t"R t#R t$R t%Rt&Rt'R t(R t)R t*R# )é    N)ÚAnyÚ
NamedTuple)ÚNamedTemporaryFile)Ú_frames_fmtÚ_block_extrac                 ó²   a aa€ R oR V3R llp\         P                  ! V4       R VV 3R llo\        P                  P	                  S4       R V3R llpV# )Tc                ó   € V ^8„  d   QhRR/# ©é   ÚreturnN© )Úformats   "ÚX/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/utils/viz/_cycles.pyÚ__annotate__Ú%observe_garbage.<locals>.__annotate__   s   € ÷ ñ �Tñ ó    c                  ó   <€ R o R# )FNr   )Úenableds   €r   ÚdisableÚ observe_garbage.<locals>.disable   s
   ø€ ð Šr   c                ó   € V ^8„  d   QhRR/# r
   r   )r   s   "r   r   r      s   € ÷ ''ñ '' Dñ ''r   c                 óþ   <aaa€ S'       g   R # V R8X  d'   \         P                  ! \         P                  4       R # V R8X  d;   \        P                  ! 4       oR.oVVVVV3R lp\        P
                  ! V4       R # R # )NÚstartÚstopFc                  óN  <€ S^ ,          '       g   RS^ &   Mû\         P                  ! S4       Ro SR,          ^8w  d   \        P                  ! 4        S! \        P                  4       \        P                  P                  4        \        P                  ! ^ 4       \        P                  P                  4       p\        P                  ! 4        \        P                  P                  4       pW#8w  d   \        P                  RW#,
          4       RoSe	   S! V / VB # R#   Roi ; i)r   TFÚ
generationz.CUDA Memory changed during GC, %d bytes freed.N)ÚsysÚ
setprofileÚgcÚcollectÚgarbageÚclearÚ	set_debugÚtorchÚcudaÚmemory_allocatedÚloggerÚwarning)	ÚargsÚkwargsÚbeforeÚafterr   ÚinfoÚobserverÚ
orig_traceÚself_returns	   *,  €€€€€r   Ú
do_collectÚ8observe_garbage.<locals>.gc_callback.<locals>.do_collect#   sÚ   ø€ à" 1—~”~Ø%)�K ’Nä—N’N :Ô.Ø#�Gð'ð   Õ-°Ô2ÜŸJšJœLÙ ¤§¡Ô,ÜŸ
™
×(Ñ(Ô*ô Ÿš QœÜ!&§¡×!<Ñ!<Ó!>˜ÜŸ
š
œÜ %§
¡
× ;Ñ ;Ó =˜Ø!œ?Ü"ŸN™NÐ+[Ð]cÕ]kÔlà"&˜ØÒ)Ù% tÐ6¨vÑ6Ð6ñ *øð #'™ús   °C D  Ä D$)r   r#   ÚDEBUG_SAVEALLr   Ú
getprofiler   )Úphaser-   r1   r/   r0   r   r.   s   &f @@€€r   Úgc_callbackÚ$observe_garbage.<locals>.gc_callback   s[   û€ çÙØ�GÔÜ�LŠLœ×)Ñ)Ö*Ø�fŒ_ÜŸšÓ)ˆJØ ˜'ˆK÷7ñ 7ô: �NŠN˜:Ö&ñC r   c                ó   € V ^8„  d   QhRR/# r
   r   )r   s   "r   r   r   E   s   € ÷ )ñ )�Dñ )r   c                  óF   <€ \         P                  P                  S 4       R # ©N)r   Ú	callbacksÚremove)r6   s   €r   r<   Úobserve_garbage.<locals>.removeE   s   ø€ Ü
�‰×Ñ˜KÖ(r   )ÚatexitÚregisterr   r;   Úappend)r.   r   r<   r   r6   s   f  @@r   Úobserve_garbagerA      sN   ú€ Ø€G÷ð ô
 ‡O‚O�GÔ÷''ñ ''ôR ‡L�L×Ñ˜Ô$÷)ð )à€Mr   c                  óN   € RR lp \        V ! 4       P                  ^ ,          4      # )Nc                 ó   a € V 3R  l# )c                  ó   <€ S # r:   r   ©Úxs   €r   Ú<lambda>Ú+_get_cell_type.<locals>.f.<locals>.<lambda>Z   s   ø€ ‘qr   r   rE   s   fr   ÚfÚ_get_cell_type.<locals>.fY   s	   ø€ ÜÐr   r:   )ÚtypeÚ__closure__)rI   s    r   Ú_get_cell_typerM   X   s   € ôä‘“—‘ Õ"Ó#Ð#r   c                ó‚  a aaa€ / oR V3R lloR VV 3R lloR V3R llpR V3R llpR	 VV 3R
 llpR VV 3R llpR VV 3R llpR V3R llpR VV 3R llpR VVV 3R llpR V3R llp	\         V\        V\        V\        V\        V\
        P                  V\
        P                  V\        V\
        P                  V\        P                  V\
        P                  V	/p
\        S 4      P                   F  pWº9   g   K  W«,          ! 4        K  	  S! RR4       \        S \        4      '       d	   S! R4       S# )a  
Return known information about references held by the given object.

Returns a mapping from referents to lists of descriptions.  Note that there
may be more than one edge leading to any particular referent; hence the
need for a list.  Descriptions are currently strings.

c                ó   € V ^8„  d   QhRR/# r
   r   )r   s   "r   r   Ú*annotated_references.<locals>.__annotate__j   s   € ÷ 8ñ 8 Dñ 8r   c                 ó\   <€ SP                  \        V4      . 4      P                  V 4       R # r:   )Ú
setdefaultÚidr@   )ÚnameÚobjÚ
referencess   &&€r   Úadd_referenceÚ+annotated_references.<locals>.add_referencej   s"   ø€ Ø×Ñœb ›g rÓ*×1Ñ1°$Ö7r   c                ó   € V ^8„  d   QhRR/# r
   r   )r   s   "r   r   rP   m   s   € ÷ 8ñ 8˜Tñ 8r   c                  óh   <€ V  F*  p\        SV4      '       g   K  S! V\        SV4      4       K,  	  R # r:   )ÚhasattrÚgetattr)ÚattrsÚattrrW   rU   s   * €€r   Ú	add_attrsÚ'annotated_references.<locals>.add_attrsm   s+   ø€ ÛˆDÜ�s˜D×!Ô!Ù˜d¤G¨C°Ó$6Ö7ó r   c                ó   € V ^8„  d   QhRR/# r
   r   )r   s   "r   r   rP   r   s   € ÷ ñ  ñ r   c                  ó>   <€  S ! R 4       R#   \          d     R# i ; i)Úcell_contentsN)Ú
ValueError©r_   s   €r   Úadd_cell_referencesÚ1annotated_references.<locals>.add_cell_referencesr   s$   ø€ ð	Ù�oÖ&øÜô 	ò
 ð	ús   ƒ �›c                ó   € V ^8„  d   QhRR/# r
   r   )r   s   "r   r   rP   |   s   € ÷ 
$ñ 
$ Tñ 
$r   c                  ó(   <€ S ! R RRRRRRRR4	       R	# )
Ú__defaults__rL   Ú__globals__Ú__code__Ú__name__Ú
__module__Ú__doc____qualname__Ú__annotations__Ú__kwdefaults__Nr   re   s   €r   Úadd_function_referencesÚ5annotated_references.<locals>.add_function_references|   s'   ø€ Ù�.ØØØØØð!à#Ø"ö		$r   c                ó   € V ^8„  d   QhRR/# r
   r   )r   s   "r   r   rP   ‰   s   € ÷ 1ñ 1 Tñ 1r   c                  óJ   <€ \        S4       F  w  rS! R V  R2V4       K  	  R# )Ú[Ú]N)Ú	enumerate)ÚpositionÚitemrW   rU   s     €€r   Úadd_sequence_referencesÚ5annotated_references.<locals>.add_sequence_references‰   s%   ø€ Ü'¨žn‰NˆHÙ˜A˜h˜Z q˜/¨4Ö0ó -r   c                ó   € V ^8„  d   QhRR/# r
   r   )r   s   "r   r   rP   �   s   € ÷ 3ñ 3 ñ 3r   c                  óx   <€ SP                  4        F$  w  rS! R V 4       S! R\        V 4       R2V4       K&  	  R# )Úkeyrv   rw   N)ÚitemsÚrepr)r   ÚvaluerW   rU   s     €€r   Úadd_dict_referencesÚ1annotated_references.<locals>.add_dict_references�   s6   ø€ ØŸ)™)ž+‰JˆCÙ˜% Ô%Ù˜Aœd 3›i˜[¨Ð*¨EÖ2ó &r   c                ó   € V ^8„  d   QhRR/# r
   r   )r   s   "r   r   rP   ’   s   € ÷ *ñ * ñ *r   c                  ó,   <€ S F  p S! R V 4       K  	  R# )ÚelementNr   )ÚeltrW   rU   s    €€r   Úadd_set_referencesÚ0annotated_references.<locals>.add_set_references’   s   ø€ ÛˆCÙ˜) SÖ)ó r   c                ó   € V ^8„  d   QhRR/# r
   r   )r   s   "r   r   rP   –   s   € ÷ 6ñ 6¨ñ 6r   c                  ó   <€ S ! R RR4       R# )Ú__self__Ú__func__Úim_classNr   re   s   €r   Úadd_bound_method_referencesÚ9annotated_references.<locals>.add_bound_method_references–   s   ø€ Ù�*˜j¨*Ö5r   c                ó   € V ^8„  d   QhRR/# r
   r   )r   s   "r   r   rP   ™   s   € ÷ 6ñ 6 Dñ 6r   c                  óº   <€ \        S4      \        P                  J d=   \        P                  ! S4      p \        V 4      ^8X  d   V ^ ,          pS! RV4       R# R# R# )é   Ú__callback__N)rK   ÚweakrefÚrefr   Úget_referentsÚlen)Ú	referentsÚtargetrW   rU   s     €€r   Úadd_weakref_referencesÚ4annotated_references.<locals>.add_weakref_references™   sN   ø€ ô �‹9œŸ™Ó#Ü×(Ò(¨Ó-ˆIÜ�9‹~ Ô"Ø" 1��Ù˜n¨fÖ5ñ #ñ $r   c                ó   € V ^8„  d   QhRR/# r
   r   )r   s   "r   r   rP   £   s   € ÷ 6ñ 6 $ñ 6r   c                  óÂ   <€ SP                   p S! R RRRRR4       \        V 4      \        J d2   SP                   P                  4        F  w  rS! RV 2V4       K  	  R# R# )Úf_backÚf_codeÚ
f_builtinsÚ	f_globalsÚf_traceÚf_localszlocal N)r¥   rK   Údictr€   )r¥   rT   Úlocalr_   rW   rU   s      €€€r   Úadd_frame_referencesÚ2annotated_references.<locals>.add_frame_references£   sZ   ø€ Ø—<‘<ˆÙ�(˜H l°KÀÈJÔWô �‹>œTÓ!Ø"Ÿ|™|×1Ñ1Ö3‘�Ù  t f˜o¨uÖ5ó  4ñ "r   c                ó   € V ^8„  d   QhRR/# r
   r   )r   s   "r   r   rP   ­   s   € ÷ 9ñ 9¨dñ 9r   c                  ó   <€ S ! R RR4       R# )Ú__objclass__rm   Ú__doc__Nr   re   s   €r   Ú add_getset_descriptor_referencesÚ>annotated_references.<locals>.add_getset_descriptor_references­   s   ø€ Ù�. *¨iÖ8r   Ú__dict__Ú	__class__Ú__mro__)ÚtupleÚlistr¦   ÚsetÚ	frozensetÚtypesÚFunctionTypeÚ	FrameTypeÚCellTypeÚ
MethodTyper–   r—   ÚGetSetDescriptorTyperK   r²   Ú
isinstance)rU   rf   rr   r{   rƒ   r‰   r�   rœ   r¨   r®   Útype_based_referencesÚtype_r_   rW   rV   s   f           @@@r   Úannotated_referencesrÀ   _   s*  û€ ð (*€J÷8ð 8÷8ñ 8÷
ð ÷
$ð 
$÷1ñ 1÷3ñ 3÷
*ñ *÷6ð 6÷6ñ 6÷6ò 6÷9ð 9ô 	Ð&ÜÐ%ÜÐ!ÜÐÜÐ%Ü×ÑÐ3Ü�‰Ð-ÜÐ%Ü×ÑÐ5Ü�‰Ð+Ü×"Ñ"Ð$DðÐô �c“×"Ô"ˆØÖ)Ø!Ö(Ö*ñ #ñ ˆj˜+Ô&Ü�#”t×ÒÙ�)ÔàÐr   c                ó  € R p\        V \        4      '       d   \        V 4      # \        V 4      P                  R8X  d   RV P                   2# \        V \
        P                  4      '       d    V P                  P                  pRV 2# \        V \        4      '       d   RV! V 4       R2# \        V \        4      '       d   RV! V 4       R	2# \        V \        4      '       d   R
\        V 4       R2# \        V \
        P                  4      '       d   RV P                   2# \        V \        4      '       d   RV P                   2# \        V \        P                   4      '       d   V ! 4       pVf   R# R\#        V4      R 2# \        V \
        P$                  4      '       dU   V P&                  P(                  p\        V4      \*        8”  d   RV\*        ^,
          ) R ,           pRV RV P,                   2# \/        V 4      '       d=   R\        V 4      P0                   R\        V 4      P                   RV P2                   R	2# R\        V 4      P0                   R\        V 4      P                   2#   \         d    Rp ELýi ; i)zl
Return a string to be used for Graphviz nodes.

The string should be short but as informative as possible.
c                 ó’   € R P                  R V R,           4       4      p\        V 4      ^8”  d   V R\        V 4      ^,
           2pV# )Ú,c              3   óŽ   "  € T F;  p\        V\        4      '       d   \        V4      M\        V4      P                  x € K=  	  R # 5ir:   )r½   Ú
BASE_TYPESr�   rK   rm   )Ú.0rF   s   & r   Ú	<genexpr>Ú=object_annotation.<locals>.format_sequence.<locals>.<genexpr>×   s2   é € ÐdÑ\cÐWX¤:¨a´×#<Ò#<œ˜QœÄ$ÀqÃ'×BRÑBRÔRÓ\cùs   ‚AA:Né   Nz, ...)Újoinr™   )rU   Úbodys   & r   Úformat_sequenceÚ*object_annotation.<locals>.format_sequenceÖ   sE   € Ø�x‰xÑdÐ\_Ð`bÖ\cÓdÓdˆÜˆs‹8�aŒ<Ø�V˜5¤ S£¨A¥ Ð/ˆDØˆr   Úfunctionz	function
z<anonymous>zinstancemethod
rv   rw   Ú(Ú)zdict[zmodule
ztype
Nzweakref (dead referent)zweakref to id 0xrF   z...zframe
Ú:zobject
Ú.z ()r½   rÅ   r�   rK   rm   r·   r»   rŽ   Ú__qualname__ÚAttributeErrorr´   r³   r¦   r™   Ú
ModuleTyper–   r—   rS   r¹   r¡   Úco_filenameÚFRAME_FILENAME_LIMITÚf_linenoÚis_cuda_tensorrn   Úshape)rU   rÌ   Ú	func_nameÚreferentÚfilenames   &    r   Úobject_annotationrÞ   Ï   s3  € òô �#”z×"Ò"Ü�C‹yÐÜˆCƒy×Ñ˜ZÔ'Ø˜CŸL™L˜>Ð*Ð*Ü	�Cœ×)Ñ)×	*Ò	*ð	&ØŸ™×1Ñ1ˆIð " ) Ð-Ð-Ü	�Cœ×	Ò	Ø‘? 3Ó'Ð(¨Ð*Ð*Ü	�Cœ×	Ò	Ø‘? 3Ó'Ð(¨Ð*Ð*Ü	�Cœ×	Ò	Ø”s˜3“x�j Ð"Ð"Ü	�Cœ×)Ñ)×	*Ò	*Ø˜#Ÿ,™,˜Ð(Ð(Ü	�Cœ×	Ò	Ø˜Ÿ™�~Ð&Ð&Ü	�CœŸ™×	%Ò	%Ù“5ˆØÒÙ,à%¤b¨£l°1Ð%5Ð6Ð6Ü	�CœŸ™×	)Ò	)Ø—:‘:×)Ñ)ˆÜˆx‹=Ô/Ô/Ø˜xÔ*>ÀÕ*BÐ(CÐ(DÐEÕEˆHØ˜˜
 ! C§L¡L >Ð2Ð2Ü	˜×	Ò	Øœ$˜s›)×.Ñ.Ð/¨q´°c³×1CÑ1CÐ0DÀBÀsÇyÁyÀkÐQRÐSÐSàœ$˜s›)×.Ñ.Ð/¨q´°c³×1CÑ1CÐ0DÐEÐEøô7 ô 	&Ø%‹Ið	&ús   Á/I2 É2JÊJc                   ó,   a € ] tR tRt o V 3R ltRtV tR# )ÚNodei  c                ó~   <€ V ^8„  d   Qh/ S[ ;R&   S[ R,          ;R&   S[;R&   S[S[S[ S[3,          ,          ;R&   # )r   ÚlabelNÚcontextÚrootÚ
referrents)ÚstrÚboolr´   r³   Úint)r   Ú__classdict__s   "€r   r   ÚNode.__annotate__  sD   ø‡ ‚ Ù�Jñ á�4�ZÑñ ñ �Jñ ñ ‘U™3¡˜8•_Õ%Ñ%ò	 r   r   N)rm   rn   rÓ   Ú__firstlineno__Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__)ré   s   @r   rà   rà     s   ø‡ ‡ „ r   rà   rã   Úfilterc          
      óV  € Vf   \        4       pVf   \        pV  Uu. uF'  p\        V\        P                  4      '       d   K%  VNK)  	  p pV  Uu. uF&  p\        \        V4      V! V4      V! V4      . 4      NK(  	  ppV  Uu. uF  p. NK  	  pp\        V 4       UUu/ uF  w  rc\        V4      VbK  	  pppV  F¶  pV\        V4      ,          pWH,          p	\        V4      p
\        P                  ! V4       Ft  p\        V4      pVP                  V4      pVf   K%  V
P                  VR.4      pW],          P                  V4       V F  pV	P                  P                  Wý34       K!  	  Kv  	  K¸  	  \        V4       UUu. uF  w  ppVP                  '       g   K  VNK  	  ppp\!        4       pV'       dG   VP#                  4       pVV9   d   K!  VP%                  V4       VV,          pVP'                  V4       KN  / p. p\        V4       F.  w  ppVV9   g   K  \)        V4      VV&   VP                  V4       K0  	  V FC  pVP                   UUu. uF  w  ppVV9   g   K  VVV,          3NK  	  uppVP                  R&   KE  	  V# u upi u upi u upi u uppi u uppi u uppi )NÚ?:NNN)Úcuda_allocation_contextrÙ   r½   r–   Ú
ProxyTypesrà   rÞ   rx   rS   rÀ   r   r˜   Úgetr@   rå   rä   rµ   ÚpopÚaddÚextendr™   )Úobjectsrã   rï   rU   ÚnodesÚnode_referrersÚiÚ
id_to_nodeÚfidxrI   rV   Ú	referrentÚridÚtidxÚlabelsrâ   ÚnÚ	to_searchÚto_keepÚidxÚ	referrersÚid_to_filtered_idÚfiltereds   &$$                    r   Úcreate_graphr	  	  sb  € Ø‚Ü)Ó+ˆØ‚~Üˆá%ÓQ™g�s¬Z¸¼W×=OÑ=O×-P�sˆs™g€GÐQÙT[Ó\ÑT[ÈSŒTÔ# CÓ(©'°#«,¹¸s»ÀRÖHÑT[€EÐ\Ù5<Ó&=±W¨c£r±W€NÐ&=ä+4°WÔ+=Ô>Ñ+=¡ ”"�S“'˜1’*Ñ+=€JÑ>ÛˆØœ"˜S›'Õ"ˆØ�KˆÜ)¨#Ó.ˆ
Ü×)Ò)¨#Ö.ˆIÜ�Y“-ˆCØ—>‘> #Ó&ˆDØŠ|ÙØ—^‘^ C¨#¨Ó/ˆFØÕ ×'Ñ'¨Ô-Û�Ø—‘×#Ñ# U MÖ2ó  ó /ñ	 ô  )¨Ô/Ô:Ñ/‘t�q˜!°1·6µ6—�Ñ/€IÑ:Ü‹e€Gß
Ø�m‰m‹oˆØ�'Œ>ÙØ�‰�CÔØ" 3Õ'ˆ	Ø×Ñ˜Ö#Ø(*ÐØ€HÜ˜%Ö ‰ˆˆ1Ø�Ž<Ü#&Ð'8Ó#9Ð˜aÑ Ø�O‰O˜AÖñ !ó ˆà/0¯|ª|ô8Ù/;™|  sØ!Ð%6Ñ6ô ;˜EÐ#4°SÕ#9Ó:Ù/;ò8ˆ�‰�Q‹ñ ð €OùòM RùÚ\ùÚ&=ùã>ùó ;ùó 8s5   �"J
ÁJ
Á,JÂJÂJÆJÆJÉJ%É$J%c                 ó.   € \         P                  ! V 4      # r:   )ÚjsonÚdumps)r  s   &r   Úescaper  7  s   € Ü�:Š:�a‹=Ðr   c                 óä   € \        V \        P                  4      ;'       dP    V P                  P                  R 8H  ;'       d/    \        P
                  P                  P                  V 4      '       * # )r%   )r½   r$   ÚTensorÚdevicerK   Ú_subclassesÚfake_tensorÚis_fake_tensor)rU   s   &r   rÙ   rÙ   ;  sV   € ä�3œŸ™Ó%÷ 	>ð 	>Ø�
‰
�‰˜6Ñ!÷	>ð 	>ä×Ñ×)Ñ)×8Ñ8¸Ó=Ô=ðr   c                  ó  a€ \         P                  P                  P                  4       p / oV R ,           FK  pVR,          pVR,           F2  pVR,          R8X  d   \	        V4      w  rEVSV&   W#R,          ,          pK4  	  KM  	  V3R lpV# )ÚsegmentsÚaddressÚblocksÚstateÚactive_allocatedÚsizec                 óÈ   <€ \        V 4      '       dP   V P                  4       P                  4       pSP                  V4      pVe   RP	                  \        VRR7      4      # R # )NÚ
T)Úfull_filename)rÙ   Úuntyped_storageÚdata_ptrrô   rÊ   r   )rU   ÚaddrÚframesÚaddr_to_frames   &  €r   Úobject_contextÚ/cuda_allocation_context.<locals>.object_contextM  sT   ø€ Ü˜#×ÒØ×&Ñ&Ó(×1Ñ1Ó3ˆDØ"×&Ñ& tÓ,ˆFØÒ!Ø—y‘y¤¨VÀ4Ô!HÓIÐIÙr   )r$   r%   ÚmemoryÚ	_snapshotr   )ÚsnapshotÚsegr   Úblkr!  Ú
_real_sizer#  r"  s          @r   rò   rò   B  sˆ   ø€ Ü�z‰z× Ñ ×*Ñ*Ó,€HØ€MØ˜
×#Ð#ˆØ�9�~ˆØ�x—=�=ˆCØ�7�|Ð1Ô1Ü%1°#Ó%6Ñ"�Ø&,�˜dÑ#Ø˜•KÕŠDó	 !ñ $õð Ðr   c                 ó�  € . ROp\        V 4       FF  w  r#TP                  T R\        VP                  4       RVP                  '       d   RMR R24       KH  	  \        V 4       F=  w  r$VP
                   F(  w  rVVP                  V RV R\        V4       R24       K*  	  K?  	  VP                  R	4       R
P                  V4      # )údigraph GraphName {z [label=z, color=ÚredÚblackz];z -> z
 [label = rw   z}
r  )r,  znode [shape=rect];zrankdir=LR;)rx   r@   r  râ   rä   rå   rÊ   )rù   Úlinesrû   r  rI   râ   Újs   &      r   Úto_dotr1  V  s°   € ÚH€EÜ˜%Ö ‰ˆØ�‰˜�s˜(¤6¨!¯'©'£?Ð"3°8ÀQÇVÇVÀV¹EÐQXÐ;YÐY[Ð\Ö]ñ !ô ˜%Ö ‰ˆØŸœ‰HˆEØ�L‰L˜A˜3˜d 1 # Z´°u³¨¸aÐ@ÖAó %ñ !ð 
‡L�L�ÔØ�9‰9�UÓÐr   a  
<!DOCTYPE html>
<html>
<head>
  <style>
    body {
      margin: 0;
      padding: 0;
      overflow: hidden;
    }

    #container {
      display: flex;
      flex-direction: column;
      height: 100vh;
    }

    #main {
      flex: 2;
      height: 60vh;
      overflow: clip;
    }

    #preContainer {
      flex: 1;
      height: 40vh;
      overflow: auto;
    }

    pre {
      margin: 0;
      padding: 10px;
    }
  </style>
</head>
<body>
  <div id="container">
    <div id="main">
    </div>
    <div id="preContainer">
      <pre id="stacktrace">Mouse over tensor objects to see where they were allocated.</pre>
    </div>
  </div>
<script src='https://cdnjs.cloudflare.com/ajax/libs/viz.js/1.8.0/viz-lite.js'></script>
<script>
let dot = $DOT
let image = Viz(dot, {format: 'svg', 'totalMemory': 1024*1024*1024});
let main = document.getElementById('main')
main.innerHTML = image
let svg = main.firstElementChild
// Panning and zooming logic
let isPanning = false;
let startX, startY;
let viewBox = { x: 0, y: 0, width: parseFloat(svg.getAttribute('width')), height: parseFloat(svg.getAttribute('height')) };
svg.removeAttribute('width');
svg.removeAttribute('height');
function updateViewBox() {
    svg.setAttribute('viewBox', `${viewBox.x} ${viewBox.y} ${viewBox.width} ${viewBox.height}`);
}
updateViewBox()
svg.setAttribute('preserveAspectRatio', 'xMidYMid meet');
svg.addEventListener('mousedown', function(e) {
    isPanning = true;
    startX = e.clientX;
    startY = e.clientY;
});
svg.addEventListener('mousemove', function(e) {
    if (!isPanning) return;
    const dx = (e.clientX - startX) * (viewBox.width / svg.clientWidth);
    const dy = (e.clientY - startY) * (viewBox.height / svg.clientHeight);
    viewBox.x -= dx;
    viewBox.y -= dy;
    startX = e.clientX;
    startY = e.clientY;
    updateViewBox();
});
svg.addEventListener('mouseup', function() {
    isPanning = false;
});
svg.addEventListener('mouseleave', function() {
    isPanning = false;
});
svg.addEventListener('wheel', function(e) {
    e.preventDefault();
    const zoomFactor = 0.1;
    const zoomAmount = e.deltaY > 0 ? 1 + zoomFactor : 1 - zoomFactor;
    // Calculate mouse position relative to the SVG
    const rect = svg.getBoundingClientRect();
    const mouseX = e.clientX - rect.left;
    const mouseY = e.clientY - rect.top;
    const mouseXRel = mouseX / svg.clientWidth;
    const mouseYRel = mouseY / svg.clientHeight;
    // Adjust viewBox to zoom around the mouse position
    const newWidth = viewBox.width * zoomAmount;
    const newHeight = viewBox.height * zoomAmount;
    viewBox.x += (viewBox.width - newWidth) * mouseXRel;
    viewBox.y += (viewBox.height - newHeight) * mouseYRel;
    viewBox.width = newWidth;
    viewBox.height = newHeight;
    updateViewBox();
});
$LISTENERS
</script>
</body>
</html>
z˜
document.getElementById('node{id}').addEventListener('mouseover', function(event) {{
  document.getElementById("stacktrace").textContent = {stack}
}})
c           	      ó”  € . p\        V 4       Fo  w  r#VP                  f   K  \        P                  \	        V^,           4      \        VP                   RVP                   24      R7      pVP                  V4       Kq  	  \        V 4      p\        P                  R\        V4      4      P                  RRP                  V4      4      # )Nz:
)rS   Ústackz$DOTz
$LISTENERSr  )rx   rã   Ú_listener_templater   ræ   r  râ   r@   r1  Ú	_templateÚreplacer�   rÊ   )rù   Ú	listenersrû   r  ÚsÚdots   &     r   Úto_htmlr:  Ð  s¥   € Ø€IÜ˜%Ö ‰ˆØ�9‰9ÒÙÜ×%Ñ%¬¨Q°­U«¼6ÀQÇWÁWÀIÈSÐQR×QZÑQZÐP[ÐB\Ó;]Ð%Ó^ˆØ×Ñ˜Öñ	 !ô
 �‹-€CÜ×Ñ˜V¤T¨#£YÓ/×7Ñ7¸ÀdÇiÁiÐPYÓFZÓ[Ð[r   c                 ó€   a € \         P                  P                  P                  R R7       R V 3R llp\	        V4      # )i † )Úmax_entriesc                ó   € V ^8„  d   QhRR/# r
   r   )r   s   "r   r   Ú+observe_tensor_cycles.<locals>.__annotate__Ý  s   € ÷ 5ñ 5˜Tñ 5r   c                 óò   <€ V '       dn   \         ;QJ d    R  V  4       F  '       g   K   RM	  RM! R  V  4       4      '       g   \        P                  R4       R# S! \        \	        V 4      4      4       R# R# )c              3   ó8   "  € T F  p\        V4      x € K  	  R # 5ir:   )rÙ   )rÆ   rU   s   & r   rÇ   Ú:observe_tensor_cycles.<locals>.observer.<locals>.<genexpr>ß  s   é € Ð>±g¨s”~ c×*Ð*³gùs   ‚TFz No CUDA Tensors found in garbageN)Úanyr'   r-   r:  r	  )r!   Úcallbacks   &€r   r.   Ú'observe_tensor_cycles.<locals>.observerÝ  sN   ø€ ßß“3Ñ>±gÓ>—3—3’3Ñ>±gÓ>×>Ò>Ü—‘Ð>Ô?ÙÙ”Wœ\¨'Ó2Ó3Ö4ñ	 r   )r$   r%   r%  Ú_record_memory_historyrA   )rC  r.   s   f r   Úobserve_tensor_cyclesrF  Ú  s5   ø€ Ü	‡J�J×Ñ×,Ñ,¸Ð,Ô@÷5ð 5ô ˜8Ó$Ð$r   c                 óN   € \         P                  R4       R R lp \        V 4      # )af  
Install a warning that reports whenever a cycle that is holding CUDA memory is observed.

The warning produces an .html file that visualizes the cycle,
and links it to the stack frame that allocated the CUDA tensor.

Reference cycles are freed by the cycle collector rather than being cleaned up
when the objects in the cycle first become unreachable. If a cycle points to a tensor,
the CUDA memory for that tensor will not be freed until garbage collection runs.
Accumulation of CUDA allocations can lead to out of memory errors (OOMs), as well as
non-deterministic allocation behavior which is harder to debug.
z2Watching Python reference cycles for CUDA Tensors.c                ó   € V ^8„  d   QhRR/# r
   r   )r   s   "r   r   Ú(warn_tensor_cycles.<locals>.__annotate__õ  s   € ÷ kñ k˜tñ kr   c                 óÌ   € \        R RR7      ;_uu_ 4       pVP                  V 4       \        P                  RVP                  4       RRR4       R#   + '       g   i     R# ; i)Úwz.html)ÚsuffixzDReference cycle includes a CUDA Tensor see visualization of cycle %sN)r   Úwriter'   r(   rT   )ÚhtmlrI   s   & r   Úwrite_and_logÚ)warn_tensor_cycles.<locals>.write_and_logõ  sA   € Ü ¨G×4Õ4¸Ø�G‰G�DŒMÜ�N‰NÐaÐcd×ciÑciÔj÷ 5×4×4Ò4ús   –2AÁA#	)r'   r-   rF  )rO  s    r   Úwarn_tensor_cyclesrQ  æ  s$   € ô ‡K�KÐDÔEõkô ! Ó/Ð/r   )+r   r   Útypingr   r   r·   r–   r  Útempfiler   r$   Útorch.cuda._memory_vizr   r   r>   ÚloggingÚ	getLoggerrm   r'   rA   rM   rº   rÀ   rè   ÚfloatÚcomplexrK   ræ   ÚbytesrÅ   r×   rÞ   rà   r	  r  rÙ   rò   r1  r5  r4  r:  rF  rQ  r   r   r   Ú<module>rZ     sÌ   ðã 	Û 
ß "Û Û Û Ý 'Û ß <Û Û Ø	×	Ò	˜8Ó	$€ò8òR$ñ
 Ó€ògðZ �5˜'¡4¨£:¨s°EÐ:€
ØÐ ò0Fôh&ˆ:ô &ð, Tð ,°$ô ,ò\òòò(	ði€	ðTÐ ò
\ò	%ô0r   