ó
    EñiI  ã                   ó¬  • % S SK r S SKrS SKrS SKJr  S SKJr  S SKJr  S SK	J
r
JrJr  S SKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  \R.                  " \5      r/ SQr0 q\\\
4   \S'   Sq\\   \S'   Sq Sq!Sr"0 r#\\\\\
4   4   \S'   S\S\\\
4   SS4S jr$\" SS9 " S S\5      5       r%\" SS9 " S S5      5       r&\" SS9\S0S j5       5       r'\S0S j5       r(\" SS9S\)\   4S j5       r*\" SS9\S\4S  j5       5       r+\" SS9S\4S! j5       r,\" SS9S" 5       r-\" SS9S# 5       r.\" SS9S\)\   4S$ j5       r/\" SS9S\04S% j5       r1S\04S& jr2\" SS9\S1S' j5       5       r3\" SS9S\\\
4   4S( j5       r4\" SS9\S) 5       5       r5\" SS9S* 5       r6\" SS9S+\S\\\
4   4S, j5       r7S-\S\4S. jr8S-\\\)\   4   S\)\)\      4S/ jr9g)2é    N)Údefaultdict)Úcontextmanager)ÚEnum)ÚAnyÚOptionalÚUnion)Úsignpost_eventé   )Úcompatibility)ÚGraph)ÚGraphModule)ÚNode)ÚannotateÚannotate_fnÚpreserve_node_metaÚhas_preserved_node_metaÚset_stack_traceÚset_grad_fn_seq_nrÚreset_grad_fn_seq_nrÚformat_stackÚset_current_metaÚget_current_metaÚ
NodeSourceÚNodeSourceActionÚget_graph_provenance_jsonÚset_current_replay_nodeÚget_current_replay_nodeÚcurrent_metaÚcurrent_replay_nodeFz<Gradient addition node due to multiple use of tensor around:Ú_FX_METADATA_REGISTRYÚmodule_nameÚmetadataÚreturnc                 ó   • U[         U '   g)aT  
Register FX metadata in the global in-memory registry.

This is called automatically during graph module compilation to store metadata
for later use by memory profiler augmentation.

Args:
    module_name: The module identifier (content-addressed filename)
    metadata: Metadata dict containing lineno_map, node_metadata, and source_code
N)r    )r!   r"   s     ÚO/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/fx/traceback.pyÚ_register_fx_metadatar&   8   s   € ð *2Ô˜+Ò&ó    )Úis_backward_compatiblec                   ó   • \ rS rSrSrSrSrg)r   éG   ÚcreateÚreplace© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__ÚCREATEÚREPLACEÚ__static_attributes__r-   r'   r%   r   r   G   s   † à€FØƒGr'   r   c                   ót  • \ rS rSr% Sr " S S5      r\\S'   \S   \S'   \S    \S'   \	S   \S	'   \	\
\\4      \S
'   \	\   \S'     SS\	\   S\S\	\S\S   4      4S jjr\S\4S j5       r\S\4S j5       r\S\4S j5       rS rS rSS jrS\
4S jrS\4S jrS r\S\	\
   S\	S    4S j5       rSrg)r   éM   z°
NodeSource is a data structure that contains the provenance information of a node.
If node `a` is created from node `b`, then `a.meta["from_node"]` may contain NodeSource(b).
c                   ó*   • \ rS rSrS\S\S\4S jrSrg)ÚNodeSource.NodeInfoéT   ÚnameÚtargetÚgraph_idc                 ó(   • Xl         X l        X0l        g ©N©r:   r;   r<   )Úselfr:   r;   r<   s       r%   Ú__init__ÚNodeSource.NodeInfo.__init__U   s   € ØŒIØ ŒKØ$�Mr'   )r<   r:   r;   N)r.   r/   r0   r1   ÚstrÚintrA   r4   r-   r'   r%   ÚNodeInfor8   T   s   † ð	% ð 	%¨cð 	%¸S÷ 	%r'   rE   Ú	pass_namer   ÚactionÚ	from_nodeÚ	node_infoÚ_dictÚ_action_stringNÚnodec                 ó
  • X l         Uc  / nO[        U[        5      (       d  U/nU H/  n[        U[        5      (       a  M  [	        S[        U5       35      e   X0l        U(       a�  U R                  UR                  [        UR                  5      [        UR                  5      S9U l        SUR                  ;   a#  [        R                   " UR                  S   5      O/ U l        OS U l        / U l        S U l        S U l        g )NzExpected NodeSourceAction, got r?   rH   )rF   Ú
isinstanceÚlistr   ÚAssertionErrorÚtyperG   rE   r:   rC   r;   ÚidÚgraphrI   ÚmetaÚcopyÚdeepcopyrH   rK   rJ   )r@   rL   rF   rG   Úas        r%   rA   ÚNodeSource.__init__a   sá   € ð #Œà‰>Ø‰FÜ˜F¤D×)Ñ)Ø�XˆFÛˆAÜ˜aÔ!1×2Ó2Ü$Ð'FÄtÈAÃwÀiÐ%PÓQÐQñ ð ŒÞØ!Ÿ]™]Ø—Y‘Y¤s¨4¯;©;Ó'7Ä"ÀTÇZÁZÃ.ð +ð ˆDŒNð
  $§)¡)Ó+ô —’˜dŸi™i¨Ñ4Ô5àð �Nð "ˆDŒNØˆDŒNð .2ˆÔØ/3ˆ�
r'   r#   c                 óT   • U R                   (       a  U R                   R                  $ S$ ©NÚ )rI   r:   ©r@   s    r%   r:   ÚNodeSource.name‚   s   € à&*§n§nˆt�~‰~×"Ñ"Ð<¸"Ð<r'   c                 óT   • U R                   (       a  U R                   R                  $ S$ rZ   )rI   r;   r\   s    r%   r;   ÚNodeSource.target†   s   € à(,¯¯ˆt�~‰~×$Ñ$Ð>¸BÐ>r'   c                 óT   • U R                   (       a  U R                   R                  $ S$ )Néÿÿÿÿ)rI   r<   r\   s    r%   r<   ÚNodeSource.graph_idŠ   s   € à*.¯.¯.ˆt�~‰~×&Ñ&Ð@¸bÐ@r'   c                 ó"   • U R                  5       $ r>   )Úprint_readabler\   s    r%   Ú__repr__ÚNodeSource.__repr__Ž   s   € Ø×"Ñ"Ó$Ð$r'   c                 óÎ   • U R                   cH  SR                  U R                   Vs/ s H  oR                  R	                  5       PM     sn5      U l         U R                   $ s  snf )NÚ+)rK   ÚjoinrG   r:   Úlower)r@   rW   s     r%   Ú_get_action_stringÚNodeSource._get_action_string‘   sL   € Ø×ÑÑ&Ø"%§(¡(ÀDÇKÂKÓ+PÂK¸q¯F©F¯L©L®NÁKÑ+PÓ"QˆDÔØ×"Ñ"Ð"ùò ,Qs   §#A"c                 óü   • US:”  a  gSnU R                  5       nUSU-  S-  SU R                   SU R                   SU SU R                   S	3	-   -  nU R                   H  nX$R                  US
-   5      -  nM     U$ )Né	   r[   Ú é   z(name=z, pass_name=z	, action=z, graph_id=z)
r
   )rk   r:   rF   r<   rH   rd   )r@   ÚindentÚresultÚaction_stringÚitems        r%   rd   ÚNodeSource.print_readable–   s˜   € Ø�A‹:ØØˆØ×/Ñ/Ó1ˆØØ�&‰L˜1ÑØ�t—y‘y�k ¨d¯n©nÐ-=¸YÀ}ÀoÐU`Ðae×anÑanÐ`oÐorÐsñtñ	
ˆð —N”NˆDØ×)Ñ)¨&°1©*Ó5Ñ5ŠFñ #àˆr'   c           
      óJ  • U R                   cn  U R                  5       nU R                  U R                  U R                  U R
                  UU R                   Vs/ s H  o"R                  5       PM     snS.U l         U R                   c  [        S5      eU R                   $ s  snf )N)r:   r;   r<   rF   rG   rH   z"_dict is None after initialization)	rJ   rk   r:   r;   r<   rF   rH   Úto_dictrP   )r@   rs   rL   s      r%   rw   ÚNodeSource.to_dict£   s„   € Ø�:‰:Ñà ×3Ñ3Ó5ˆMàŸ	™	ØŸ+™+Ø ŸM™MØ!Ÿ^™^Ø'Ø9=¿ºÓHº°Ÿl™lžn¹ÑHñˆDŒJð �:‰:ÑÜ Ð!EÓFÐFØ�z‰zÐùò Is   ÁB Úotherc                 óp   • [        U[        5      (       d  gU R                  5       UR                  5       :H  $ )NF)rN   r   rw   )r@   ry   s     r%   Ú__eq__ÚNodeSource.__eq__´   s)   € Ü˜%¤×,Ñ,ØØ�|‰|‹~ §¡£Ñ0Ð0r'   c                 óN   ^• U4S jm[        T" U R                  5       5      5      $ )Nc                 óÞ   >• [        U [        5      (       a,  [        [        U4S jU R	                  5        5       5      5      $ [        U [
        5      (       a  [        U4S jU  5       5      $ U $ )Nc              3   ó<   >#   • U  H  u  pUT" U5      4v •  M     g 7fr>   r-   )Ú.0ÚkÚvÚ_make_hashables      €r%   Ú	<genexpr>Ú>NodeSource.__hash__.<locals>._make_hashable.<locals>.<genexpr>¾   s   øé € Ð#SÂ{¹t¸q Q©°qÓ(9Õ$:Â{ùs   ƒc              3   ó4   >#   • U  H  nT" U5      v •  M     g 7fr>   r-   )r€   rt   rƒ   s     €r%   r„   r…   À   s   øé € ÐBºc°d™^¨D×1Ð1ºcùs   ƒ)rN   ÚdictÚtupleÚsortedÚitemsrO   )Úobjrƒ   s    €r%   rƒ   Ú+NodeSource.__hash__.<locals>._make_hashable¼   sO   ø€ Ü˜#œt×$Ñ$ÜœVÔ#SÀsÇyÁyÄ{Ó#SÓSÓTÐTÜ˜C¤×&Ñ&ÜÔB¹cÓBÓBÐBà�
r'   )Úhashrw   )r@   rƒ   s    @r%   Ú__hash__ÚNodeSource.__hash__¹   s    ø€ õ	ô ‘N 4§<¡<£>Ó2Ó3Ð3r'   Údc                 ó´  • Uc  g[        U[        5      (       d  [        S[        U5       35      e[        R                  [        5      nSUl        SUl        UR                  SS5      Ul	        UR                  SS5      n/ nU(       a‚  UR                  S5       Hm  nUR                  5       S:X  a!  UR                  [        R                  5        M8  UR                  5       S:X  d  MN  UR                  [        R                  5        Mo     XBl        S	U;   aZ  S
U;   aT  SU;   aN  [        R#                  UR                  S	S5      UR                  S
S5      UR                  SS5      5      nXbl        OSUl        UR                  SS5      b@  UR                  S/ 5       Vs/ s H  nU R'                  U5      =nc  M  UPM     snUl        U$ / Ul        U$ s  snf )zÖ
Recursively deserialize from_node metadata from dictionary data.
It is used to deserialize the from_node field from serialized metadata.
Please use constructor NodeSource(node, ...) to create a NodeSource object.
NzExpected a dict, got rF   r[   rG   rh   r2   r3   r:   r;   r<   ra   rH   )rN   r‡   rP   rQ   r   Ú__new__rK   rJ   ÚgetrF   ÚsplitÚupperÚappendr   r2   r3   rG   rE   rI   Ú
_from_dictrH   )	Úclsr�   Únode_sourceÚ
action_strÚactionsÚaction_namerI   Úfnrr   s	            r%   r—   ÚNodeSource._from_dictÆ   s³  € ð ‰9Øä˜!œT×"Ñ"Ü Ð#8¼¸a»¸	Ð!BÓCÐCô !×(Ñ(¬Ó4ˆð &*ˆÔ"Ø ˆÔð !"§¡ k°2Ó 6ˆÔð —U‘U˜8 RÓ(ˆ
ØˆÞØ)×/Ñ/°Ö4�Ø×$Ñ$Ó&¨(Ó2Ø—N‘NÔ#3×#:Ñ#:Ö;Ø ×&Ñ&Ó(¨IÕ5Ø—N‘NÔ#3×#;Ñ#;Ö<ñ	  5ð
 %Ôð �Q‹;˜8 q›=¨Z¸1«_Ü"×+Ñ+Ø—‘�f˜bÓ! 1§5¡5¨°2Ó#6¸¿¹¸jÈ"Ó8MóˆIð %.Õ!à$(ˆKÔ!ð �5‰5�˜dÓ#Ñ/ð Ÿ%™% ¨RÔ0ó%â0�BØ!Ÿn™n¨RÓ0Ð0�F÷ Ù0ñ%ˆKÔ!ð Ðð %'ˆKÔ!ØÐùò%s   Æ GÆ<G)rK   rJ   rG   rH   rI   rF   )r[   N)r   )r.   r/   r0   r1   Ú__doc__rE   rC   Ú__annotations__rO   r   r‡   r   r   r   rA   Úpropertyr:   r;   rD   r<   re   rk   rd   rw   Úobjectr{   rŽ   Úclassmethodr—   r4   r-   r'   r%   r   r   M   sF  ‡ ñ÷
%ñ %ð ƒNØÐ#Ñ$Ó$Ø�LÑ!Ó!Ø˜
Ñ#Ó#Ø�D˜˜c˜‘NÑ#Ó#Ø˜S‘MÓ!ð
 ØPTñ	4à�t‰nð4ð ð4ð ˜Ð1°4Ð8JÑ3KÐKÑLÑMõ	4ðB ð=�có =ó ð=ð ð?˜ó ?ó ð?ð ðA˜#ó Aó ðAò%ò#ô
ð˜ô ð"1˜Fô 1ò
4ð ð4˜8 D™>ð 4¨h°|Ñ.Dó 4ó ó4r'   r   c              #   óh   #   • [         n[        R                  5       n U q S v •  Uq Uqg ! Uq Uqf = f7fr>   )Úshould_preserve_node_metar   rU   )ÚenableÚsaved_should_preserve_node_metaÚsaved_current_metas      r%   r   r   þ   sE   é € ô
 '@Ð#ä%×*Ñ*Ó,Ðð*Ø$*Ð!Ûà$CÐ!Ø)‰øð %DÐ!Ø)‰üs   ‚2ž) ¤2©/¯2c              #   ó8   #   • [         n U q Sv •  Uq g! Uq f = f7f)za
Temporarily enables or disables the preservation of node.meta["seq_nr"] in the
tracing context.
N©Ú_should_preserve_node_meta)Úpreserve_seq_nrÚsaveds     r%   Ú_preserve_node_seq_nrr®     s&   é € ô '€Eð+Ø%4Ð"Ûà%*Ñ"ø UÑ"üó   ‚Š �“—Ústackc                 ó\   • [         (       a!  U (       a  SR                  U 5      [        S'   g g g )Nr[   Ústack_trace)r¥   ri   r   )r°   s    r%   r   r     s&   € ÷ !Ò ¦UØ&(§g¡g¨e£nŒ�]Ò#ð &+Ð r'   Úannotation_dictc              #   ó6  #   • S[         ;   n[        R                  " [         R                  S0 5      5      n U(       d	  0 [         S'   [         S   R                  U 5        Sv •  U(       a
  U[         S'   g[         S	 g! U(       a
  U[         S'   f [         S	 f = f7f)aŽ  
Temporarily adds custom annotations to the current tracing context.
The fx_node produced from this tracing context will have the
custom annotations in node.metadata["custom"] field.

This context manager allows you to insert arbitrary metadata into the PT2
tracing system by updating the global `current_meta["custom"]` dictionary.
The annotations are automatically reverted after the context exits.

Gradient accumulation nodes will not be annotated.

This is intended for advanced users who need to attach additional metadata to the fx nodes
(e.g., for debugging, analysis, or external tooling) during export tracing.

Note:
    This API is **not backward compatible** and may evolve in future releases.

Note:
    This API is not compatible with fx.symbolic_trace or jit.trace. It's intended
    to be used with PT2 family of tracers, e.g. torch.export and dynamo.

Args:
    annotation_dict (dict): A dictionary of custom key-value pairs to inject
        into the FX trace metadata.

Example:
    After exiting the context, custom annotations are removed.

    >>> with annotate({"source": "custom_pass", "tag": 42}):
    ...     pass  # Your computation here
ÚcustomN)r   rU   r“   Úupdate)r³   Ú
has_customÚ
old_customs      r%   r   r   &  s„   é € ðJ œ\Ñ)€JÜ—’œ<×+Ñ+¨H°bÓ9Ó:€Jð'ÞØ%'ŒL˜Ñ"ô 	�XÑ×%Ñ% oÔ6Ûæà%/ŒL˜Ò"ä˜XÑ&øö	 à%/ŒL˜Ò"ä˜XÑ&üs   ‚4B·,A< Á#BÁ<BÂBc                 ó$   ^ ^• SSK Jm  U U4S jnU$ )aæ  
A decorator that wraps a function with the annotate context manager.
Use this when you want to annotate an entire function instead of a specific code block.

Note:
    This API is **not backward compatible** and may evolve in future releases.

Note:
    This API is not compatible with fx.symbolic_trace or jit.trace. It's intended
    to be used with PT2 family of tracers, e.g. torch.export and dynamo.

Args:
    annotation_dict (dict): A dictionary of custom key-value pairs to inject
        into the FX trace metadata for all operations in the function.

Example:
    All operations in my_function will have {"pp_stage": 1} in their metadata.

    >>> @annotate_fn({"pp_stage": 1})
    ... def my_function(x):
    ...     return x + 1
r   )Úwrapsc                 ó.   >^ • T" T 5      UU 4S j5       nU$ )Nc                  ó`   >• [        T5         T" U 0 UD6sS S S 5        $ ! , (       d  f       g = fr>   )r   )ÚargsÚkwargsr³   Úfuncs     €€r%   ÚwrapperÚ/annotate_fn.<locals>.decorator.<locals>.wrapperx  s$   ø€ ä˜/Õ*Ù˜TÐ, VÑ,÷ +×*×*ús   �Ÿ
-r-   )r¿   rÀ   r³   rº   s   ` €€r%   Ú	decoratorÚannotate_fn.<locals>.decoratorw  s    ù€ Ù	ˆt‹õ	-ó 
ð	-ð ˆr'   )Ú	functoolsrº   )r³   rÂ   rº   s   ` @r%   r   r   ]  s   ù€ õ0  öð Ðr'   c                 óž   • [         (       aB  [        R                  S/ 5      U /-   [        S'   [        R                  SS5      S-   [        S'   g g )NÚgrad_fn_seq_nrÚ
in_grad_fnr   r
   )r¥   r   r“   )Úseq_nrs    r%   r   r   ‚  sT   € ÷ !Ò ä)5×)9Ñ)9Ð:JÈBÓ)OØðS
ñ *
ŒÐ%Ñ&ô &2×%5Ñ%5°lÀAÓ%FÈÑ%JŒ�\Ò"ð !r'   c                  óØ   • [         (       a_  [        R                  SS5      n U S::  a  [        SU  35      eU S:X  a  [        S	 [        S	 g U S-
  [        S'   [        S   S S [        S'   g g )NrÇ   r   z Expected current_level > 0, got r
   rÆ   ra   )r¥   r   r“   rP   )Úcurrent_levels    r%   r   r   Ž  s|   € ÷
 !Ò Ü$×(Ñ(¨°qÓ9ˆØ˜AÓÜ Ð#CÀMÀ?Ð!SÓTÐTØ˜AÓÜ˜\Ð*ÜÐ-Ñ.à)6¸Ñ):ŒL˜Ñ&Ü-9Ð:JÑ-KÈCÈRÐ-PŒLÐ)Ò*ð !r'   c                  óž   • [         (       a  [        R                  SS5      /$ [        R                  " [        R
                  " 5       S S 5      $ )Nr²   r[   ra   )r¥   r   r“   Ú	tracebackÚformat_listÚextract_stackr-   r'   r%   r   r   Ÿ  sA   € ç Ò Ü× Ñ  °Ó3Ð4Ð4ô ×$Ò$¤Y×%<Ò%<Ó%>¸sÀÐ%CÓDÐDr'   c                  ó   • [         $ r>   )r¥   r-   r'   r%   r   r   ¨  s   € ä$Ð$r'   c                  ó   • [         $ r>   rª   r-   r'   r%   Ú_is_preserving_node_seq_nrrÑ   ­  s   € Ü%Ð%r'   c              #   óî   #   • [         (       a[  U R                  (       aJ  [        n U R                  R                  5       q[	        X[
        R                  5      /[        S'   S v •  Uqg S v •  g ! Uqf = f7f)NrH   )r¥   rT   r   rU   r   r   r2   )rL   rF   Ú
saved_metas      r%   r   r   ±  sa   é € ÷ !Ò  T§Y§YÜ!ˆ
ð	&ØŸ9™9Ÿ>™>Ó+ˆLô ˜4Ô,<×,CÑ,CÓDð)ŒL˜Ñ%ó à%‰Läøð &‰Lüs   ‚#A5¦A A. Á&A5Á.A2Á2A5c                  ó   • [         $ r>   )r   r-   r'   r%   r   r   È  s   € äÐr'   c              #   ó8   #   • [         n U q Sv •  Uq g! Uq f = f7f)z’
Set the currently replay node. If `current_replay_node` is not None,
then we're re-generating the `current_replay_node` in FunctionalTensorMode.
N©r   )rL   Úsaved_current_replay_nodes     r%   r   r   Í  s(   é € ô !4Ðð8Ø"ÐÛà7ÑøÐ7Ñür¯   c                  ó   • [         $ )z
Get the currently replay node
rÖ   r-   r'   r%   r   r   Þ  s
   € ô
 Ðr'   rS   c           	      ó‚  •  0 nU R                    H`  nUR                  S:X  d  M  SUR                  ;   a-  UR                  S    Vs/ s H  o3R                  5       PM     snO/ XR                  '   Mb     U$ s  snf ! [
         a9  n[        SSS[        U5      [        R                  " 5       S.5        0 s SnA$ SnAff = f)zY
Given an fx.Graph, return a json that contains the provenance information of each node.
Úcall_functionrH   ÚinductorÚprovenance_tracking_errorr   )ÚfunctionÚ	error_msgr²   N)
ÚnodesÚoprT   rw   r:   Ú	Exceptionr	   rC   rÌ   Ú
format_exc)rS   Úprovenance_tracking_jsonrL   ÚsourceÚes        r%   r   r   æ  sº   € ð
Ø#%Ð Ø—K”KˆDØ�w‰w˜/Õ)ð # d§i¡iÓ/ð 59·I±I¸kÒ4JÓKÒ4J¨&—^‘^Ö%Ñ4JÒKàð )¯©Ó3ñ  ð (Ð'ùò	 Løô
 ó ô 	ØØ'à7Ü  ›VÜ(×3Ò3Ó5ñô	
ð �	ûðús4   ‚A; ¥!A; ÁA6ÁA; Á6A; Á;
B>Â.B9Â3B>Â9B>Úgmc                 ó´   ^• [        U [        5      (       d  [        S[        U 5       35      eS[        4U4S jjmSR	                  S T" U 5       5       5      $ )NzExpected GraphModule, got ræ   c           	      óà  >• / nU R                   R                   HÐ  n[        US5      (       aV  UR                  R	                  SS 5      (       a5  UR                  UR                  UR                  UR                  S   45        UR                  S:X  d  M|  [        [        XR                  5      [        5      (       d  M¦  UR                  T" [        XR                  5      5      5        MÒ     U$ )NrT   rµ   Úget_attr)rS   rß   ÚhasattrrT   r“   r–   rà   r:   rN   Úgetattrr;   r   )ræ   Úcustom_metadatarL   Úhelpers      €r%   rí   Ú$_get_custom_metadata.<locals>.helper  s­   ø€ ØˆØ—H‘H—N”NˆDÜ�t˜V×$Ñ$¨¯©¯©°xÀ×)FÑ)FØ×&Ñ&¨¯©°·±¸D¿I¹IÀhÑ<OÐ'PÔQØ�w‰w˜*Õ$¬Ü˜ŸK™KÓ(¬+÷*ó *ð  ×&Ñ&¡v¬g°b¿+¹+Ó.FÓ'GÖHñ #ð Ðr'   Ú
c              3   ó8   #   • U  H  n[        U5      v •  M     g 7fr>   )rC   )r€   Úxs     r%   r„   Ú'_get_custom_metadata.<locals>.<genexpr>  s   é € Ð0¢Z ”S˜—V�V¢Zùs   ‚)rN   r   rP   rQ   ri   )ræ   rí   s    @r%   Ú_get_custom_metadataró     sN   ø€ Ü�bœ+×&Ñ&ÜÐ9¼$¸r»(¸ÐDÓEÐEð	”;÷ 	ð �9‰9Ñ0¡V¨B¤ZÓ0Ó0Ð0r'   c                 ó´  • [        U [        5      (       a  U /nOU n[        [        5      nU Ho  nUR                  R
                   HR  nUR                  S:X  d  M  UR                  R                  S5      nUc  M5  X%   R                  UR                  5        MT     Mq     [        UR                  5       5       Vs/ s H  n[        X&   5      PM     sn$ s  snf )aÁ  
Group call_function nodes by seq_nr, order by seq_nr value,
and return a list of lists of node names (sorted alphabetically).

Args:
    gm: A single GraphModule or a list of GraphModules to process.
        When a list is provided, nodes from all graphs are grouped together.

Returns:
    A list of lists, where each inner list contains node names that share the same seq_nr,
    sorted alphabetically. The outer list is ordered by seq_nr value.
rÚ   rÈ   )rN   r   r   rO   rS   rß   rà   rT   r“   r–   r:   r‰   Úkeys)ræ   ÚgmsÚseq_nr_dictÚgraph_modulerL   rÈ   r�   s          r%   Ú_get_ordered_seq_nr_groupsrù     s±   € ô  �"”k×"Ñ"Øˆd‰àˆä(3´DÓ(9€KÛˆØ ×&Ñ&×,Ô,ˆDØ�w‰w˜/Õ)ØŸ™Ÿ™ xÓ0�ØÓ%ØÑ'×.Ñ.¨t¯y©yÖ9ó	 -ñ ô -3°;×3CÑ3CÓ3EÔ,FÓGÒ,F qŒF�;‘>Ö"Ñ,FÑGÐGùÒGs   Â;C)T)r[   ):rU   ÚloggingrÌ   Úcollectionsr   Ú
contextlibr   Úenumr   Útypingr   r   r   Útorch._utils_internalr	   Ú_compatibilityr   rS   r   rø   r   rL   r   Ú	getLoggerr.   ÚlogÚ__all__r   r‡   rC   r    r   r¥   r«   ÚGRADIENT_ACC_SPECIAL_STACKr    r&   r   r   r   r®   rO   r   r   r   r   r   r   Úboolr   rÑ   r   r   r   r   r   ró   rù   r-   r'   r%   Ú<module>r     s"  ðä Û Û Ý #Ý %Ý ß 'Ñ 'å 0å )Ý Ý %Ý ð ×Ò˜Ó!€ò€ð$  "€ˆd�3˜�8‰nÓ !Ø&*Ð �X˜d‘^Ó *à!Ð à"Ð ð Cð ð 46Ð �t˜C  c¨3 h¡Ð/Ñ0Ó 5ð2 sð 2°d¸3À¸8±nð 2Èô 2ñ  eÑ,ô�tó ó -ðñ
  eÑ,÷mð mó -ðmñ`  eÑ,Øó*ó ó -ð*ð ó+ó ð+ñ  eÑ,ð5˜4 ™9ó 5ó -ð5ñ  eÑ,Øð2'˜dó 2'ó ó -ð2'ñj  eÑ,ð! ó !ó -ð!ñH  eÑ,ñKó -ðKñ  eÑ,ñQó -ðQñ   eÑ,ðE�d˜3‘ió Eó -ðEñ  eÑ,ð% ó %ó -ð%ð& Dô &ñ  eÑ,Øóó ó -ðñ*  eÑ,ð˜$˜s C˜x™.ó ó -ðñ  eÑ,Øñ8ó ó -ð8ñ  eÑ,ñó -ðñ  eÑ,ð Uð ¨t°C¸°H©~ó ó -ðð:1˜[ð 1¨Sô 1ð$HØˆk˜4 Ñ,Ð,Ñ-ðHà	ˆ$ˆs‰)�_õHr'   