ó
    Eñi5i ã                   óÜ  • % S SK r S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SKrS SK	r	S SK
r
S SKrS SKrS SKrS SK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JrJrJrJr  S SKrS SKJs  J r!  S SK"J#r$J%r%  S SK&J'r'J(r(  S S	K)J*r*  S
SK+J r,  S
SK-J.r.  S
SK/J0r0  S
SK1J2r2J3r3J4r4J5r5J6r6  \Rn                  " \85      r9/ SQr:\(       a  S
SK;J<r<  S
SK=J>r>  \?\R€                  \A\R„                  \C\Rˆ                  \E\RŒ                  \G\R�                  0rI\AR•                  / SQ5      rK\\?\L   /\?\L   4   rM " S S\5      rN\Rž                   V s0 s H
  o \P" 5       _M     sn rQ\QR¥                  \ R¦                  5        0 rT\A\L\N4   \US'   S\LS\LS\4S jrV\V" SS\R®                  5        \V" SS\R°                  5        \V" SS\Y" S5      5        \V" S S!\5        \V" S"S#\R´                  5        \V" S$S%\,5        \V" S&S'\!5        S(\LS)\[4S* jr\S+\LS)\L4S, jr]\R¼                  " \R¾                  " S-5      RÀ                  S.5      ra\R¾                  " S/5      rb\R¾                  " S05      rc\R¾                  " S15      RÈ                  reS\S)\[4S2 jrf " S3 S45      rg\." S5S69\ " S7 S85      5       5       rhS9\LS:\LS)\L4S; jri " S< S=5      rj " S> S?5      rk " S@ SA\5      rl\" S5SB9 " SC SD5      5       rm SŒSE\LSF\\\L\L\L/\[4      4SG jjrn\." SHS69 " SI SJ5      5       ro " SK SL\o5      rp " SM SN\o5      rq " SO SP\q5      rr " SQ SR5      rs\." S5S69 " SS ST5      5       rt\SU\SV/\L4   S)\S   4SW j5       ruSX rvSY rwSZS[S\S]S^S_S`SaSb.rx\xRó                  5        V Vs0 s H  u  pU \w" U5      _M     snn rz\R¾                  " Sc5      r{SdSeSfSgShShSiSjSkSlSmSnSoSpSqSr.r|SsStSuSvSwSxSySzS{S|.	\|Er}S}S~SS€S�S‚SƒS„S…S†S‡SˆS‰SŠS‹.r~gs  sn f s  snn f )�é    N)Údefaultdict)ÚCallableÚIterableÚIterator)Úcontextmanager)Ú	dataclass)ÚAnyÚLiteralÚ
NamedTupleÚOptionalÚTYPE_CHECKING)Ú_fx_map_argÚ	_NodeIter)Úget_opaque_obj_reprÚis_opaque_value_type)Údtype_abbrsé   )Ú_pytree)Úcompatibility)Úimmutable_dict)Ú_get_qualified_nameÚ
_type_reprÚArgumentÚNodeÚTarget)Ú
PythonCodeÚCodeGenÚGraph)ÚTracer)ÚGraphModule)Úcall_functionÚcall_methodÚget_attrÚcall_moduleÚplaceholderÚoutputc                   ó.   • \ rS rSr% Sr\\S'   \\S'   Srg)Ú_CustomBuiltiné@   zâAdditional objs that we add to every graph's globals.

The repr() for some standard library objects is not valid Python code without
an import. For common objects of this sort, we bundle them in the globals of
every FX graph.
Ú
import_strÚobj© N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚstrÚ__annotations__r	   Ú__static_attributes__r,   ó    ÚK/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/fx/graph.pyr(   r(   @   s   ‡ ñð ƒOà	†Hr5   r(   Ú_custom_builtinsÚnamer*   r+   c                 ó:   • [        X5      [        U '   U[        U '   g ©N)r(   r7   Ú_illegal_names)r8   r*   r+   s      r6   Ú_register_custom_builtinr<   U   s   € Ü+¨JÓ<Ô�TÑØ„N�4Òr5   Úinfzfrom math import infÚnanzfrom math import nanÚNoneTypezNoneType = type(None)Útorchzimport torchÚdevicezfrom torch import deviceÚ	fx_pytreez$import torch.fx._pytree as fx_pytreeÚpytreez$import torch.utils._pytree as pytreeÚxÚreturnc                 óT   • U R                  S5      =(       a    U R                  S5      $ )NÚ__)Ú
startswithÚendswith©rD   s    r6   Ú	_is_magicrK   c   s   € Ø�<‰<˜Ó×2 !§*¡*¨TÓ"2Ð2r5   Úsc                 ó4   • [        U 5      R                  5       $ )zÑ
Transforms the given string ``s`` to a Python-style variable name

Examples:
    ``mod.snake_case`` -> ``mod.snake_case``
    ``mod.pascalCase``-> ``mod.pascal_case``
    ``mod.ALL_CAPS`` -> ``mod.all_caps``
)Ú_snake_case_subÚlower)rL   s    r6   Ú_snake_caserP   g   s   € ô ˜1Ó×#Ñ#Ó%Ð%r5   z(?<=[a-z])([A-Z])z_\1z[^0-9a-zA-Z_]+z&^([a-zA-Z_][0-9a-zA-Z_]*?)(?:_(\d+))?$z,^torch(?:\.(?!_dynamo\.|_inductor\.)[^.]+)*$c                 óÚ   • [        U SS 5      nUb  [        U5      S L$ [        U SS 5      nUb>  US:w  a8  [        [        R                  R                  4 H  n[        X2S 5      U L d  M    g   g)Nr.   r-   r@   TF)ÚgetattrÚ_torch_but_not_dynamor@   ÚnnÚ
functional)r+   Úmodule_namer8   Úguesss       r6   Ú_is_from_torchrX   †   sp   € Ü˜#˜|¨TÓ2€KØÑÜ$ [Ó1¸Ð=Ð=ä�3˜
 DÓ)€DàÑ˜D G›OÜœUŸX™X×0Ñ0Ó1ˆEÜ�u DÓ)¨SÔ0Ùñ 2ð r5   c                   ó^   • \ rS rSrSrS rS\S\\   S\4S jr	S\S\4S	 jr
S\S\4S
 jrSrg)Ú
_Namespaceé•   a  A context for associating names uniquely with objects.

The following invariants are enforced:
- Each object gets a single name.
- Each name is unique within a given namespace.
- Names generated do not shadow builtins, unless the object is indeed that builtin.
c                 ó>   • 0 U l         [        5       U l        0 U l        g r:   )Ú_obj_to_nameÚsetÚ_used_namesÚ_base_count©Úselfs    r6   Ú__init__Ú_Namespace.__init__ž   s   € Ø,.ˆÔÜ%(£UˆÔØ+-ˆÕr5   Ú	candidater+   rE   c                 óì  • Ub  X R                   ;   a  U R                   U   $ [        R                  U5      nUcb  [        R	                  SU5      nU(       d  SnUS   R                  5       (       a  SU 3n[        R                  U5      nUc  [        SU 35      eUR                  SS5      u  pEUb  XR                  ;   aA  U R                  R                  US5      n[        R                  X5      ULa  US-  nU SU 3nO[        U5      nXR                  ;   a  US-  nU SU 3nXR                  ;   a  M  U R                  R                  U5        XPR                  U'   Ub  XR                   U'   U$ )z¼Create a unique name.

Arguments:
    candidate: used as the basis for the unique name, relevant to the user.
    obj: If not None, an object that will be associated with the unique name.
Ú_Ú_unnamedr   z&Name regex failed to match candidate: r   é   )r]   Ú_name_regexÚmatchÚ_illegal_char_regexÚsubÚisdigitÚAssertionErrorÚgroupr_   r`   Úgetr;   ÚintÚadd)rb   re   r+   rk   ÚbaseÚnums         r6   Úcreate_nameÚ_Namespace.create_name£   s‚  € ð ‰?˜s×&7Ñ&7Ó7Ø×$Ñ$ SÑ)Ð)ô ×!Ñ! )Ó,ˆØ‰=ä+×/Ñ/°°YÓ?ˆIæØ&�	à˜‰|×#Ñ#×%Ñ%Ø 	˜{˜O�	ä×%Ñ% iÓ0ˆEØ‰}Ü$Ø<¸Y¸KÐHóð ð —K‘K  1Ó%‰	ˆØ‰;˜)×'7Ñ'7Ó7Ø×"Ñ"×&Ñ& y°!Ó4ˆCÜ×!Ñ! )Ó1¸Ò<Ø�q‘�Ø#˜f A c U˜O�	øô �c“(ˆCà×+Ñ+Ó+Ø�1‰HˆCØ˜&  # ˜ˆIð ×+Ñ+Õ+ð 	×Ñ×Ñ˜YÔ'Ø!$×Ñ˜ÑØ‰?Ø%.×Ñ˜cÑ"ØÐr5   r8   c                 óX   • U R                   R                  X!5      nX1La  [        S5      eg)z`Associate a unique name with an object.

Neither `name` nor `obj` should be associated already.
zobj is already associatedN)r]   Ú
setdefaultro   )rb   r8   r+   Úmaybe_existings       r6   Úassociate_name_with_objÚ"_Namespace.associate_name_with_objÓ   s1   € ð
 ×*Ñ*×5Ñ5°cÓ@ˆØÒ%Ü Ð!<Ó=Ð=ð &r5   c                 ó’   • XR                   ;  a  [        SU S35      eX R                   U'   U R                  R                  U5        g )NzObject z is not in _obj_to_name)r]   ro   r_   rs   )rb   r+   r8   s      r6   Ú_rename_objectÚ_Namespace._rename_objectÜ   sE   € Ø×'Ñ'Ó'Ü  7¨3¨%Ð/FÐ!GÓHÐHØ!%×Ñ˜#ÑØ×Ñ×Ñ˜TÕ"r5   )r`   r]   r_   N)r-   r.   r/   r0   r1   rc   r2   r   r	   rv   r{   r~   r4   r,   r5   r6   rZ   rZ   •   sQ   † ñò.ð
. Sð .¨x¸©}ð .Àô .ð`>¨Cð >°cô >ð# #ð #¨S÷ #r5   rZ   T©Úis_backward_compatiblec                   óf   • \ rS rSr% Sr\\S'   \\\4   \S'   \	\\
\	\
   4      \S'   Sr\
\S'   Srg	)
r   éã   zR
Represents all the information necessary to exec or save a graph as Python code.
ÚsrcÚglobalsÚ_lineno_mapr   Ú_prologue_startr,   N)r-   r.   r/   r0   r1   r2   r3   Údictr	   r   rr   r‡   r4   r,   r5   r6   r   r   ã   sA   ‡ ñð
 
ƒHà�#�s�(‰^Óð ˜$˜s H¨S¡MÐ1Ñ2Ñ3Ó3à€O�SÖr5   r   rt   Útargetc                 óŒ   • UR                  S5      nU nU H*  nUR                  5       (       d  SU SU S3nM#  U SU 3nM,     U$ )NÚ.zgetattr(z, "ú"))ÚsplitÚisidentifier)rt   r‰   ÚelemsÚrÚes        r6   Ú_format_targetr’   õ   sV   € Ø�L‰L˜Ó€EØ€AÛˆØ�~‰~×ÑØ˜1˜#˜S   2Ð&ŠAà�#�Q�q�c�
ŠAñ	 ð
 €Hr5   c                   ó&   • \ rS rSrS rS rS rSrg)Ú_InsertPointé   c                 óB   • Xl         UR                  UsU l        Ul        g r:   )ÚgraphÚ_insertÚorig_insert)rb   r—   Ú
new_inserts      r6   rc   Ú_InsertPoint.__init__  s   € ØŒ
Ø*/¯-©-¸Ð'ˆÔ˜%�-r5   c                 ó   • g r:   r,   ra   s    r6   Ú	__enter__Ú_InsertPoint.__enter__  s   € Ør5   c                 ó:   • U R                   U R                  l        g r:   )r™   r—   r˜   )rb   ÚtypeÚvalueÚtbs       r6   Ú__exit__Ú_InsertPoint.__exit__  s   € Ø!×-Ñ-ˆ�
‰
Õr5   )r—   r™   N)r-   r.   r/   r0   rc   r�   r£   r4   r,   r5   r6   r”   r”      s   † òDòõ.r5   r”   c                   óB   • \ rS rSrSSSS\S   4S jjrS rS rS	 rS
r	g)Ú
_node_listi  r—   r   Ú	direction)Ú_prevÚ_nextc                 óD   • US;  a  [        SU 35      eXl        X l        g )N)r©   r¨   z*direction must be '_next' or '_prev', got )ro   r—   r§   )rb   r—   r§   s      r6   rc   Ú_node_list.__init__  s.   € ØÐ.Ó.Ü Ø<¸Y¸KÐHóð ð Œ
Ø"�r5   c                 ó.   • U R                   R                  $ r:   )r—   Ú_lenra   s    r6   Ú__len__Ú_node_list.__len__  s   € Ø�z‰z�‰Ðr5   c                 ó\   • [        U R                  R                  U R                  S:H  5      $ )Nr¨   )r   r—   Ú_rootr§   ra   s    r6   Ú__iter__Ú_node_list.__iter__  s"   € Ü˜Ÿ™×)Ñ)¨4¯>©>¸WÑ+DÓEÐEr5   c                 óZ   • [        U R                  U R                  S:X  a  S5      $ S5      $ )Nr¨   r©   )r¦   r—   r§   ra   s    r6   Ú__reversed__Ú_node_list.__reversed__  s'   € Ü˜$Ÿ*™*°·±À7Ó1J gÓXÐXÐPWÓXÐXr5   )r§   r—   N)r©   )
r-   r.   r/   r0   r
   rc   r®   r²   rµ   r4   r,   r5   r6   r¦   r¦     s,   † ñ#˜gð #°'Ð:JÑ2Kõ #òòFõYr5   r¦   c                   ól   • \ rS rSr% Sr\\   \S'   \R                  \S'   \
\R                     \S'   Srg)Ú_PyTreeInfoi  z5
Contains extra info stored when we're using Pytrees
Ú	orig_argsÚin_specÚout_specr,   N)r-   r.   r/   r0   r1   Úlistr2   r3   rC   ÚTreeSpecr   r4   r,   r5   r6   r¸   r¸     s,   ‡ ñð �C‰yÓØ�_‰_ÓØ�v—‘Ñ'Ö'r5   r¸   )Úfrozenc                   óH   • \ rS rSr% Sr\\S'   \\S'   \\S'   \\S'   S rSrg	)
Ú_ParsedStackTracei)  z7
Represents the top-most frame of a parsed stack trace
ÚfileÚlinenor8   Úcodec                 ón   • SU R                    SU R                   SU R                   SU R                   3$ )NzFile: Ú:z in z, code: )rÁ   rÂ   r8   rÃ   ra   s    r6   Úget_summary_strÚ!_ParsedStackTrace.get_summary_str4  s1   € Ø˜Ÿ	™	�{ ! D§K¡K =°°T·Y±Y°K¸xÈÏ	É	À{ÐSÐSr5   r,   N)	r-   r.   r/   r0   r1   r2   r3   rÆ   r4   r,   r5   r6   rÀ   rÀ   )  s#   ‡ ñð ƒIØƒKØ
ƒIØ
ƒIõTr5   rÀ   Ústack_traceÚ	filter_fnc                 óä  • U c  g [         R                  " S5      nU R                  5       R                  S5      n[	        [        U5      S-
  SS5       Hš  nX4   R                  5       nUR                  U5      nU(       d  M/  UR                  S5      nUR                  S5      nUR                  S5      n	X4S-      R                  5       n
U(       a  U" XyU
5      (       d  MŽ  [        XxXš5      s  $    g )Nz$^File \"(.+)\", line (\d+), in (.+)$Ú
ri   éÿÿÿÿr   é   )	ÚreÚcompileÚstripr�   ÚrangeÚlenrk   rp   rÀ   )rÈ   rÉ   ÚpatternÚlinesÚidxÚlineÚmatchesrÁ   rÂ   r8   rÃ   s              r6   Ú_parse_stack_tracerØ   9  s×   € ð ÑØÜ�jŠjÐ@ÓA€GØ×ÑÓ×%Ñ% dÓ+€Eô ”S˜“Z !‘^ R¨Ö,ˆØ‰z×ÑÓ!ˆØ—-‘- Ó%ˆßˆ7Ø—=‘= Ó#ˆDØ—]‘] 1Ó%ˆFØ—=‘= Ó#ˆDà˜q™‘>×'Ñ'Ó)ˆDÞ¡¨4°t×!<Ñ!<ÙÜ$ T°4Ó>Ò>ñ -ð r5   Fc                   óx  • \ rS rSr% S r\S/\4   \S'   S rS\	\   S\4S jr
S	\S\4S
 jrS\\\4   4S jrS)S\4S jjrS rS rSS.S\	\   S\S\S\4S jjrSS.S\S\\   S\4S jjrS\S\4S jrS\S\4S jrS\	\\\4      4S jrSSSSSSSS.S\S \S!\S"\S#\S$\S\S%\S&\\	\      S\4S' jjrS(rg)*r   iR  c                 ó   • [        U 5      $ r:   )ÚreprrJ   s    r6   Ú<lambda>ÚCodeGen.<lambda>U  s   € ÄDÈÄGr5   útorch.types.PySymTypeÚ	_sym_reprc                 ó    • S U l         SU l        g )NÚforward©Ú_body_transformerÚ
_func_namera   s    r6   rc   ÚCodeGen.__init__W  s   € Ø>BˆÔØ(ˆ�r5   ÚargsrE   c                 ó:   ^ • SR                  U 4S jU 5       5      $ )zAHelper to format function arguments in expanded multiline format.Ú c              3   óF   >#   • U  H  nTR                  U5      v •  M     g 7fr:   )Ú_format_single_arg)Ú.0Úargrb   s     €r6   Ú	<genexpr>Ú1CodeGen._format_multiline_args.<locals>.<genexpr>]  s   øé € ÐDºt¸�t×.Ñ.¨s×3Ð3ºtùs   ƒ!©Újoin©rb   ræ   s   ` r6   Ú_format_multiline_argsÚCodeGen._format_multiline_args[  s   ø€ à�w‰wÔD¹tÓDÓDÐDr5   rì   c                 óŒ   • SU;   a9  UR                  SS5      u  p#SUR                  5        SUR                  5        S3$ SU S3$ )z9Helper to format a single argument with optional comment.Ú#r   ú    z,  # rË   z,
)r�   ÚrstripÚlstrip)rb   rì   Úarg_partÚcomment_parts       r6   rê   ÚCodeGen._format_single_arg_  sQ   € à�#‹:Ø%(§Y¡Y¨s°AÓ%6Ñ"ˆHØ˜(Ÿ/™/Ó+Ð,¨E°,×2EÑ2EÓ2GÐ1HÈÐKÐKà˜#˜˜c�?Ð"r5   c                 ó4   • [        U[        5      (       a  S$ S$ )z<Helper to get opening and closing delimiters for containers.)Ú(Ú))Ú[Ú])Ú
isinstanceÚtuple)rb   Ú	containers     r6   Ú_get_delimitersÚCodeGen._get_delimitersg  s   € ä'¨	´5×9Ñ9ˆzÐI¸zÐIr5   Nc                 ó¤   • U R                  U5      u  pEU R                  X5      nU U S3SR                  S [        X5       5       5      -   U -   $ )z?Helper to format containers (lists/tuples) in multiline format.rË   rè   c              3   ó8   #   • U  H  u  pS U SU S3v •  M     g7f)rö   Ú,rË   Nr,   )rë   ÚitemÚtrailers      r6   rí   Ú6CodeGen._format_multiline_container.<locals>.<genexpr>r  s%   é € ð Ú?X©m¨d�$�t�f˜A˜g˜Y bÕ)Ò?Xùó   ‚)r  Ú_get_desc_trailersrð   Úzip)rb   ÚitemsÚdescsÚprefixÚldelimÚrdelimÚdesc_trailerss          r6   Ú_format_multiline_containerÚ#CodeGen._format_multiline_containerk  sh   € à×-Ñ-¨eÓ4‰ˆØ×/Ñ/°Ó=ˆð ˆh�v�h˜bÐ!Ø�g‰gñ Ü?BÀ5Ô?Xóó ñð �ñ	ð	
r5   c                 ó\   • Uc  S/[        U5      -  $ U Vs/ s H  nSU 3PM
     sn$ s  snf )z2Helper to generate description trailers for items.rè   ú  # )rÒ   )rb   r  r  Údescs       r6   r  ÚCodeGen._get_desc_trailersx  s6   € à‰=Ø�4œ#˜e›*Ñ$Ð$Ù*/Ó0ª% $�$�t�f“©%Ñ0Ð0ùÒ0s   —)c                 ó´   • [         R                  " U5      nUR                  5        VVs0 s H  u  pVXTR                  ;   d  M  XV_M     nnnU" U0 UD6$ s  snnf )zDHelper to call a method with optional parameters based on signature.)ÚinspectÚ	signaturer  Ú
parameters)rb   Úmethodræ   ÚkwargsÚsigÚkÚvÚfiltered_kwargss           r6   Ú!_call_method_with_signature_checkÚ)CodeGen._call_method_with_signature_check~  sQ   € ä×Ò Ó'ˆà,2¯L©L¬NÔRªN¡D A¸aÇ>Á>Ñ>Q›4˜1š4©NˆÑRÙ�tÐ/˜Ñ/Ð/ùó Ss   ªAÁAF©Úexpanded_defÚ	free_varsÚmaybe_return_annotationr(  c                óü   • [        U5      S:X  d	  US   S:w  a  UR                  SS5        U(       a'  U R                  U5      nSU R                   SU SU S3$ SU R                   SSR	                  U5       SU S3$ )	zª
Given the free variables and a return annotation, generates the beginning of the FX function.
By default, `gen_fn_def(['a', 'b'], '') == 'def {self._func_name}(a, b):'`
r   rb   údef z(
rþ   rÅ   rý   ú, )rÒ   Úinsertrò   rä   rð   )rb   r)  r*  r(  Úargs_formatteds        r6   Ú
gen_fn_defÚCodeGen.gen_fn_def…  s“   € ô ˆy‹>˜QÓ )¨A¡,°&Ó"8Ø×Ñ˜Q Ô'æØ!×8Ñ8¸ÓCˆNà�t—‘Ð' s¨>Ð*:¸!Ð<SÐ;TÐTUÐVðð ˜$Ÿ/™/Ð*¨!¨D¯I©I°iÓ,@Ð+AÀÐCZÐB[Ð[\Ð]Ð]r5   ©r  Úoutput_argsr  c                ó~   • Ub-  [        U[        [        45      (       a  U R                  XS5      $ S[	        U5       3$ )z…
Given the output arguments, generates the return statement of the FX function.
Note: The returned statement should not be indented.
zreturn )r  r¼   r  r  rÛ   )rb   r3  r  s      r6   Úgenerate_outputÚCodeGen.generate_output�  s@   € ð Ñ¤¨K¼$Ä¸×!GÑ!GØ×3Ñ3°KÈ	ÓRÐRàœT +Ó.Ð/Ð0Ð0r5   c                 ó   • U$ )aK  
Transforms the inputs so that the graph can take them as arguments, as
non-default codegen may result in the inputs to the function being
different from the inputs to the graph.

If the graph was directly runnable, this invariant should hold true
`f.graph.process_outputs(f.graph(*f.graph.process_inputs(*inputs))) == f(*inputs)`
r,   rñ   s     r6   Úprocess_inputsÚCodeGen.process_inputs©  s	   € ð ˆr5   Úoutputsc                 ó   • U$ )zo
Transforms the outputs of the graph to be identical to the codegen.

See ``process_inputs`` for more details.
r,   )rb   r:  s     r6   Úprocess_outputsÚCodeGen.process_outputs´  s	   € ð ˆr5   c                 ó   • / $ )z¹
If your codegen uses extra global values, add tuples of (identifier,reference to the value) here.
For example, return ['List', typing.List] if you need ``List`` in the global context.
r,   ra   s    r6   Úadditional_globalsÚCodeGen.additional_globals¼  s	   € ð
 ˆ	r5   ©ÚverboseÚinclude_strideÚinclude_deviceÚcoloredr(  Úrecord_funcÚadditional_metaÚroot_moduleÚ	namespacerB  rC  rD  rE  rF  rG  c                óþ	  ^ ^^^^^^^
^#^$^%^&^'^(^)^*^+^,^-^.^/^0^1^2^3^4^5• / m+/ m'0 m,0 m5S/m.T=(       d#    [         R                  R                  SS5      S:H  mT=(       d#    [         R                  R                  SS5      S:H  m[         R                  R                  SS5      S:H  m-S[        S[        4U,U4S	 jjm%[
        R                  5        H  u  nu  pÍT%" X½5        M     S
[        4U%U34S jjm3U(       a.  [        S   m1[        S   m*[        S   m([        S   m)[        S   m&O[        m1[        m*[        m([        m)[        m&S[        S[        4U$U%U&4S jjm$S[        [        S4   S[        [        [        4   S[        4U$4S jjm#0 m/0 m4S[        S[        4U/U44S jjn[        U5       H  nUR                   H  nU" UU5        M     M!     S[        4U'U(U44S jjnS m0S[        4U
U'U(U04S jjnS[        S[        4S jm2S[        4U#U$U%U&U'U)U*UU+UU-UU.U1UU U2U3UU54S  jjnU	(       a  T'R!                  S!5        [#        U5       H°  u  nnT(       a  U" U5        T'R!                  S"U S#35        U	=(       a    UR$                  S$;   nU(       a/  T'R!                  S%UR&                   S&U S'UR&                   S(35        U" U5        U" U5        U(       d  M‘  T'R!                  S%UR&                   S)35        M²     U	(       a  T'R!                  S*5        [)        T'5      S+:X  a  T'R!                  S,5        [)        T55      S+:”  aJ  T%" S-[*        R,                  R.                  5      nS#R1                  T5 Vs/ s H  nU S.U S/3PM     sn5      nOSnT R2                  (       a  T R3                  T'5      m'T R5                  5        H  u  nnT%" UU5        M     T R7                  T R8                  T+T.S+   TS09n0 nUR;                  S#5      S1-   n/ nS nSR1                  T'5      R=                  S#5       HY  n[>        RA                  U5      nUb  [C        URE                  S15      5      nM7  UU[)        U5      U-   '   UR!                  U5        M[     S#R1                  U5      RG                  S#5      n S#R1                  S2 U R=                  S#5       5       5      n S#U S3U S#U  3n!UR;                  S#5      S4-   n"[I        U!T,UU"S59$ s  snf )6Nrè   ÚFX_GRAPH_SHOW_STRIDEÚ0Ú1ÚFX_GRAPH_SHOW_DEVICEÚFX_GRAPH_SHOW_METAÚ	name_hintr+   c                 óÒ   >• [        U5      (       a  U[        R                  :w  a  [        U5      $ TR	                  X5      nUT;   a  TU   U:w  a  [        SU S35      eU$ UTU'   U$ )zÛAdd an obj to be tracked as a global.

We call this for names that reference objects external to the
Graph, like functions or types.

Returns: the global name that should be used to reference 'obj' in generated source.
zGlobal name z% already assigned to different object)rX   r@   rA   r   rv   ro   )rP  r+   Úglobal_nameÚglobals_rI  s      €€r6   Ú
add_globalÚ,CodeGen._gen_python_code.<locals>.add_globalá  s�   ø€ ô ˜s×#Ñ#¨¬u¯|©|Ó(;ô
 +¨3Ó/Ð/ð $×/Ñ/°	Ó?ˆKà˜hÓ&Ø˜KÑ(¨CÓ/Ü(Ø& { mÐ3XÐYóð ð #Ð"Ø$'ˆH�[Ñ!ØÐr5   Úoc                 ój  >• U S:X  a  g[        U 5      n[        U [        R                  5      (       a9  SU;   a3  U R                   Vs/ s H  nT" U5      PM     nnSR                  U5      $ [        U SS 5      =n(       a£  [        U [        R                  5      (       a  [        R                  XD5      nT" [        U5      U5      n[        U S5      (       aJ  U R                  (       a9  U R                   Vs/ s H  nT" U5      PM     nnU SSR                  U5       S3$ U$ T" X5      $ s  snf s  snf )	Nr,   z()Ú|Ú
__origin__Ú__args__rÿ   r  r   )r   r  ÚtypesÚ	UnionTyperZ  rð   rR   ÚtypingÚ_GenericAliasÚ_origin_type_maprq   Úhasattr)rV  Útypenamerì   ræ   Úorigin_typeÚorigin_typenamerT  Ú	type_reprs         €€r6   rd  Ú+CodeGen._gen_python_code.<locals>.type_repr  s  ø€ Ø�B‹wàä! !“}ˆHÜ˜!œUŸ_™_×-Ñ-°#¸³/à23·*²*Ó=²*¨3™	 #ž±*�Ð=Ø—x‘x “~Ð%ä% a¨°tÓ<Ð<ˆ{Õ<ô ˜a¤×!5Ñ!5×6Ñ6ä"2×"6Ñ"6°{Ó"P�Ká",¬Z¸Ó-DÀkÓ"R�ä˜1˜j×)Ñ)¨a¯j¯jØ67·j²jÓA²j¨s™I cžN±j�DÐAØ-Ð.¨a°·±¸³Ð/?¸qÐAÐAà*Ð*ñ ˜hÓ*Ð*ùò' >ùò Bs   ÁD+Ã6D0ÚredÚ	dim_greenÚdimÚdim_blueÚbluerì   rE   c                 ó–  >• [        U [        5      (       a  [        U 5      $ [        U [        5      (       aO  [	        U S5      (       a>  [        [        U 5      5      nT" U[        U 5      5      nU [        [        U 5      5       3$ [        U [        R                  R                  [        R                  R                  45      (       a  [        U 5      nT" X5      nU $ [        U [        R                  5      (       a0  U R                  nT" UR                  U5      nU SU R                   3$ [        U [        R                   5      (       aI  [#        U R%                  5       5      n['        U R(                  5      R+                  S5      S   nSU SU S3$ [        U [        5      (       a?  [-        U 5      S:X  a  ST" U S	   5       S
3$ SSR/                  U4S jU  5       5      -   S-   $ [        U ["        5      (       a!  SSR/                  U4S jU  5       5      -   S-   $ [        U [0        5      (       a<  ST" U R2                  5       ST" U R4                  5       ST" U R6                  5       S3$ [9        [        U 5      5      (       a0  [;        U 5      u  pxUR=                  5        H  u  pšT" Xš5        M     U$ T" [        U 5      5      $ )NÚ_fieldsr‹   rÌ   ztorch.Tensor(size=z, dtype=rþ   r   rý   r   z,)r-  c              3   ó4   >#   • U  H  nT" U5      v •  M     g 7fr:   r,   ©rë   ÚaÚ	_get_reprs     €r6   rí   Ú>CodeGen._gen_python_code.<locals>._get_repr.<locals>.<genexpr>E  s   øé € Ð*EÂ¸A©9°Q¯<¨<Âùó   ƒrÿ   c              3   ó4   >#   • U  H  nT" U5      v •  M     g 7fr:   r,   rn  s     €r6   rí   rq  G  s   øé € Ð&AºS¸¡y°§| |ºSùrr  r   zslice()r  r   rÛ   r  r`  r   r    r@   Ú_opsÚ
OpOverloadÚHigherOrderOperatorÚenumÚEnumÚ	__class__r-   r8   ÚTensorr¼   Úsizer2   Údtyper�   rÒ   rð   ÚsliceÚstartÚstopÚstepr   r   r  )rì   Úqualified_namerR  ÚclsÚclsnamer{  r|  Úobj_reprÚopaque_typesÚnÚtrp  rT  rj  s              €€€r6   rp  Ú+CodeGen._gen_python_code.<locals>._get_repr+  sW  ø€ Ü˜#œt×$Ñ$Ü˜C“yÐ Ü˜C¤×'Ñ'¬G°C¸×,CÑ,Cä!4´T¸#³YÓ!?�Ù(¨¼¸c»ÓC�Ø%˜¤t¬E°#«JÓ'7Ð&8Ð9Ð9ÜØ”e—j‘j×+Ñ+¬U¯Z©Z×-KÑ-KÐL÷ñ ô "5°SÓ!9�Ù(¨Ó=�Ø%˜Ð'Ü˜C¤§¡×+Ñ+Ø—m‘m�Ù$ S§\¡\°3Ó7�Ø!˜ ! C§H¡H :Ð.Ð.Ü˜C¤§¡×.Ñ.Ü˜CŸH™H›JÓ'�Ü˜CŸI™I›×,Ñ,¨SÓ1°"Ñ5�Ø+¨D¨6°¸%¸ÀÐBÐBÜ˜C¤×'Ñ'Ü�s“8˜q“=Ø™y¨¨Q©Ó0Ð1°Ð4Ð4à §¡Ô*EÁÓ*EÓ!EÑEÈÑKÐKÜ˜C¤×&Ñ&Ø˜TŸY™YÔ&A¹SÓ&AÓAÑAÀCÑGÐGÜ˜C¤×'Ñ'Ø¡	¨#¯)©)Ó 4Ð5°R¹	À#Ç(Á(Ó8KÐ7LÈBÉyÐY\×YaÑYaÓObÐNcÐcdÐeÐeÜ%¤d¨3£i×0Ñ0Ü)<¸SÓ)AÑ&�Ø(×.Ñ.Ö0‘D�AÙ˜qÖ$ñ 1à�áœD ›I“Ð&r5   ræ   .r   c                 óê   >• U  Vs/ s H  nT" U5      PM     nnUR                  UR                  5        VVs/ s H  u  pEU ST" U5       3PM     snn5        SR                  U5      $ s  snf s  snnf )Nú = r-  )Úextendr  rð   )ræ   r   ro  Úresr"  r#  rp  s         €r6   Ú_format_argsÚ.CodeGen._gen_python_code.<locals>._format_argsR  se   ø€ ñ *.Ó.ª A‘9˜Q–<©ˆCÐ.Ø�J‰J¸F¿L¹L¼NÔKºN±D°A˜1˜#˜S¡¨1£ Ó/¹NÒKÔLØ—9‘9˜S“>Ð!ùò /ùÛKs
   †A*¸A/
r†  Úuserc                 ó`   >• U T;  a'  UTU '   TR                  U/ 5      R                  U 5        g g r:   )ry   Úappend)r†  r�  Únode_to_last_useÚuser_to_last_usess     €€r6   Úregister_last_usesÚ4CodeGen._gen_python_code.<locals>.register_last_uses`  s7   ø€ ØÐ(Ó(Ø&*Ð  Ñ#Ø!×,Ñ,¨T°2Ó6×=Ñ=¸aÕ@ð )r5   c                 óâ  >• U R                   S:X  a  gU R                   S:X  a  TR                  S5        gTR                  U / 5      n[        U R                  R                  5       5      S:X  a  UR                  U 5        [        U5      (       aK  SR                  U Vs/ s H  n[        U5      PM     snS/-   5      nTR                  ST" U5       S35        gTR                  S5        gs  snf )	z¤
Delete values after their last use. This ensures that values that are
not used in the remainder of the code are freed and the memory usage
of the code is optimal.
r%   Nr&   rË   r   rŠ  ÚNoneú;  )Úopr‘  rq   rÒ   ÚusersÚkeysrð   rÛ   )r�  Únodes_to_deleter†  Úto_delete_strÚbodyrh  r“  s       €€€r6   Údelete_unused_valuesÚ6CodeGen._gen_python_code.<locals>.delete_unused_valuesi  sÍ   ø€ ð �w‰w˜-Ó'ØØ�w‰w˜(Ó"Ø—‘˜DÔ!ØØ/×3Ñ3°D¸"Ó=ˆOä�4—:‘:—?‘?Ó$Ó%¨Ó*ð  ×&Ñ& tÔ,ä�?×#Ñ#Ø %§
¡
Ù&5Ó6¢o ”T˜!–W¡oÑ6¸&¸ÑAó!�ð —‘˜c¡# mÓ"4Ð!5°RÐ8Õ9à—‘˜DÕ!ùò	 7s   ÂC,Únodec           	      ó  >• U R                   S;  Gaï  SnT(       a[  / nT H7  nX0R                  ;   d  M  UR                  U SU R                  U    35        M9     U(       a  SSR                  U5       S3nSnU R                  R	                  S0 5      n0 nU(       aH  UR                  5        H/  u  p7[        U5      n[        U5      S:”  a  US	S S
-   Xc'   M+  XvU'   M1     SU 3nSn	U R                  =n
(       a"  [        U
5      =n(       a  UR                  5       n	Sn[        U S5      (       a¡  U R                  (       a�  U R                  R	                  SS	5      nU R                  R	                  SS	5      nUb(  Ub%  S[        U5       S[        UR                  5       3nO-Ub  S[        UR                  5       3nOUb  S[        U5       3nST" U SU U SU	 35       S3nUT:w  a  UmTR                  U5        g	g	g	)zY
Append a summary of the stacktrace to the generated code. This is
useful for debugging.
>   r&   r%   rè   ú: z# r-  Ú Úcustomé(   Nz...z Annotation: z'No stacktrace found for following nodesÚmetaÚ	recomputeÚac_graph_idz ac_graph_id: z - z recompute: rË   rõ   )r™  r§  r‘  rð   rq   r  r2   rÒ   rÈ   rØ   rÆ   r`  r8   )r¡  Úadditional_meta_strÚpartsÚkeyÚannotation_strÚ
annotationÚannotation_truncr¡   Ú	value_strÚstack_trace_strrÈ   Úparsed_stack_traceÚmaybe_recompute_infor¨  r©  Úsummary_strrG  rž  rh  Úprev_summary_strs                   €€€€r6   Úappend_stacktrace_summaryÚ;CodeGen._gen_python_code.<locals>.append_stacktrace_summary†  s"  ø€ ð �w‰wÐ7Ô7Ø&(Ð#Þ"Ø�EÛ.˜Ø§)¡)Õ+Ø!ŸL™L¨C¨5°°4·9±9¸S±>Ð2BÐ)CÖDñ  /ö Ø02°4·9±9¸UÓ3CÐ2DÀAÐ.FÐ+à!#�Ø!ŸY™YŸ]™]¨8°RÓ8�
Ø#%Ð ÞØ&0×&6Ñ&6Ö&8™
˜Ü$'¨£J˜	Ü˜y›>¨BÓ.Ø4=¸c¸r°NÀUÑ4JÐ,Ó1à49¨SÓ1ñ '9ð (5Ð5EÐ4FÐ%G�Nà"K�Ø"&×"2Ñ"2Ð2�;Õ2Ü-?ÀÓ-LÐLÐ)ÕLØ*<×*LÑ*LÓ*N˜à')Ð$Ü˜4 ×(Ñ(¨T¯Y¯Yð !%§	¡	§¡¨k¸4Ó @�IØ"&§)¡)§-¡-°¸tÓ"D�Kà Ñ,°Ñ1Hà,¬S°Ó-=Ð,>¸cÄ#ÀiÇnÁnÓBUÐAVÐWñ -ð #Ñ.Ø1=¼cÀ)Ç.Á.Ó>QÐ=RÐ/SÑ,Ø$Ñ0Ø1?ÄÀKÓ@PÐ?QÐ/RÐ,à "¡3Ð*=Ð)>¸aÀÐ?OÐPdÐOeÐefÐgvÐfwÐ'xÓ#yÐ"zÐz|Ð}�àÐ"2Ó2Ø'2Ð$Ø—K‘K Õ,ð 3ð] 8r5   Úshapec           	      ój   • SSR                  U  Vs/ s H  n[        U5      PM     sn5       S3$ s  snf )Nrÿ   r-  r   )rð   r2   )r¸  rD   s     r6   Ústringify_shapeÚ1CodeGen._gen_python_code.<locals>.stringify_shape¿  s1   € Ø�t—y‘y±%Ó!8²%¨Q¤# a¦&±%Ñ!8Ó9Ð:¸!Ð<Ð<ùÒ!8s   ‘0
c                 ó  >• U R                   c  SOST'" U R                   5       3nSnT((       Ga:   SSKJnJn  UR                  nSSKJn  SSKJ	n  U R                  R                  SU R                  R                  SU R                  R                  S	S 5      5      5      nS
[        R                  S[        4UUUUU!U#U&4S jjn	[        U[        R                  5      (       Ga   UR                   [        R"                  [        R$                  4;  aò  [        U5      [        R                  L =(       d$    [        U[        R&                  R(                  5      n
U	" U5      nU
(       a  SU S3nOû[        U5      UL ah  Uc  [+        S5      eU" UR,                  R.                  UR,                  R0                  5      nUR2                  R4                  nSU SU ST" U5       S3nO…UR2                  R4                  nSU SU S3nOe[        X†5      (       a  [6        R9                  U5      nSU S3nO9[        X‡5      (       a)  S[:        UR<                      T&" UR>                  5       S3nS nT(       a7  U R                  R                  SS 5      nUb  U R@                  S:X  a  USU 3-  nT (       aœ  [C        U S5      (       a‹  U R                  (       az  TRE                  S5        U R                  RG                  5        H:  u  nnTRE                  U S[H        RJ                  " [        U5      SSS9 S35        M<     TRE                  S5        U R@                  S:X  aÚ  [        U RL                  [        5      (       d!  [+        S[        U RL                  5       35      eU RN                  (       d  SOST" U RN                  S   5       3nTRE                  U RL                   U U U 35        U RL                  RQ                  S S5      nU[S        U 5      :w  a   TRE                  [S        U 5       SU S35        g U R@                  S!:X  a«  [        U RL                  [        5      (       d!  [+        S"[        U RL                  5       35      eTRE                  [S        U 5       U S[U        T" U RN                  S   5      U RL                  5       ST" U RN                  S#S  U RV                  5       S$35        g U R@                  S%:X  Ga(  [Y        U RL                  5      (       d!  [+        S&[        U RL                  5       35      e[[        U RL                  S'S5      S(:X  a¼  U RL                  R4                  [\        ;   až  [        U RN                  [^        5      (       d!  [+        S)[        U RN                  5       35      eTRE                  [S        U 5       U S[\        U RL                  R4                     R`                  " U4S* jU RN                   5       6  35        g [[        U RL                  S'S5      S(:X  a’  U RL                  R4                  [b        ;   at  TRE                  [b        U RL                  R4                     R`                  " U4S+ jU RN                   5       6  S,[S        U 5       U ST" U RN                  S   5       35        g [e        U RL                  5      nT" UU RL                  5      nUS-:X  aÈ  [        U RN                  [^        5      (       a©  [        U RN                  S#   [        5      (       a‡  U RN                  S#   Rg                  5       (       ae  [i        U RN                  5      S.:X  aL  TRE                  [S        U 5       U S[U        T" U RN                  S   5      U RN                  S#   5       35        g TRE                  [S        U 5       U SU ST" U RN                  U RV                  5       S$35        U R                  R                  S/S05      (       a  T)Rk                  U5        g U R@                  S1:X  a•  [        U RL                  [        5      (       d!  [+        S2[        U RL                  5       35      eTRE                  [S        U 5       U S[U        T$U RL                  5       ST" U RN                  U RV                  5       S$35        g U R@                  S3:X  av  [        U RL                  [        5      (       d!  [+        S4[        U RL                  5       35      eTRE                  [S        U 5       U S[U        T$U RL                  5       35        g U R@                  S5:X  af  U R                   b  S6T'" U R                   5       3T"S'   TRE                  T%Rm                  T%Rn                  U RN                  S   T(       a  UOS S795        g [q        S8U R@                   S9U RL                   35      e! [
         a    S nS n G	N½f = f):Nrè   z : r   )ÚDTensorÚDTensorSpec)Úpy_sym_types)ÚTensorMetadataÚvalÚtensor_metaÚexample_valuer‡  rE   c                 óô   >• T(       a  T	" U R                  5       5      OSnT(       a  U R                   OSnT" [        U R                     5       T" T	" U R                  5      5       T" U5       T" U5       3$ ©Nrè   )ÚstriderA   r   r|  r¸  )
r‡  rÆ  rA   rj  ri  rg  rD  rC  rf  rº  s
      €€€€€€€r6   Ú_tensor_annotationÚGCodeGen._gen_python_code.<locals>.emit_node.<locals>._tensor_annotationÛ  so   ø€ Þ<J™_¨Q¯X©X«ZÔ8ÐPR�FÞ.< §¡™zÀ"�Fáœ{¨1¯7©7Ñ3Ó4Ð5Ù¡°·±Ó 8Ó9Ð:Ù# FÓ+Ð,Ù$ VÓ,Ð-ð/ðr5   z: "Ú"z6dtensorspec_format_shard_order_str is None for DTensorrý   r-  z)"z: "Sym(r  r%   r  r§  z"""
r£  éP   T)ÚwidthÚcompactrË   z$Expected node.target to be str, got rŠ  Ú*r"   z4Expected node.target to be str for call_method, got r   rþ   r!   z)Expected node.target to be callable, got r.   Ú	_operatorz$Expected node.args to be tuple, got c              3   ó4   >#   • U  H  nT" U5      v •  M     g 7fr:   r,   rn  s     €r6   rí   Ú>CodeGen._gen_python_code.<locals>.emit_node.<locals>.<genexpr>D  s   øé € ÐGhÒ^gÐYZÉ	ÐRSÏÈÒ^gùrr  c              3   ó4   >#   • U  H  nT" U5      v •  M     g 7fr:   r,   rn  s     €r6   rí   rÐ  O  s   øé € ÐIjÒ`iÐ[\É)ÐTUÏ,È,Ò`iùrr  r˜  rR   ri   Ú
is_wrappedFr$   z4Expected node.target to be str for call_module, got r#   z1Expected node.target to be str for get_attr, got r&   z -> r2  znode: r¤  )9r    Útorch.distributed.tensor._apir½  r¾  Úformat_shard_order_strÚModuleNotFoundErrorÚ"torch.fx.experimental.proxy_tensorr¿  Útorch.fx.passes.shape_proprÀ  r§  rq   r@   rz  r2   r  ÚlayoutÚ
sparse_cscÚ
sparse_csrÚ_subclassesÚ
FakeTensorro   Ú_specÚ
placementsÚshard_orderry  r-   r   rß   r   r|  r¸  r™  r`  r‘  r  ÚpprintÚpformatr‰   ræ   ÚreplacerÛ   r’   r   ÚcallablerR   Úmagic_methodsr  ÚformatÚinplace_methodsr   rŽ   rÒ   ry   r%  r5  ÚNotImplementedError)*r¡  Úmaybe_type_annotationÚmaybe_commentr½  r¾  Ú"dtensorspec_format_shard_order_strr¿  rÀ  Úmeta_valrÇ  Úis_plainÚcoreÚdtensor_metar‚  Úval_strr  r"  r#  Úmaybe_default_argÚraw_namer�  rR  r�  rp  rT  rj  rž  ri  rg  r(  r)  rD  Úinclude_metarC  r*  rf  rH  rb   rº  rd  rB  Úwrapped_fnss*                         €€€€€€€€€€€€€€€€€€€€r6   Ú	emit_nodeÚ+CodeGen._gen_python_code.<locals>.emit_nodeÂ  sß  ø€ à—i‘iÑ'‘¨s±9¸T¿Y¹YÓ3GÐ2HÐ-Ið "ð ˆMçð>ßRð $×:Ñ:ð 7õ LÝEàŸ9™9Ÿ=™=ØØ—I‘I—M‘M -°·±·±¸ÐPTÓ1UÓVó�ð
¬%¯,©,ð ¼3÷ õ ô ˜h¬¯©×5Ò5¸(¿/¹/Ü×$Ñ$Ü×$Ñ$ðRó ;ô
  $ H›~´·±Ð=÷  ÄØ ¤%×"3Ñ"3×">Ñ">óB�Hñ .¨hÓ7�DÞØ25°d°V¸1°Ñ-Ü˜h›¨7Ò2Ø=ÑEÜ"0Ø Xó#ð ñ (JØ$ŸN™N×5Ñ5Ø$ŸN™N×6Ñ6ó(˜ð '×0Ñ0×9Ñ9˜à! #  a¨ v¨R±	¸,Ó0GÐ/HÈÐKñ .ð '×0Ñ0×9Ñ9˜Ø25°c°U¸!¸D¸6ÀÐ0DÑ-ä ×7Ñ7Ü%×/Ñ/°Ó9�GØ.5°g°Y¸bÐ,AÑ)ä ×9Ñ9Ø.1´+¸h¿n¹nÑ2MÐ1NÉÐ_g×_mÑ_mÓOnÐNoÐopÐ,qÐ)àˆDÞØ—y‘y—}‘} V¨TÓ2�ØÑ#¨¯©°=Ó(@Ø! t¨D¨6 ]Ñ2�Mö ¤¨¨f× 5Ñ 5¸$¿)¿)Ø—‘˜GÔ$Ø ŸI™IŸO™OÖ-‘D�A�qð —K‘KØ˜#˜R¤§¢¬s°1«v¸RÈÑ NÐOÈrÐRöñ	 .ð —‘˜GÔ$à�w‰w˜-Ó'Ü! $§+¡+¬s×3Ñ3Ü(Ø>¼tÀDÇKÁKÓ?PÐ>QÐRóð ð #ŸiŸi‘B¨s±9¸T¿Y¹YÀq¹\Ó3JÐ2KÐ-Lð "ð × Ñ Ø—{‘{�mÐ$9Ð#:Ð;LÐ:MÈmÈ_Ð]ôð  Ÿ;™;×.Ñ.¨s°BÓ7�Øœt D›zÓ)Ø—K‘K¤4¨£: ,¨c°(°¸2Ð >Ô?ØØ—‘˜MÓ)Ü! $§+¡+¬s×3Ñ3Ü(ØNÌtÐTX×T_ÑT_ÓO`ÐNaÐbóð ð —‘Ü˜D“z�lÐ#8Ð"9¸¼^ÉIÐVZ×V_ÑV_Ð`aÑVbÓLcÐei×epÑepÓ=qÐ<rØ™ T§Y¡Y¨q¨r ]°D·K±KÓ@ÐAÀðDôð Ø—‘˜OÔ+Ü §¡×,Ñ,Ü(ØCÄDÈÏÉÓDUÐCVÐWóð ô
 ˜DŸK™K¨°rÓ:¸kÓIØŸ™×,Ñ,´Ó=ä% d§i¡i´×7Ñ7Ü,ØBÄ4ÈÏ	É	Ã?ÐBSÐTóð ð —K‘KÜ ›:˜,Ð'<Ð&=¸SÜ(¨¯©×)=Ñ)=Ñ>×EÒEÔGhÐ^b×^gÒ^gÓGhÐiÐjðlôð ô
 ˜DŸK™K¨°rÓ:¸kÓIØŸ™×,Ñ,´Ó?à—K‘KÜ*¨4¯;©;×+?Ñ+?Ñ@×GÒGÔIjÐ`d×`iÒ`iÓIjÐkÐlÐloÜ ›:˜,Ð'<Ð&=¸SÁÈ4Ï9É9ÐUVÉ<ÓAXÐ@Yð[ôð ä!4°T·[±[Ó!A�Ù(¨¸¿¹ÓE�ð   9Ó,Ü" 4§9¡9¬e×4Ñ4Ü" 4§9¡9¨Q¡<´×5Ñ5ØŸ	™	 !™×1Ñ1×3Ñ3Ü˜DŸI™I›¨!Ó+à—K‘KÜ ›:˜,Ð'<Ð&=¸SÄÑPYÐZ^×ZcÑZcÐdeÑZfÓPgÐim×irÑirÐstÑiuÓAvÐ@wÐxôð Ø—‘Ü˜D“z�lÐ#8Ð"9¸¸[¸MÈÉ<ÐX\×XaÑXaÐcg×cnÑcnÓKoÐJpÐpqÐrôð —9‘9—=‘= ¨u×5Ñ5Ø×*Ñ*¨;Ô7ØØ—‘˜MÓ)Ü! $§+¡+¬s×3Ñ3Ü(ØNÌtÐTX×T_ÑT_ÓO`ÐNaÐbóð ð —‘Ü˜D“z�lÐ#8Ð"9¸Ü% k°4·;±;Ó?Ð@ÀÁ,ÈtÏyÉyÐZ^×ZeÑZeÓBfÐAgÐghðjôð Ø—‘˜JÓ&Ü! $§+¡+¬s×3Ñ3Ü(ØKÌDÐQU×Q\ÑQ\ÓL]ÐK^Ð_óð ð —‘Ü˜D“z�lÐ#8Ð"9¸¼^ÈKÐY]×YdÑYdÓ=eÐ<fÐgôð Ø—‘˜HÓ$Ø—9‘9Ñ(Ø37¹	À$Ç)Á)Ó8LÐ7MÐ1NÐ+¨AÑ.Ø—‘Ø×:Ñ:Ø×,Ñ,ØŸ	™	 !™Þ&2™d¸ð ;ð ôð Ü%¨¨t¯w©w¨i°q¸¿¹¸Ð&FÓGÐGøôo +ó >Ø"�GØ9=Ó6ð>ús   ±g1 ç1hèhzc_rf = torch._C._profiler._RecordFunctionFast('## ENTER_GRAPH_PLACEHOLDER_KEY ##'); _rf.__enter__()
z# COUNTER: rË   )r!   r"   r$   Ú_rf_z. = torch._C._profiler._RecordFunctionFast('## z ##'); _rf_z.__enter__()
z.__exit__(None, None, None)
z_rf.__exit__(None, None, None)
r   zpass
Úwrapz("rŒ   r'  r   c              3   ó,   #   • U  H
  nS U-   v •  M     g7f)rö   Nr,   )rë   rÖ   s     r6   rí   Ú+CodeGen._gen_python_code.<locals>.<genexpr>Î  s   é € ÐDÒ3C¨4˜ $žÒ3Cùs   ‚z

é   )r†   r‡   )%ÚosÚenvironrq   r2   r	   r7   r  Ú
_color_fnsÚ	_identityr  r   rˆ   r   ÚreversedÚ_input_nodesr   r‘  Ú	enumerater™  r8   rÒ   r@   Úfxr÷  rð   rã   r?  r%  r0  Úcountr�   Ú_counter_regexpÚsearchrr   rp   rø   r   )6rb   ÚnodesrH  rI  rB  rC  rD  rE  r(  rF  rG  r8   rg   r+   r”  r¡  Ú
input_noderŸ  r¶  rô  ÚiÚ	do_recordÚ	wrap_nameÚ
wrap_stmtsr¡   ÚprologueÚ
lineno_mapÚprologue_lenÚ	new_linesÚcur_idxrÖ   ÚcounterrÃ   Úfn_codeÚprologue_startr�  rp  rT  rj  rž  rh  ri  rg  r)  rS  rò  r*  r’  rµ  rf  rº  rd  r“  ró  s6   ` ````` ` `                        @@@@@@@@@@@@@@@@@@@r6   Ú_gen_python_codeÚCodeGen._gen_python_codeÃ  sû  ÿÿÿú€ ð  "ˆ	ØˆØ#%ˆØ')ˆð /1¨TÐØ'÷ 
Ü�J‰J�N‰NÐ1°3Ó7¸3Ñ>ð 	ð (÷ 
Ü�J‰J�N‰NÐ1°3Ó7¸3Ñ>ð 	ô —z‘z—~‘~Ð&:¸CÓ@ÀCÑGˆð	¤#ð 	¬C÷ 	ð 	ô: /×4Ñ4Ö6‰NˆD‘(�1Ù�tÖ!ñ 7ð	+œ÷ 	+ð 	+ö: Ü˜UÑ#ˆCÜ" ;Ñ/ˆIÜ˜UÑ#ˆCÜ! *Ñ-ˆHÜ˜fÑ%‰DäˆCÜ!ˆIÜˆCÜ ˆHÜˆDð%	'œ3ð %	'¤3÷ %	'ñ %	'ðN	"Üœ #˜Ñ&ð	"Ü04´S¼(°]Ñ0Cð	"ä÷	"ð .0ÐØ46Ðð	A¤$ð 	A¬d÷ 	Að 	Aô
 ˜U–OˆDØ"×/Ô/�
Ù" :¨tÖ4ó 0ñ $ð	"¤t÷ 	"ñ 	"ð6  Ðð7	-¬D÷ 7	-ò 7	-ðr	=¤8ð 	=´ô 	=ðE	HœD÷ E	H÷ E	H÷ E	Hò E	HöN Ø�K‰KØvôô ! Ö'‰GˆAˆtö Ù)¨$Ô/ð �K‰K˜+ a S¨Ð+Ô,Ø#÷ ¨¯©ð 4ñ )ˆIö
 à—‘Ø˜4Ÿ9™9˜+Ð%SÐTUÐSVÐVaÐbf×bkÑbkÐalÐlzÐ{ôñ �dŒOÙ  Ô&ßˆyØ—‘˜d 4§9¡9 +Ð-JÐKÖLñ- (ö. Ø�K‰KÐ:Ô;äˆt‹9˜‹>ð �K‰K˜Ô!äˆ{Ó˜aÓÙ" 6¬5¯8©8¯=©=Ó9ˆIØŸ™ÉÓ#UÊÀ y k°°D°6¸Ó$<ÉÑ#UÓV‰JàˆJà×!×!Ø×)Ñ)¨$Ó/ˆDà×2Ñ2Ö4‰KˆD�%Ù�t˜UÖ#ñ 5ð ×9Ñ9Ø�O‰OØØ# AÑ&Ø%ð	 :ð 
ˆð 02ˆ
Ø—~‘~ dÓ+¨aÑ/ˆØ!ˆ	ØˆØ—G‘G˜D“M×'Ñ'¨Ö-ˆDÜ%×,Ñ,¨TÓ2ˆGØÑ"Ü˜gŸm™m¨AÓ.Ó/’à<C�
œ3˜y›>¨LÑ8Ñ9Ø× Ñ  Ö&ñ .ð �y‰y˜Ó#×*Ñ*¨4Ó0ˆØ�y‰yÑD°4·:±:¸dÔ3CÓDÓDˆðØ€ð à	€
ð Ø€ð	
ˆð $×)Ñ)¨$Ó/°!Ñ3ˆÜØØØ"Ø*ñ	
ð 	
ùòQ $Vs   Í1S:râ   rÅ  )r-   r.   r/   r0   rß   r   r2   r3   rc   r¼   rò   rê   r  r  r  r  r%  Úboolr0  r   r   r	   r5  r8  r<  r?  rZ   r   r  r4   r,   r5   r6   r   r   R  sµ  ‡ ñ ;L€IˆxÐ0Ð1°3Ð6Ñ7ÓKò)ðE¨4°©9ð E¸ô Eð# cð #¨cô #ðJ¨E°#°s°(©Oô Jñ
È3õ 
ò1ò0ð #ò^à˜‘9ð^ð "%ð^ð
 ð^ð 
õ^ð2 @Dò
1Ø#ð
1Ø/7¸©}ð
1à	õ
1ð	 Cð 	¨Cô 	ð sð ¨sô ð D¨¨s°C¨x©Ñ$9ô ð Ø$Ø$Øà"Ø!Ø/3òY
ð ðY
ð ð	Y
ð ðY
ð ðY
ð ðY
ð ðY
ð ðY
ð ðY
ð " $ s¡)Ñ,ðY
ð 
÷Y
ð Y
r5   r   c                   ó.   • \ rS rSrSrSS.S\4S jjrSrg)	Ú_BoxedCodeGeniå  zë
CodeGen subclass that generates code using the "boxed" calling convention.

The boxed calling convention takes a single list argument and clears it
after extracting the arguments, which allows for early deallocation of
input tensors.
Fr'  r(  c                ó   • SU R                    SU S3nU(       an  U Vs/ s H>  oUS:w  d  M
  UR                  S5      S   R                  S5      S   R                  5       PM@     nnU(       a  US-  nU H  nUSU S	3-  nM     US
-  nU$ s  snf )zÜ
Generate function definition for boxed calling convention.

Instead of taking individual arguments, the generated function takes
a single 'args_list' parameter, extracts placeholder values from it,
and clears the list.
r,  z(self, args_list)rÅ   rb   r   Ú=z 
    args_iter = iter(args_list)ú
    z = next(args_iter)z
    args_list.clear())rä   r�   rÐ   )rb   r)  r*  r(  Úfn_defr#  Úplaceholder_varsÚvars           r6   r0  Ú_BoxedCodeGen.gen_fn_defî  s´   € ð ˜Ÿ™Ð(Ð(9Ð:QÐ9RÐRSÐTˆæñ @Ió Ú?H¸!ÐQWÉKÓ5�—‘˜“˜Q‘×%Ñ% cÓ*¨1Ñ-×3Ñ3Ö5¹yð ð  ö  ØÐ=Ñ=�Û+�CØ  s eÐ+=Ð>Ñ>’Fñ ,àÐ3Ñ3�àˆùò s
   Ÿ	B¬8Br,   N)r-   r.   r/   r0   r1   r  r0  r4   r,   r5   r6   r  r  å  s    † ñð KPòØCG÷ð r5   r  c                   ó¼   ^ • \ rS rSrS\4U 4S jjrS\S\4S jrS\S\4S jrS	\	\
   S
\S\
4S jrS\
4S jrSS.S
\4U 4S jjjrSS.S\\   4U 4S jjjrSrU =r$ )Ú_PyTreeCodeGeni  Úpytree_infoc                 ó.   >• [         TU ]  5         Xl        g r:   )Úsuperrc   r"  )rb   r"  ry  s     €r6   rc   Ú_PyTreeCodeGen.__init__  s   ø€ Ü‰ÑÔØ(3Õr5   ÚinputsrE   c                 ó,   • [         R                  " U6 nU$ r:   )rC   Úarg_tree_leaves)rb   r&  Ú	flat_argss      r6   r8  Ú_PyTreeCodeGen.process_inputs  s   € Ü×*Ò*¨FÐ3ˆ	ØÐr5   Úoutc                 ó"  • U R                   b  U R                   R                  c  U$ [        U[        [        45      (       d  U/nU R                   R                  c  [        S5      e[        R                  " XR                   R                  5      $ )Nzpytree_info.out_spec is None)r"  r»   r  r¼   r  ro   rC   Útree_unflatten©rb   r+  s     r6   r<  Ú_PyTreeCodeGen.process_outputs  sw   € Ø×ÑÑ# t×'7Ñ'7×'@Ñ'@Ñ'HØˆJÜ˜#¤¤e˜}×-Ñ-Ø�%ˆCØ×Ñ×$Ñ$Ñ,Ü Ð!?Ó@Ð@Ü×$Ò$ S×*:Ñ*:×*CÑ*CÓDÐDr5   r)  r(  c                 óÒ   • U(       d  gU Vs/ s H  nSU;   d  M  UPM     nnU(       d  gU(       a  SSR                  U5      -   $ SSR                  S U 5       5      -   S-   $ s  snf )z=Helper to format annotations for variables in pytree codegen.rè   rÅ   r  c              3   ó*   #   • U  H	  oS -   v •  M     g7f)z; Nr,   ©rë   rD   s     r6   rí   Ú5_PyTreeCodeGen._format_annotations.<locals>.<genexpr>)  s   é € Ð%Gº°1¨$¦hºùs   ‚rË   rï   )rb   r)  r(  rD   Úhas_annotations        r6   Ú_format_annotationsÚ"_PyTreeCodeGen._format_annotations  sc   € æØá%.Ó;¢Y °#¸±(Ÿ!¡YˆÐ;ÞØæØ˜hŸm™m¨NÓ;Ñ;Ð;à˜bŸg™gÑ%G¹Ó%GÓGÑGÈ$ÑNÐNùò <s
   �
A$›A$c           
      ór  • U R                   R                  nUR                  [        L =(       a_    UR                  S:H  =(       aI    UR                  S5      R                  [        L =(       a!    UR                  S5      R                  [        L nSnSSR                  U5       S3nU(       a¤  UR                  S5      R                  nU R                   R                  S U nSSR                  S	 [        UR                  S5      R                  U R                   R                  US  5       5       5      -   S
-   nSSR                  U5       SU S3nU V	s/ s H(  o™R                  S5      S   R                  S5      S   PM*     n
n	U R                  X#5      nUSSR                  U
5       SU S3-  nU$ s  sn	f )Nri   r   r   z{}rÿ   r-  z], self._in_specÚ{c              3   ó6   #   • U  H  u  pS U SU 3v •  M     g7f)Ú'z':Nr,   )rë   r"  r#  s      r6   rí   Ú2_PyTreeCodeGen.gen_var_bindings.<locals>.<genexpr>;  s)   é € ð ò!™˜ð ˜�s˜"˜Q˜C•Lò!ùs   ‚Ú}z([z], z), self._in_specrÅ   rõ   r  z , = fx_pytree.tree_flatten_spec(rþ   )r"  rº   r    r  Únum_childrenÚchildrˆ   rð   r¹   r  Úcontextr�   r5  )rb   Úfn_argsr)  r(  rº   Úhas_args_kwargs_tupleÚ	fn_kwargsÚfn_signatureÚ
count_argsrD   Úwithout_annotationÚbindingss               r6   Úgen_var_bindingsÚ_PyTreeCodeGen.gen_var_bindings+  s¾  € Ø×"Ñ"×*Ñ*ˆð �L‰LœEÐ!÷ .Ø×$Ñ$¨Ñ)÷.à—‘˜aÓ ×%Ñ%¬Ð.÷.ð —‘˜aÓ ×%Ñ%¬Ð-ð	 	ð ˆ	Ø˜4Ÿ9™9 WÓ-Ð.Ð.>Ð?ˆÞ Ø Ÿ™ qÓ)×6Ñ6ˆJØ×&Ñ&×0Ñ0°°*Ð=ˆGàØ—)‘)ñ ä #ØŸ™ aÓ(×0Ñ0Ø×(Ñ(×2Ñ2°:°;Ð?ô!óó ñð ñð ð   §	¡	¨'Ó 2Ð3°3°y°kÐAQÐRˆLñ FOÓOÂYÀŸg™g c›l¨1™o×3Ñ3°CÓ8¸Ô;ÁYÐÐOØ×+Ñ+¨IÓDˆØð Ø	‡Y�YÐ!Ó"Ð#Ð#CÀLÀ>ÐQRðVñ 	Vˆàˆùò	 Ps   Å/F4Fr'  c                ó6  >• U R                   c  [        TU ]	  XUS9$ U R                   R                  n[	        U5      S:”  a  US   S:H  OSnU(       a  UR                  SS5        [        TU ]	  US S  X#S9n[	        U5      S:”  a  X`R                  XAU5      -  nU$ )Nr'  r   rb   F)r"  r$  r0  r¹   rÒ   r.  rG  )rb   r)  r*  r(  r@  Úhas_orig_selfÚfn_definitionry  s          €r6   r0  Ú_PyTreeCodeGen.gen_fn_defP  sµ   ø€ ð$ ×ÑÑ#Ü‘7Ñ%ØÀð &ð ð ð ×"Ñ"×,Ñ,ˆÜ25°g³,ÀÓ2B˜ ™ vÒ-ÈˆÞØ×Ñ˜Q Ô'Ü™Ñ*Ø‘AˆJÐ/ð +ð 
ˆô ˆy‹>˜AÓØ×2Ñ2°7À|ÓTÑTˆMØÐr5   Nr2  r  c                óú   >• U R                   (       a]  U R                   R                  (       aB  Ub0  [        U[        [        45      (       a  U R                  XS5      S-   $ S[        U5       S3$ [        TU ]!  XS9$ )Núreturn pytree.tree_unflatten(ú, self._out_spec)r2  )	r"  r»   r  r¼   r  r  rÛ   r$  r5  )rb   r3  r  ry  s      €r6   r5  Ú_PyTreeCodeGen.generate_outputs  s‚   ø€ Ø×× × 0Ñ 0× 9× 9ØÑ ¤Z°¼dÄE¸]×%KÑ%Kà×4Ñ4Ø#Ð,Kóð *ñ*ðð 4´D¸Ó4EÐ3FÐFWÐXðô ‘7Ñ*¨;Ð*ÐDÐDr5   )r"  )r-   r.   r/   r0   r¸   rc   r	   r8  r<  r¼   r2   r  r5  rG  r0  r   r5  r4   Ú__classcell__©ry  s   @r6   r!  r!    s    ø† ð4 K÷ 4ð cð ¨cô ðE 3ð E¨3ô EðO¨T°#©Yð OÀdð OÈsô Oð#ÀCô #ðL KPò!ØCG÷!ð !ðF FJò E°X¸c±]÷ Eö Er5   r!  c                   óÔ   ^ • \ rS rSrS\SSSSS\\   S\\R                  R                     4
U 4S jjrS	\S
\4U 4S jjrS\S
\4U 4S jjrS
\4U 4S jjrS
\4S jrS
\4S jrSrU =r$ )Ú_ExportCodeGeni„  r"  Úin_shuffle_graphr    Úout_shuffle_graphÚtree_leaf_namesÚrootc                 óT   >• [         TU ]  U5        X l        X0l        X@l        XPl        g r:   )r$  rc   rU  rV  rW  rX  )rb   r"  rU  rV  rW  rX  ry  s         €r6   rc   Ú_ExportCodeGen.__init__…  s)   ø€ ô 	‰Ñ˜Ô%Ø 0ÔØ!2ÔØ.ÔØ�	r5   r&  rE   c                 ó‚   >• [         TU ]  " U6 nU R                  b  U R                  /UQ7nX l        U R                  " U6 $ r:   )r$  r8  rX  r)  rU  )rb   r&  r)  ry  s      €r6   r8  Ú_ExportCodeGen.process_inputs“  sC   ø€ Ü‘GÒ*¨FÐ3ˆ	Ø�9‰9Ñ ØŸ™Ð/ YÑ/ˆIØ"ŒØ×$Ò$ iÐ0Ð0r5   r+  c                 óf   >• U R                   " / U R                  QUQ76 nU ?[        TU ]  U5      nU$ r:   )rV  r)  r$  r<  )rb   r+  Ú	flat_outsÚretry  s       €r6   r<  Ú_ExportCodeGen.process_outputsš  s8   ø€ Ø×*Ò*ÐA¨D¯N©NÐA¸SÒAˆ	ØˆNÜ‰gÑ% iÓ0ˆØˆ
r5   c                 ó(   >• [         TU ]  " U0 UD6nU$ r:   )r$  r0  )rb   ræ   r   r  ry  s       €r6   r0  Ú_ExportCodeGen.gen_fn_def   s   ø€ Ü‘Ò# TÐ4¨VÑ4ˆØˆr5   c           
      ó^  • U Vs/ s H(  oDR                  S5      S   R                  S5      S   PM*     nnSR                  U5       nU R                  b  SU 3nSSR                  U R                  5       SU SSR                  U5       S	SR                  U R                  5       S
3	$ s  snf )NrÅ   r   rõ   r-  zself, r  z, = pytree.tree_leaves((z,))
    z, = self._in_shuffle_graph(rþ   )r�   rð   rX  rW  )rb   r@  r)  r(  rD   rE  rC  s          r6   rG  Ú_ExportCodeGen.gen_var_bindings¤  s»   € ÙENÓOÂYÀŸg™g c›l¨1™o×3Ñ3°CÓ8¸Ô;ÁYÐÐOØ#Ÿy™y¨Ó1Ð2ˆØ�9‰9Ñ Ø# L >Ð2ˆLðØ	‡Y�Yˆt×#Ñ#Ó$Ð%Ð%=¸l¸^ð LØ	‡Y�YÐ!Ó"Ð#Ð#>¸t¿y¹yÈ×I]ÑI]Ó?^Ð>_Ð_`ðdð 	dùò	 Ps   …/B*c                 ó®   • SSR                  U R                  5       SSR                  U Vs/ s H  n[        U5      PM     sn5       S3nSU S3$ s  snf )Nzself._out_shuffle_graph(r-  rþ   rN  rO  )rð   rW  r2   )rb   r3  ræ   r   ro  r&   s         r6   r5  Ú_ExportCodeGen.generate_output­  sb   € Ø+¨D¯I©I°d×6JÑ6JÓ,KÐ+LÈBÈtÏyÉyÑjuÓYvÒjuÐefÔZ]Ð^_ÖZ`ÑjuÑYvÓOwÐNxÐxyÐzˆØ.¨v¨hÐ6GÐHÐHùò Zws   ­A)r)  rU  rV  rX  rW  )r-   r.   r/   r0   r¸   r¼   r2   r   r@   rT   ÚModulerc   r	   r8  r<  r0  rG  r5  r4   rQ  rR  s   @r6   rT  rT  „  s�   ø† ðà ðð (ðð )ð	ð
 ˜c™ðð �u—x‘x—‘Ñ'÷ð1 cð 1¨c÷ 1ð 3ð ¨3÷ ð¨S÷ ðdÀCô dðI¸s÷ Iò Ir5   rT  c                   óŽ   • \ rS rSrSrS rS\\\\	   4   4S jr
S\4S jrS\SS4S	 jrS\SS4S
 jrSS.S\S\S   4S jjrSrg)Ú_FindNodesLookupTablei²  z@
Side table for the graph for the purpose of doing fast queries
c                 ó,   • [        [        5      U l        g r:   )r   rˆ   Útablera   s    r6   rc   Ú_FindNodesLookupTable.__init__·  s   € ÜKVÜóL
ˆ�
r5   rE   c                 óX   • UR                   UR                   S:X  a  UR                  4$ S 4$ )Nr!   ©r™  r‰   ©rb   r¡  s     r6   Ú_keyÚ_FindNodesLookupTable._key¼  s(   € Ø—‘¨¯©°?Ó(B˜Ÿ™ÐMÐMÈÐMÐMr5   c                 óB   • XR                   U R                  U5         ;   $ r:   ©rk  rp  ro  s     r6   Ú__contains__Ú"_FindNodesLookupTable.__contains__¿  s   € Ø—z‘z $§)¡)¨D£/Ñ2Ñ2Ð2r5   r¡  Nc                 óF   • S U R                   U R                  U5         U'   g r:   rs  ro  s     r6   r.  Ú_FindNodesLookupTable.insertÂ  s   € Ø,0ˆ�
‰
�4—9‘9˜T“?Ñ# DÒ)r5   c                 ó^   • U R                   U R                  U5         R                  U5        g r:   )rk  rp  Úpopro  s     r6   ÚremoveÚ_FindNodesLookupTable.removeÅ  s!   € Ø�
‰
�4—9‘9˜T“?Ñ#×'Ñ'¨Õ-r5   ©r‰   r™  r‰   r   c                ó"  • US:X  a.  Uc  [        S5      e/ U R                  X4   R                  5       Q$ Uc!  / U R                  US 4   R                  5       Q$ U R                  US 4    Vs/ s H  o3R                  U:X  d  M  UPM     sn$ s  snf )Nr!   z,target must not be None for call_function op)ro   rk  r›  r‰   )rb   r™  r‰   r¡  s       r6   Ú
find_nodesÚ _FindNodesLookupTable.find_nodesÈ  s’   € Ø�Ó Ø‰~Ü$Ð%SÓTÐTØ5�T—Z‘Z  Ñ-×2Ñ2Ó4Ð5Ð5à‰>Ø3�T—Z‘Z  T 
Ñ+×0Ñ0Ó2Ð3Ð3ð "&§¡¨R°¨JÒ!7ÓQÒ!7˜¿;¹;È&Ñ;P—Ñ!7ÑQÐQùÒQs   Á,BÂB)rk  )r-   r.   r/   r0   r1   rc   r  r2   r   r   rp  r  rt  r   r.  rz  r~  r4   r,   r5   r6   ri  ri  ²  sƒ   † ñò
ð
N˜E # x°Ñ'7Ð"7Ñ8ô Nð3 Dô 3ð1˜4ð 1 Dô 1ð.˜4ð . Dô .ð CGò 
R ð 
R¨X°hÑ-?÷ 
Rð 
Rr5   ri  c                   ó@  • \ rS rSrSr\" SS9   SUS\S   S\\S	      S
\\\	\
4      4S jj5       r\S 5       r\R                  S\S   4S j5       r\S\4S j5       r\" SS9S\4S j5       r\" SS9SSS.S\	S\S   S\4S jj5       r\" SS9 SVSS S\\\4   SS4S jj5       rSWSXS jjr\" SS9    SYS\	SSS\\S      S \\\	S!4      S"\\	   S#\\
   S\4S$ jj5       r\" SS9S% 5       r\" SS9S& 5       r\" SS9S'\SS4S( j5       r\" SS9SWS)\\   4S* jj5       r\" SS9SWS)\\   4S+ jj5       r\" SS9S\R>                  R@                  4S"\	S#\\
   S,\
S\4S- jj5       r!\" SS9SWS.\	S#\\
   S\4S/ jj5       r"\" SS9   SUS0\	S\\S      S \\\	S!4      S#\\
   S\4
S1 jj5       r#\" SS9   SUS2\	S\\S      S \\\	S!4      S#\\
   S\4
S3 jj5       r$\" SS9    SYS4\%S5\
4   S\\S      S \\\	S!4      S#\\
   S"\\	   S\4S6 jj5       r&\" SS9S7 4S8\S9\%\/S!4   S\4S: jj5       r'\" SS9SWS;S!S#\\
   4S< jj5       r(S\\)   S\	4S= jr*\" SS9SSSSSSSS>.S?\	S@\SA\SB\SC\SD\SE\SF\\+\	      S\,4SG jj5       r-SSSSSSSS>.S?\	SH\.S@\SA\SB\SC\SD\SE\SF\\+\	      S\,4SI jjr/S\	4SJ jr0\" SS9SK 5       r1\" SS9SL 5       r2\" SS9 SWSM\\%\/\4      S\4SN jj5       r3\" SS9SO\44SP j5       r5\" SS9SQ\%\\6   /\64   4SR j5       r7SZSS jr8STr9g)[r   iÕ  a  
``Graph`` is the main data structure used in the FX Intermediate Representation.
It consists of a series of ``Node`` s, each representing callsites (or other
syntactic constructs). The list of ``Node`` s, taken together, constitute a
valid Python function.

For example, the following code

.. code-block:: python

    import torch
    import torch.fx


    class MyModule(torch.nn.Module):
        def __init__(self):
            super().__init__()
            self.param = torch.nn.Parameter(torch.rand(3, 4))
            self.linear = torch.nn.Linear(4, 5)

        def forward(self, x):
            return torch.topk(
                torch.sum(self.linear(x + self.linear.weight).relu(), dim=-1), 3
            )


    m = MyModule()
    gm = torch.fx.symbolic_trace(m)

Will produce the following Graph::

    print(gm.graph)

.. code-block:: text

    graph(x):
        %linear_weight : [num_users=1] = self.linear.weight
        %add_1 : [num_users=1] = call_function[target=operator.add](args = (%x, %linear_weight), kwargs = {})
        %linear_1 : [num_users=1] = call_module[target=linear](args = (%add_1,), kwargs = {})
        %relu_1 : [num_users=1] = call_method[target=relu](args = (%linear_1,), kwargs = {})
        %sum_1 : [num_users=1] = call_function[target=torch.sum](args = (%relu_1,), kwargs = {dim: -1})
        %topk_1 : [num_users=1] = call_function[target=torch.topk](args = (%sum_1, 3), kwargs = {})
        return topk_1

For the semantics of operations represented in the ``Graph``, please see :class:`Node`.
Tr€   NÚowning_moduler    Ú
tracer_clsr   Útracer_extrasc                 ó  • [        U SSSS0 5      U l        0 U l        U R                  R                  U l        SU l        [        5       U l        Xl        X l	        X0l
        [        5       U l        0 U l        [        5       U l        g)z
Construct an empty Graph.
rè   rX  r,   r   N)r   r±   r_   Úprependr˜   r­   rZ   Ú_graph_namespaceÚ_owning_moduleÚ_tracer_clsÚ_tracer_extrasr   Ú_codegenÚ
_co_fieldsri  Ú_find_nodes_lookup_table)rb   r�  r‚  rƒ  s       r6   rc   ÚGraph.__init__  sq   € ô    b¨&°"°b¸"Ó=ˆŒ
Ø+-ˆÔØ—z‘z×)Ñ)ˆŒØˆŒ	Ü *£ˆÔØ+ÔØ%ÔØ+ÔÜ›	ˆŒØ*,ˆŒÜ(=Ó(?ˆÕ%r5   c                 ó   • U R                   $ r:   ©r‡  ra   s    r6   r�  ÚGraph.owning_module  s   € à×"Ñ"Ð"r5   Úmodc                 ó   • Xl         g r:   r�  )rb   r‘  s     r6   r�  r�     s   € à!Õr5   rE   c                 ó   • [        U 5      $ )a>  
Get the list of Nodes that constitute this Graph.

Note that this ``Node`` list representation is a doubly-linked list. Mutations
during iteration (e.g. delete a Node, add a Node) are safe.

Returns:

    A doubly-linked list of Nodes. Note that ``reversed`` can be called on
    this list to switch iteration order.
)r¦   ra   s    r6   r  ÚGraph.nodes$  s   € ô ˜$ÓÐr5   Fc                 ó¤   • [        [        [        U R                  5      5      5      nUR                  S:w  a  [        SUR                   35      eU$ )Nr&   zExpected output node, got op=)ÚnextÚiterrÿ  r  r™  ro   )rb   Úoutput_nodes     r6   r˜  ÚGraph.output_node3  sD   € äœ4¤¨¯©Ó 4Ó5Ó6ˆØ�>‰>˜XÓ%Ü Ð#@ÀÇÁÐ@PÐ!QÓRÐRØÐr5   )r‰   Úsortr™  r‰   r   rš  c                ó\   • U R                   R                  XS9nU(       a  [        U5      $ U$ )aŠ  
Allows for fast query of nodes

Args:

    op (str): the name of the operation

    target (Optional[Target]): the target of the node. For call_function,
        the target is required. For other ops, the target is optional.

    sort (bool): whether to return nodes in the order they appear on
                 on the graph.

Returns:

    Iterable of nodes with the requested op and target.
rn  )rŒ  r~  Úsorted)rb   r™  r‰   rš  Ú	node_lists        r6   r~  ÚGraph.find_nodes:  s1   € ð* ×1Ñ1×<Ñ<ÀÐ<ÐRˆ	ÞÜ˜)Ó$Ð$ØÐr5   ÚgÚval_mapzOptional[Argument]c                 óè   ^• UR                    Ha  nUT;   a  M  UR                  S:X  a-  [        UR                  S   U4S j5      nU(       d  Us  $ XT4s  $ U R	                  UU4S j5      TU'   Mc     g)aý  
Copy all nodes from a given graph into ``self``.

Args:

    g (Graph): The source graph from which to copy Nodes.

    val_map (Dict[Node, Node]): a dictionary that will be populated with a mapping
        from nodes in ``g`` to nodes in ``self``. Note that ``val_map`` can be passed
        in with values in it already to override copying of certain values.

Returns:

    The value in ``self`` that is now equivalent to the output value in ``g``,
    if ``g`` had an ``output`` node. ``None`` otherwise.
r&   r   c                 ó   >• TU    $ r:   r,   ©r†  r   s    €r6   rÜ   Ú"Graph.graph_copy.<locals>.<lambda>l  s	   ø€ °W¸Q²Zr5   c                 ó   >• TU    $ r:   r,   r£  s    €r6   rÜ   r¤  n  s	   ø€ ¸7À1º:r5   N)r  r™  Úmap_argræ   Ú	node_copy)rb   rŸ  r   Úreturn_output_noder¡  Úrvs     `   r6   Ú
graph_copyÚGraph.graph_copyT  sg   ø€ ð( —G”GˆDØ�w‹ÙØ�w‰w˜(Ó"Ü˜TŸY™Y q™\Ô+?Ó@�Þ!3�rÒC¸"¸ÒCØ ŸN™N¨4Ô1EÓFˆG�D‹Mñ ð r5   c                 ó’  • U(       a  UO0 n[        U R                  S9nUR                  XSS9n[        R                  " U R
                  5      Ul        Ubp  [        U[        5      (       d  [        S[        U5       35      eUu  pEUR                  U[        USS5      S9n[        R                  " UR                  5      Ul        U$ )ab  
Explicitly implement __deepcopy__ to prevent excessive recursion depth
from the default implementation. This uses graph_copy to copy the nodes
in an iterative way, rather than recursive. It also populates the
memoization table to prevent unnecessary copies (e.g. references to
nodes or other parts of the Graph from a custom GraphModule implementation.
)r‚  T)r   r¨  Nz&Expected output_vals to be tuple, got r    ©Ú	type_expr)r   rˆ  rª  ÚcopyÚdeepcopyrŠ  r  r  ro   r    r&   rR   r§  )rb   ÚmemorŸ  Úoutput_valsÚ
output_valÚold_output_nodeÚnew_output_nodes          r6   Ú__deepcopy__ÚGraph.__deepcopy__q  s½   € ö ‰t ˆÜ˜T×-Ñ-Ñ.ˆØ—l‘l 4È$�lÐOˆÜ—]’] 4§=¡=Ó1ˆŒ
ØÑ"Ü˜k¬5×1Ñ1Ü$Ø<¼TÀ+Ó=NÐ<OÐPóð ð +6Ñ'ˆJØŸh™hàÜ! /°6¸4Ó@ð 'ð ˆOô $(§9¢9¨_×-AÑ-AÓ#BˆOÔ Øˆr5   ræ   )r   .r   r   r8   r®  c           	      óº  • U(       d  SnO,[        U[        5      (       d  [        S[        U5       35      eU(       d  [	        5       nO,[        U[
        5      (       d  [        S[        U5       35      eUb  UOU R                  U5      nU R                  R                  US5      n[        XXX4U5      nU R                  b=  [        U R                  SS5      b%  U R                  R                   H  n	U	" U5        M     U R                  R                  XX5        U R                  U5        U R                  R!                  U5        U =R"                  S-  sl        U$ )až  
Create a ``Node`` and add it to the ``Graph`` at the current insert-point.
Note that the current insert-point can be set via :meth:`Graph.inserting_before`
and :meth:`Graph.inserting_after`.

Args:
    op (str): the opcode for this Node. One of 'call_function', 'call_method', 'get_attr',
        'call_module', 'placeholder', or 'output'. The semantics of these opcodes are
        described in the ``Graph`` docstring.

    args (Optional[Tuple[Argument, ...]]): is a tuple of arguments to this node.

    kwargs (Optional[Dict[str, Argument]]): the kwargs of this Node

    name (Optional[str]): an optional string name for the ``Node``.
        This will influence the name of the value assigned to in the
        Python generated code.

    type_expr (Optional[Any]): an optional type annotation representing the
        Python type the output of this node will have.

Returns:

    The newly-created and inserted node.
r,   zargs must be a tuple, got zkwargs must be a dict, got NÚ_create_node_hooksr   )r  r  ro   r    r   rˆ   Ú_target_to_strr†  rv   r   r�  rR   r¹  r{   r˜   rŒ  r.  r­   )
rb   r™  r‰   ræ   r   r8   r®  re   r†  Úfs
             r6   Úcreate_nodeÚGraph.create_nodeŒ  s'  € öH Ø‰Dä˜d¤E×*Ñ*Ü$Ð'AÄ$ÀtÃ*ÀÐ%NÓOÐOÞÜ#Ó%‰Fä˜f¤d×+Ñ+Ü$Ð'BÄ4ÈÃ<À.Ð%QÓRÐRà Ñ,‘D°$×2EÑ2EÀfÓ2Mˆ	Ø×$Ñ$×0Ñ0°¸DÓAˆÜ�˜R¨°yÓAˆð ×ÑÑ*Ü˜×*Ñ*Ð,@À$ÓGÑSà×'Ñ'×:Ô:�Ù�!–ñ ;ð 	×Ñ×5Ñ5°dÔ>à�‰�QŒØ×%Ñ%×,Ñ,¨QÔ/Ø�	Š	�Q‰�	Øˆr5   c                 ó4   • U R                   R                  " U6 $ )z<
Processes args so that they can be passed to the FX graph.
)rŠ  r8  rñ   s     r6   r8  ÚGraph.process_inputsÍ  s   € ð
 �}‰}×+Ò+¨TÐ2Ð2r5   c                 ó8   • U R                   R                  U5      $ r:   )rŠ  r<  r.  s     r6   r<  ÚGraph.process_outputsÔ  s   € à�}‰}×,Ñ,¨SÓ1Ð1r5   Úto_erasec           	      óÊ  • [        UR                  5      S:”  a2  [        SU S[        UR                  5       SUR                   S35      eUR                  U :w  a  [        SU S35      eUR                  (       a  [
        R                  " SU S	35        g
U R                  b=  [        U R                  SS
5      b%  U R                  R                   H  nU" U5        M     U R                  R                  U5        UR                  5         SUl        U =R                  S-  sl        UR                  [        UR                   S 5      [        UR"                  S 5      5        g
)zº
Erases a ``Node`` from the ``Graph``. Throws an exception if
there are still users of that node in the ``Graph``.

Args:

    to_erase (Node): The ``Node`` to erase from the ``Graph``.
r   zTried to erase Node z but it still had z users in the graph: Ú!zAttempting to remove z from wrong graph!zerase_node(z) on an already erased nodeNÚ_erase_node_hooksTr   c                 ó   • g r:   r,   ©r†  s    r6   rÜ   Ú"Graph.erase_node.<locals>.<lambda>ý  s   € ¨dr5   c                 ó   • g r:   r,   rÇ  s    r6   rÜ   rÈ  þ  s   € °r5   )rÒ   rš  ÚRuntimeErrorr—   Ú_erasedÚwarningsÚwarnr�  rR   rÅ  rŒ  rz  Ú_remove_from_listr­   Ú_update_args_kwargsr¦  Ú_argsÚ_kwargs)rb   rÂ  r»  s      r6   Ú
erase_nodeÚGraph.erase_nodeØ  s=  € ô ˆx�~‰~Ó Ó"ÜØ& x jÐ0BÄ3ÀxÇ~Á~ÓCVÐBWð X'Ø'/§~¡~Ð&6°að9óð ð �>‰>˜TÓ!ÜÐ!6°x°jÐ@RÐSÓTÐTØ××Ü�MŠM˜K¨ zÐ1LÐMÔNØð ×ÑÑ*Ü˜×*Ñ*Ð,?ÀÓFÑRà×'Ñ'×9Ô9�Ù�(–ñ :ð 	×%Ñ%×,Ñ,¨XÔ6à×"Ñ"Ô$ØˆÔØ�	Š	�Q‰�	ð 	×$Ñ$Ü�H—N‘N¡NÓ3Ü�H×$Ñ$¡nÓ5õ	
r5   r†  c                 óž   • Uc  U R                  U R                  5      $ UR                  U :w  a  [        S5      e[	        XR
                  5      $ )az  Set the point at which create_node and companion methods will insert into the graph.
When used within a 'with' statement, this will temporary set the insert point and
then restore it when the with statement exits::

    with g.inserting_before(n):
        ...  # inserting before node n
    ...  # insert point restored to what it was previously
    g.inserting_before(n)  #  set the insert point permanently

Args:

    n (Optional[Node]): The node before which to insert. If None this will insert before
        the beginning of the entire graph.

Returns:
    A resource manager that will restore the insert point on ``__exit__``.
z&Node to insert before is not in graph.)Úinserting_afterr±   r—   ro   r”   r…  ©rb   r†  s     r6   Úinserting_beforeÚGraph.inserting_before  sD   € ð& ‰9Ø×'Ñ'¨¯
©
Ó3Ð3Ø�7‰7�d‹?Ü Ð!IÓJÐJÜ˜D§)¡)Ó,Ð,r5   c                 óž   • Uc  U R                  U R                  5      $ UR                  U :w  a  [        S5      e[	        XR
                  5      $ )av  Set the point at which create_node and companion methods will insert into the graph.
When used within a 'with' statement, this will temporary set the insert point and
then restore it when the with statement exits::

    with g.inserting_after(n):
        ...  # inserting after node n
    ...  # insert point restored to what it was previously
    g.inserting_after(n)  #  set the insert point permanently

Args:

    n (Optional[Node]): The node before which to insert. If None this will insert after
        the beginning of the entire graph.

Returns:
    A resource manager that will restore the insert point on ``__exit__``.
z%Node to insert after is not in graph.)r×  r±   r—   ro   r”   r‘  rÖ  s     r6   rÕ  ÚGraph.inserting_after  sD   € ð& ‰9Ø×(Ñ(¨¯©Ó4Ð4Ø�7‰7�d‹?Ü Ð!HÓIÐIÜ˜D§(¡(Ó+Ð+r5   Údefault_valuec                 óh   • U[         R                  R                  L a  SOU4nU R                  SXUS9$ )a�  
Insert a ``placeholder`` node into the Graph. A ``placeholder`` represents
a function input.

Args:

    name (str): A name for the input value. This corresponds to the name
        of the positional argument to the function this ``Graph`` represents.

    type_expr (Optional[Any]): an optional type annotation representing the
        Python type the output of this node will have. This is needed in some
        cases for proper code generation (e.g. when the function is used
        subsequently in TorchScript compilation).

    default_value (Any): The default value this function argument should take
        on. NOTE: to allow for `None` as a default value, `inspect.Signature.empty`
        should be passed as this argument to specify that the parameter does _not_
        have a default value.

.. note::
    The same insertion point and type expression rules apply for this method
    as ``Graph.create_node``.
r,   r%   )ræ   r®  )r  Ú	SignatureÚemptyr¼  )rb   r8   r®  rÛ  ræ   s        r6   r%   ÚGraph.placeholder3  s9   € ð< #¤g×&7Ñ&7×&=Ñ&=Ò=‰rÀMÐCSˆØ×Ñ ¨tÈ)ÐÐTÐTr5   r�  c                 óô   • S[         R                  R                  S[        S[        4S jnU R
                  (       a-  U" U R
                  U5      (       d  [        R                  " SSS9  U R                  SXS	9$ )
a  
Insert a ``get_attr`` node into the Graph. A ``get_attr`` ``Node`` represents the
fetch of an attribute from the ``Module`` hierarchy.

Args:

    qualified_name (str): the fully-qualified name of the attribute to be retrieved.
        For example, if the traced Module has a submodule named ``foo``, which has a
        submodule named ``bar``, which has an attribute named ``baz``, the qualified
        name ``foo.bar.baz`` should be passed as ``qualified_name``.

    type_expr (Optional[Any]): an optional type annotation representing the
        Python type the output of this node will have.


Returns:

    The newly-created and inserted ``get_attr`` node.

.. note::
    The same insertion point and type expression rules apply for this method
    as ``Graph.create_node``.
r‘  r�  rE   c                 ó   • UR                  S5      u  p#n U R                  U5      n[        XT5      (       d  g[        XT5      n[        U[        R                  R                  5      (       d9  [        U[        R                  R                  5      (       d  XER                  ;  a  gg! [         a    [        R                  " SU S35         gf = f)Nr‹   zFailed to fetch module rÄ  FT)Ú
rpartitionÚget_submoduleÚAttributeErrorrÌ  rÍ  r`  rR   r  r@   rT   rg  Ú	ParameterÚ_buffers)r‘  r�  Úmodule_pathrg   r8   ÚsubmodrŒ  s          r6   Ú_get_attr_reference_existsÚ2Graph.get_attr.<locals>._get_attr_reference_existsn  s°   € ð $2×#<Ñ#<¸SÓ#AÑ ˆK˜DðØ*-×*;Ñ*;¸KÓ*H�ô
 ˜6×(Ñ(Øä˜&Ó'ˆCô ˜s¤E§H¡H§O¡O×4Ñ4Ü" 3¬¯©×(:Ñ(:×;Ñ;Ø§¡Ó/ààøô! "ó Ü—’Ð 7¸°}ÀAÐFÔGÙðús   –B& Â&$CÃCa  Attempted to insert a get_attr Node with no underlying reference in the owning GraphModule! Call GraphModule.add_submodule to add the necessary submodule, GraphModule.add_parameter to add the necessary Parameter, or nn.Module.register_buffer to add the necessary bufferri   )Ú
stacklevelr#   r­  )	r@   rT   rg  r2   r  r�  rÌ  rÍ  r¼  )rb   r�  r®  ré  s       r6   r#   ÚGraph.get_attrT  sz   € ð4	Ü—‘—‘ð	Ü25ð	äô	ð2 ××Ñ&@Ø×Ñ ÷'
ñ '
ô �MŠMð#ð òð ×Ñ 
¨NÐÐPÐPr5   rV   c                 óª   • U R                   (       a2  U R                   R                  U5      c  [        R                  " S5        U R	                  SXX4S9$ )aO  
Insert a ``call_module`` ``Node`` into the ``Graph``. A ``call_module`` node
represents a call to the forward() function of a ``Module`` in the ``Module``
hierarchy.

Args:

    module_name (str): The qualified name of the ``Module`` in the ``Module``
        hierarchy to be called. For example, if the traced ``Module`` has a
        submodule named ``foo``, which has a submodule named ``bar``, the
        qualified name ``foo.bar`` should be passed as ``module_name`` to
        call that module.

    args (Optional[Tuple[Argument, ...]]): The positional arguments to be passed
        to the called method. Note that this should *not* include a ``self`` argument.

    kwargs (Optional[Dict[str, Argument]]): The keyword arguments to be passed
        to the called method

    type_expr (Optional[Any]): an optional type annotation representing the
        Python type the output of this node will have.

Returns:

    The newly-created and inserted ``call_module`` node.

.. note::
    The same insertion point and type expression rules apply for this method
    as :meth:`Graph.create_node`.
zœAttempted to insert a call_module Node with no underlying reference in the owning GraphModule! Call GraphModule.add_submodule to add the necessary submoduler$   r­  )r�  rã  rÌ  rÍ  r¼  )rb   rV   ræ   r   r®  s        r6   r$   ÚGraph.call_module˜  sV   € ðL ×× $×"4Ñ"4×"BÑ"BÀ;Ó"OÑ"WÜ�MŠMð&ôð ×ÑØ˜;¨fð  ð 
ð 	
r5   Úmethod_namec                 ó$   • U R                  SXX4S9$ )aÚ  
Insert a ``call_method`` ``Node`` into the ``Graph``. A ``call_method`` node
represents a call to a given method on the 0th element of ``args``.

Args:

    method_name (str): The name of the method to apply to the self argument.
        For example, if args[0] is a ``Node`` representing a ``Tensor``,
        then to call ``relu()`` on that ``Tensor``, pass ``relu`` to ``method_name``.

    args (Optional[Tuple[Argument, ...]]): The positional arguments to be passed
        to the called method. Note that this *should* include a ``self`` argument.

    kwargs (Optional[Dict[str, Argument]]): The keyword arguments to be passed
        to the called method

    type_expr (Optional[Any]): an optional type annotation representing the
        Python type the output of this node will have.

Returns:

    The newly created and inserted ``call_method`` node.

.. note::
    The same insertion point and type expression rules apply for this method
    as :meth:`Graph.create_node`.
r"   r­  ©r¼  )rb   rï  ræ   r   r®  s        r6   r"   ÚGraph.call_methodÊ  s$   € ðF ×ÑØ˜;¨fð  ð 
ð 	
r5   Úthe_function.c           	      ó&   • U R                  SXX5US9$ )aÏ  
Insert a ``call_function`` ``Node`` into the ``Graph``. A ``call_function`` node
represents a call to a Python callable, specified by ``the_function``.

Args:

    the_function (Callable[..., Any]): The function to be called. Can be any PyTorch
        operator, Python function, or member of the ``builtins`` or ``operator``
        namespaces.

    args (Optional[Tuple[Argument, ...]]): The positional arguments to be passed
        to the called function.

    kwargs (Optional[Dict[str, Argument]]): The keyword arguments to be passed
        to the called function

    type_expr (Optional[Any]): an optional type annotation representing the
        Python type the output of this node will have.

    name (Optional[str]): The name of the node. If not specified, set to None

Returns:

    The newly created and inserted ``call_function`` node.

.. note::
    The same insertion point and type expression rules apply for this method
    as :meth:`Graph.create_node`.
r!   )r8   r®  rñ  )rb   ró  ræ   r   r®  r8   s         r6   r!   ÚGraph.call_functionñ  s&   € ðL ×ÑØ˜\°Èið  ð 
ð 	
r5   c                 ó   • U $ r:   r,   rJ   s    r6   rÜ   ÚGraph.<lambda>  s   € ÑRSr5   r¡  Úarg_transformc                 óÒ  • [        UR                  U5      n[        UR                  U5      n[        U[        5      (       d  [        S[        U5       35      e[        U[        5      (       d  [        S[        U5       35      eU R                  UR                  UR                  X4UR                  UR                  5      n[        R                  " UR                  5      Ul        U$ )a÷  
Copy a node from one graph into another. ``arg_transform`` needs to transform arguments from
the graph of node to the graph of self. Example::

    # Copying all the nodes in `g` into `new_graph`
    g: torch.fx.Graph = ...
    new_graph = torch.fx.graph()
    value_remap = {}
    for node in g.nodes:
        value_remap[node] = new_graph.node_copy(node, lambda n: value_remap[n])

Args:

    node (Node): The node to copy into ``self``.

    arg_transform (Callable[[Node], Argument]): A function that transforms
        ``Node`` arguments in node's ``args`` and ``kwargs`` into the
        equivalent argument in ``self``. In the simplest case, this should
        retrieve a value out of a table mapping Nodes in the original
        graph to ``self``.
zExpected args to be tuple, got z Expected kwargs to be dict, got )r¦  ræ   r   r  r  ro   r    rˆ   r¼  r™  r‰   r8   r¯  r§  )rb   r¡  rø  ræ   r   Úresult_nodes         r6   r§  ÚGraph.node_copy  s´   € ô2 �t—y‘y -Ó0ˆÜ˜Ÿ™ mÓ4ˆÜ˜$¤×&Ñ&Ü Ð#BÄ4ÈÃ:À,Ð!OÓPÐPÜ˜&¤$×'Ñ'Ü Ð#CÄDÈÃLÀ>Ð!RÓSÐSØ×&Ñ&Ø�G‰G�T—[‘[ $°·	±	¸4¿9¹9ó
ˆô  Ÿ9š9 T§Y¡YÓ/ˆÔØÐr5   Úresultc                 ó(   • U R                  SSU4US9$ )aÝ  
Insert an ``output`` ``Node`` into the ``Graph``. An ``output`` node represents
a ``return`` statement in Python code. ``result`` is the value that should
be returned.

Args:

    result (Argument): The value to be returned.

    type_expr (Optional[Any]): an optional type annotation representing the
        Python type the output of this node will have.

.. note::

    The same insertion point and type expression rules apply for this method
    as ``Graph.create_node``.
r&   )r™  r‰   ræ   r®  rñ  )rb   rü  r®  s      r6   r&   ÚGraph.output@  s'   € ð& ×ÑØ °¨yÀIð  ð 
ð 	
r5   c                 óÜ   • [        U5      (       a  UR                  nOC[        U[        5      (       d  [	        S[        U5       35      eUn[        U5      (       a  USS n[        U5      nU$ )NzExpected target to be str, got ri   éþÿÿÿ)rã  r-   r  r2   ro   r    rK   rP   )rb   r‰   r™  s      r6   rº  ÚGraph._target_to_strW  sa   € Ü�F×ÑØ—‘‰Bä˜f¤c×*Ñ*Ü$Ð'FÄtÈFÃ|ÀnÐ%UÓVÐVØˆBÜ˜�}‰}Ø˜˜"�X�Ü˜‹_ˆØˆ	r5   rA  rH  rB  rC  rD  rE  r(  rF  rG  c                óØ   ^
^• [        5       m
S[        4U
4S jjm[        S[        4U4S jj5       n	U	" U 5         U R	                  UT
UUUUUUUS9	sSSS5        $ ! , (       d  f       g= f)a‰  
Turn this ``Graph`` into valid Python code.

Args:

    root_module (str): The name of the root module on which to look-up
        qualified name targets. This is usually 'self'.

Returns:

    A PythonCode object, consisting of two fields:
        src: the Python source code representing the object
        globals: a dictionary of global names in `src` -> the objects that they reference.
r†  c                 ó<   >• TR                  U R                  U 5      $ r:   )rv   r8   )r†  rI  s    €r6   Ú	node_reprÚ$Graph.python_code.<locals>.node_repr™  s   ø€ Ø×(Ñ(¨¯©°Ó3Ð3r5   r—   c              3   óæ   >#   • 0 nU R                    H  nUR                  X'   TUl        M      S v •  U R                    H  nX   Ul        M     g ! U R                    H  nX   Ul        M     f = f7fr:   )r  Ú_repr_fn)r—   Úorig_repr_fnsr¡  r  s      €r6   Úoverride_node_reprÚ-Graph.python_code.<locals>.override_node_reprœ  sh   øé € àˆMØŸœ�Ø&*§m¡m�Ñ#Ø )�–ñ $ð8Ø’
ð "ŸKœK�DØ$1Ñ$7�D–Mò (ø˜EŸKœK�DØ$1Ñ$7�D–Mò (üs   ƒ+A1¯A ³A1ÁA.Á.A1rA  N)rZ   r   r   r   Ú_python_code)rb   rH  rB  rC  rD  rE  r(  rF  rG  r	  rI  r  s             @@r6   Úpython_codeÚGraph.python_codec  sx   ù€ ô^ “Lˆ	ð	4œ÷ 	4ô 
ð
	8¤eö 
	8ó 
ð
	8ñ   Õ%Ø×$Ñ$ØØØØ-Ø-ØØ)Ø'Ø /ð %ð 
÷ &×%×%ús   ºAÁ
A)rI  c                óZ   • U R                   R                  U R                  UUUUUUUUU	S9
$ )NrA  )rŠ  r  r  )
rb   rH  rI  rB  rC  rD  rE  r(  rF  rG  s
             r6   r  ÚGraph._python_code¶  sB   € ð �}‰}×-Ñ-Ø�J‰JØØØØ)Ø)ØØ%Ø#Ø+ð .ð 
ð 	
r5   c                 óÜ   • / nS/nU R                    Vs/ s H  o3R                  U5      PM     nnSR                  U5      nSU SUS    S3nU H  nU(       d  M  USU-   -  nM     U$ s  snf )zT
Return a human-readable (not machine-readable) string representation
of this Graph
rè   r-  zgraph(rþ   r   rÅ   r  )r  Úformat_noderð   )rb   Úplaceholder_namesÚmaybe_return_typenamer¡  Ú	node_strsÚ	param_strrL   Únode_strs           r6   Ú__str__ÚGraph.__str__Ð  s‹   € ð
 (*Ðð -/¨4ÐàEIÇZÂZÓPÂZ¸T×%Ñ%Ð&7Ö8ÁZˆ	ÐPØ—I‘IÐ/Ó0ˆ	Ø�Y�K˜qÐ!6°qÑ!9Ð :¸!Ð<ˆÛ!ˆHßˆxØ�X Ñ(Ñ(’ñ "ð ˆùò Qs   ”A)c                 ó  •  SSK J n  U R                   Vs/ s H;  o"R                  UR
                  UR                  UR                  UR                  /PM=     nn[        U" U/ SQS95        g! [         a    [        S5        e f = fs  snf )z�
Prints the intermediate representation of the graph in tabular
format. Note that this API requires the ``tabulate`` module to be
installed.
r   )ÚtabulatezŽ`print_tabular` relies on the library `tabulate`, which could not be found on this machine. Run `pip install tabulate` to install the library.)Úopcoder8   r‰   ræ   r   )ÚheadersN)	r  ÚImportErrorÚprintr  r™  r8   r‰   ræ   r   )rb   r  r†  Ú
node_specss       r6   Úprint_tabularÚGraph.print_tabularâ  s~   € ð	Ý)ð KOÏ*Ê*ÓUÊ*ÀQ—t‘t˜QŸV™V Q§X¡X¨q¯v©v°q·x±xÓ@É*ˆ
ÐUÜÙ�ZÒ)WÑXõ	
øô ó 	Üð<ôð
 ð	üò Vs   ‚A- –ABÁ-Bc                 ó  ^ ^• SS[         S[        [            SS4UU 4S jjjn[        5       n[        5       mT R                   Hà  nUR                  [
        ;  a  [        SU SUR                   S35      eUR                  T La  [        S	U S
35      eUT R                  ;  a  [        S	U S35      eUR                   H  nU" XC5        M     TR                  U5        UR                  U;   a  [        SUR                   S35      eUR                  UR                  5        Mâ     T R                  (       GaÈ  T R                   GH¶  nUR                  S:X  aX  [        UR                  5      (       d=  [        SU SUR                   S[         R"                  " UR                  5       S35      eO\[%        UR                  [&        5      (       d=  [        SU SUR                   S[         R"                  " UR                  5       S35      eUR                  S;   d  MÚ  UR                  R)                  S5      nT R                  n[+        U5       H¦  u  px[-        XhS5      n	SR/                  USU 5      n
U	c!  [        SU SUR                   SU SU
 35      eUR                  S:X  aK  [%        U	[         R0                  R2                  5      (       d"  [        SU SUR                   SU SU
 S3	5      eU	nM¨     GM¹     gg)a  
Runs various checks on this Graph to make sure it is well-formed. In
particular:
- Checks Nodes have correct ownership (owned by this graph)
- Checks Nodes appear in topological order
- If this Graph has an owning GraphModule, checks that targets
exist in that GraphModule
Nrì   r†  rE   c                 óž   >• U(       a  SU S3OSnU R                   TLa  [        SU  SU ST 35      eU T;  a  [        SU  SU ST 35      eg )Nz
 of Node 'z' r¤  z
Argument 'r:  z«does not belong to this Graph, but was used as an argument! If you are copying nodes from another graph, make sure to use ``arg_transform`` on node_copy() to remap values
zdwas used before it has been defined! Please check that Nodes in the graph are topologically ordered
)r—   rÊ  )rì   r†  Úcontext_strÚseen_valuesrb   s      €€r6   Ú	check_argÚGraph.lint.<locals>.check_arg  sˆ   ø€ Þ01˜J q c¨Ñ,°sˆKØ�y‰y Ò$Ü"Ø    Q { mð 4UàUYÐTZð\óð ð
 ˜+Ó%Ü"Ø    Q { mð 4`Ø`dÐ_eðgóð ð &r5   zNode z had unknown opcode rÄ  zNode 'z ' does not belong to this Graph!z ' is not added to the side tablezNode redefined name r!   z target z
 has type z but a Callable is expectedz but a str is expected)r#   r$   r‹   z" references nonexistent attribute z of r$   r¤  z  does not reference an nn.Moduler:   )r   r   r^   r  r™  Ú
_legal_opsrÊ  r—   rŒ  r   rs   r8   r�  rã  r‰   Ú
ValueErrorr@   ra  r  r2   r�   r  rR   rð   rT   rg  )rb   r&  Ú
seen_namesr¡  rì   Útarget_atomsÚm_itrr  ÚatomÚ	new_m_itrÚseen_qualnamer%  s   `          @r6   ÚlintÚ
Graph.lintø  sÜ  ù€ ñ	œ4ð 	¤H¬T¡Nð 	¸d÷ 	ñ 	ô  #›uˆ
Ü!$£ˆØ—J”JˆDØ�w‰wœjÓ(Ü" U¨4¨&Ð0DÀTÇWÁWÀIÈQÐ#OÓPÐPØ�z‰z Ò%Ü" V¨D¨6Ð1QÐ#RÓSÐSØ˜4×8Ñ8Ó8Ü" V¨D¨6Ð1QÐ#RÓSÐSØ×(Ô(�Ù˜#Ö$ñ )à�O‰O˜DÔ!à�y‰y˜JÓ&Ü"Ð%9¸$¿)¹)¸ÀAÐ#FÓGÐGØ�N‰N˜4Ÿ9™9Ö%ñ ð  ××ÐØŸ
�
�Ø—7‘7˜oÓ-Ü# D§K¡K×0Ñ0Ü(Ø# D 6¨°$·+±+°¸jÌÏÊÐX\×XcÑXcÓIdÐHeð f5ð 5óð ð 1ô & d§k¡k´3×7Ñ7Ü(Ø# D 6¨°$·+±+°¸jÌÏÊÐX\×XcÑXcÓIdÐHeð f0ð 0óð ð —7‘7Ð9Õ9à#'§;¡;×#4Ñ#4°SÓ#9�LØ ×.Ñ.�EÜ#,¨\Ö#:™˜Ü$+¨E¸Ó$>˜	Ø(+¯©°¸b¸qÐ1AÓ(B˜Ø$Ñ,Ü".Ø"'¨ v¨X°d·k±k°]ÐBdØ#' &¨¨]¨Oð!=ó#ð ð  Ÿ7™7 mÓ3¼JØ%¤u§x¡x§¡÷=ñ =ô #/Ø"'¨ v¨X°d·k±k°]À!ÀDÀ6ÈÈmÈ_ð ]=ð !=ó#ð ð
 !*šô! $;ò# #ð r5   Úis_impure_nodec                 óŒ  ^^
• SSK Jn  U R                  5         Sm
[        R                  R
                  R                  5       (       a$  [        R                  R                  R                  m
U
U4S jn[        5       n[        U R                  5       HY  nU" U5      (       a  M  [        UR                  5      S:X  d  M-  U R                  U5        UR!                  UR"                  5        M[     [        U5      S:„  nU(       a  [$        R'                  SU5        U R(                  b�  U" S U R+                  SS9 5       5      nU R(                  R-                  5        Hc  u  p‰X‡;   d  M  [/        U	[        R0                  R2                  5      (       d  M7  XiR4                  R7                  5       -  nU	R9                  5         Me     U$ )	aê  
Remove all dead code from the graph, based on each node's number of
users, and whether the nodes have any side effects. The graph must be
topologically sorted before calling.

Args:
    is_impure_node (Optional[Callable[[Node], bool]]): A function that returns
    whether a node is impure. If this is None, then the default behavior is to
    use Node.is_impure.

Returns:
  bool: Whether the graph was changed as a result of the pass.

Example:

Before dead code is eliminated, `a` from `a = x + 1` below has no users
and thus can be eliminated from the graph without having an effect.

.. code-block:: python

    def forward(self, x):
        a = x + 1
        return x + self.attr_1

After dead code is eliminated, `a = x + 1` has been removed, and the rest
of `forward` remains.

.. code-block:: python

    def forward(self, x):
        return x + self.attr_1

.. warning::

    Dead code elimination has some heuristics to avoid removing
    side-effectful nodes (see Node.is_impure) but in general coverage
    is very bad, so you should assume that this method is not sound
    to call unless you know that your FX graph consists entirely
    of functional operations or you supply your own custom
    function for detecting side-effectful nodes.
r   )Ú
OrderedSetTc                 ó<   >• Tb  T" U 5      $ U R                  T5      $ r:   )Ú	is_impure)r¡  Úimpure_randomr2  s    €€r6   Úhas_side_effectÚ2Graph.eliminate_dead_code.<locals>.has_side_effect  s#   ø€ ØÑ)Ù% dÓ+Ð+Ø—>‘> -Ó0Ð0r5   z1The following nodes were dead code eliminated: %sc              3   ó8   #   • U  H  oR                   v •  M     g 7fr:   r|  r2  s     r6   rí   Ú,Graph.eliminate_dead_code.<locals>.<genexpr>“  s   é € ð (Ú"@˜Q—–Ò"@ùr  r#   )r™  )Útorch.utils._ordered_setr4  r0  r@   Ú_guardsÚTracingContextÚtry_getÚ	_inductorÚconfigÚfallback_randomr^   rÿ  r  rÒ   rš  rÒ  rs   r8   ÚlogÚinfor�  r~  Únamed_childrenr  r  r    r—   Úeliminate_dead_codeÚ	recompile)rb   r2  r4  r8  Úremoved_nodesr¡  ÚchangedÚsubgraph_namesÚ
child_nameÚchild_moduler7  s    `        @r6   rF  ÚGraph.eliminate_dead_codeH  sa  ù€ õZ 	8ð 	�	‰	ŒàˆÜ�=‰=×'Ñ'×/Ñ/×1Ñ1Ü!ŸO™O×2Ñ2×BÑBˆMö	1ô ›ˆÜ˜TŸZ™ZÖ(ˆDÙ" 4×(Ó(¬S°·±«_ÀÕ-AØ—‘ Ô%Ø×!Ñ! $§)¡)Ö,ñ )ô
 �mÓ$ qÑ(ˆÞÜ�H‰HÐHÈ-ÔXð ×ÑÑ)Ù'ñ (Ø"&§/¡/°Z /Ñ"@ó(ó ˆNð -1×,>Ñ,>×,MÑ,MÖ,OÑ(�
ð Õ/´JØ ¤%§(¡(×"6Ñ"6÷5ó 5ð ×1Ñ1×EÑEÓGÑG�GØ ×*Ñ*Ö,ñ -Pð ˆr5   Úcodegenc                 ó   • Xl         g r:   )rŠ  )rb   rN  s     r6   Úset_codegenÚGraph.set_codegen¡  s   € à�r5   Úmake_transformerc                 ó¢   ^ ^• T R                   R                  mU" T5      T R                   l        [        R                  UU 4S j5       nU" 5       $ )a­  Register a transformer function when python code is generated

Args:
    make_transformer (Callable[[Optional[TransformCodeFunc]], TransformCodeFunc]):
        a function that returns a code transformer to be registered.
        This function is called by `on_generate_code` to obtain the
        code transformer.

        This function is also given as its input the currently
        registered code transformer (or None if nothing is registered),
        in case it is not desirable to overwrite it. This is useful to
        chain code transformers together.

Returns:
    a context manager that when used in a `with` statement, to automatically
    restore the previously registered code transformer.

Example:

.. code-block:: python


    gm: fx.GraphModule = ...


    # This is a code transformer we want to register. This code
    # transformer prepends a pdb import and trace statement at the very
    # beginning of the generated torch.fx code to allow for manual
    # debugging with the PDB library.
    def insert_pdb(body):
        return ["import pdb; pdb.set_trace()\n", *body]


    # Registers `insert_pdb`, and overwrites the current registered
    # code transformer (given by `_` to the lambda):
    gm.graph.on_generate_code(lambda _: insert_pdb)

    # Or alternatively, registers a code transformer which first
    # runs `body` through existing registered transformer, then
    # through `insert_pdb`:
    gm.graph.on_generate_code(
        lambda current_trans: (
            lambda body: insert_pdb(
                current_trans(body) if current_trans else body
            )
        )
    )

    gm.recompile()
    gm(*inputs)  # drops into pdb


This function can also be used as a context manager, with the benefit to
automatically restores the previously registered code transformer:

.. code-block:: python

    # ... continue from previous example

    with gm.graph.on_generate_code(lambda _: insert_pdb):
        # do more stuff with `gm`...
        gm.recompile()
        gm(*inputs)  # drops into pdb

    # now previous code transformer is restored (but `gm`'s code with pdb
    # remains - that means you can run `gm` with pdb here too, until you
    # run next `recompile()`).
c               3   óf   >#   •  S v •  T TR                   l        g ! T TR                   l        f = f7fr:   )rŠ  rã   )Úon_gen_code_oldrb   s   €€r6   Ú on_generate_code_context_managerÚ@Graph.on_generate_code.<locals>.on_generate_code_context_managerñ  s'   øé € ðBÛà2A�—‘Õ/ø°/�—‘Õ/üs   ƒ1… ‰1›.®1)rŠ  rã   Ú
contextlibr   )rb   rR  rV  rU  s   `  @r6   Úon_generate_codeÚGraph.on_generate_code¥  sK   ù€ ðR Ÿ-™-×9Ñ9ˆÙ*:¸?Ó*Kˆ�‰Ô'ä	×	"Ñ	"õ	Bó 
#ð	Bñ 0Ó1Ð1r5   c                 ó’   • [        U R                  5       H.  nUR                  R                  5         U R	                  U5        M0     g r:   )rÿ  r  r§  ÚclearrÒ  ro  s     r6   Ú_clear_nodesÚGraph._clear_nodesú  s/   € Ü˜TŸZ™ZÖ(ˆDØ�I‰I�O‰OÔØ�O‰O˜DÖ!ò )r5   )r‹  rŠ  rŒ  r†  r˜   r­   r‡  r±   rˆ  r‰  r_   )NNN)Fr:   )rE   r   )NNNN)rE   N):r-   r.   r/   r0   r1   r   r   r    rˆ   r2   r	   rc   Úpropertyr�  Úsetterr¦   r  r   r˜  r  r~  rª  r¶  r  r¼  r8  r<  rÒ  r×  rÕ  r  rÝ  rÞ  r%   r#   r$   r"   r   r!   r§  r&   r   rº  r¼   r   r  rZ   r  r  r   r0  rF  r   rP  ÚTransformCodeFuncrY  r]  r4   r,   r5   r6   r   r   Õ  s  † ñ-ñ^ ¨$Ñ/ð 26Ø/3Ø26ñ	@à Ñ.ð@ð ˜T (™^Ñ,ð@ð    S¨# X¡Ñ/ô	@ó 0ð@ð* ñ#ó ð#ð ×Ñð" ¨-Ñ!8ó "ó ð"ð ð �zó  ó ð ñ ¨%Ñ0ð˜Tó ó 1ðñ ¨%Ñ0à7;È$òØðØ"*¨8Ñ"4ðØCGôó 1ðñ2 ¨$Ñ/àHMñØðØ#'¨¨d¨
Ñ#3ðà	ôó 0ðö8ñ6 ¨$Ñ/ð
 26Ø26Ø"Ø#'ñ>àð>ð ð>ð �u˜_Ñ-Ñ.ð	>ð
 ˜˜c :˜oÑ.Ñ/ð>ð �s‰mð>ð ˜C‘=ð>ð 
ô>ó 0ð>ñ@ ¨%Ñ0ñ3ó 1ð3ñ ¨%Ñ0ñ2ó 1ð2ñ ¨$Ñ/ð&
 4ð &
¨Dó &
ó 0ð&
ñP ¨$Ñ/ñ- (¨4¡.ô -ó 0ð-ñ0 ¨$Ñ/ñ, ¨$¡ô ,ó 0ð,ñ0 ¨$Ñ/ð $(Ø$×.Ñ.×4Ñ4ñ	UàðUð ˜C‘=ðUð ð	Uð
 
ôUó 0ðUñ@ ¨$Ñ/ñAQ sð AQ°xÀ±}ð AQÐPTô AQó 0ðAQñF ¨$Ñ/ð 26Ø26Ø#'ñ/
àð/
ð �u˜_Ñ-Ñ.ð/
ð ˜˜c :˜oÑ.Ñ/ð	/
ð
 ˜C‘=ð/
ð 
ô/
ó 0ð/
ñb ¨$Ñ/ð 26Ø26Ø#'ñ$
àð$
ð �u˜_Ñ-Ñ.ð$
ð ˜˜c :˜oÑ.Ñ/ð	$
ð
 ˜C‘=ð$
ð 
ô$
ó 0ð$
ñL ¨$Ñ/ð 26Ø26Ø#'Ø"ñ'
à˜s C˜xÑ(ð'
ð �u˜_Ñ-Ñ.ð'
ð ˜˜c :˜oÑ.Ñ/ð	'
ð
 ˜C‘=ð'
ð �s‰mð'
ð 
ô'
ó 0ð'
ñR ¨$Ñ/áHSñ"Øð"Ø)1°4°&¸*Ð2DÑ)Eð"à	ô"ó 0ð"ñH ¨$Ñ/ñ
˜Zð 
°H¸S±Mô 
ó 0ð
ð,
 X¨fÑ%5ð 
¸#ô 
ñ ¨$Ñ/ð
 Ø$Ø$ØØ"Ø!Ø/3òPàðPð ð	Pð
 ðPð ðPð ðPð ðPð ðPð " $ s¡)Ñ,ðPð 
ôPó 0ðPðn Ø$Ø$ØØ"Ø!Ø/3ò
àð
ð ð
ð
 ð
ð ð
ð ð
ð ð
ð ð
ð ð
ð " $ s¡)Ñ,ð
ð 
õ
ð4˜ô ñ$ ¨$Ñ/ñ
ó 0ð
ñ* ¨$Ñ/ñM*ó 0ðM*ñ^ ¨$Ñ/àAEñVØ& x°°¸°Ñ'=Ñ>ðVà	ôVó 0ðVñp ¨%Ñ0ð  7ó  ó 1ð ñ ¨%Ñ0ðR2à" HÐ->Ñ$?Ð#@ÐBSÐ#SÑTóR2ó 1ðR2÷h"r5   r   ÚoverriderÞ   c              #   ó‚   #   • [         R                  n U [         l        S v •  U[         l        g ! U[         l        f = f7fr:   )r   rß   )rb  Útmps     r6   Ú_override_sym_reprre   	  s2   é € ô ×
Ñ
€Cð Ø$ŒÔÛàŒÕø˜CŒÕüs   ‚?”/ £?¯<¼?c                 ó   • U $ r:   r,   rJ   s    r6   rþ  rþ  	  s   € Ø€Hr5   c                 ó   ^ • U 4S jnU$ )Nc                 ó   >• SnT U  U 3$ )Nz[0mr,   )rL   ÚresetrÃ   s     €r6   r»  Ú_make_color_fn.<locals>.f	  s   ø€ ØˆØ�˜�s˜5˜'Ð"Ð"r5   r,   )rÃ   r»  s   ` r6   Ú_make_color_fnrk  	  s   ø€ õ#ð €Hr5   z[33mz[36mz[32mz[34mz[31mz[2mz	[2m[34mz	[2m[32m)ÚyellowÚcyanÚgreenrj  rf  rh  ri  rg  z# COUNTER: (\d+)z{} + {}z{} - {}z{} * {}z{} // {}z{} / {}z{} % {}z{} ** {}z{} << {}z{} >> {}z{} & {}z{} | {}z{} ^ {}z{}[{}]z{} @ {})rs   rm   ÚmulÚfloordivÚtruedivÚdivr‘  ÚpowÚlshiftÚrshiftÚand_Úor_ÚxorÚgetitemÚmatmulz{} == {}z{} != {}z{} < {}z{} > {}z{} <= {}z{} >= {}z+{}z-{}z~{})	ÚeqÚneÚltÚgtÚleÚgeÚposÚnegÚinvertz{} += {}z{} &= {}z	{} //= {}z	{} <<= {}z{} %= {}z{} *= {}z{} @= {}z{} |= {}z	{} **= {}z	{} >>= {}z{} -= {}z{} /= {}z{} ^= {}z{}[{}] = {})ÚiaddÚiandÚ	ifloordivÚilshiftÚimodÚimulÚimatmulÚiorÚipowÚirshiftÚisubÚitruedivÚixorÚsetitemr:   )ÚbuiltinsrX  r¯  rw  Ú	functoolsr  ÚkeywordÚloggingÚmathrû  rà  rÎ   r[  r]  rÌ  Úcollectionsr   Úcollections.abcr   r   r   r   Údataclassesr   r	   r
   r   r   r   r@   Útorch.utils._pytreeÚutilsr   rC   Útorch._Cr   r¦  r   Útorch._library.opaque_objectr   r   Útorch.utils._dtype_abbrsr   rè   rB   Ú_compatibilityr   Úimmutable_collectionsr   r¡  r   r   r   r   r   Ú	getLoggerr-   rC  Ú__all__Ú_symbolic_tracer   Úgraph_moduler    r¼   ÚListrˆ   ÚDictr^   ÚSetÚ	frozensetÚ	FrozenSetr  ÚTupler_  Úfromkeysr(  r2   ra  r(   ÚkwlistÚobjectr;   ÚupdateÚ__dict__r7   r3   r<   r=   r>   r    rA   r  rK   rP   ÚpartialrÏ   rm   rN   rl   rj   Ú	fullmatchrS   rX   rZ   r   r’   r”   r¦   r¸   rÀ   rØ   r   r  r!  rT  ri  r   re  rþ  rk  Ú_color_codesr  rý  r  Úreflectable_magic_methodsrä  ræ  )r"  r#  s   00r6   Ú<module>r´     sç  ðä Û Û Û Û Û Û Û Û Û 	Û Û 	Û Û Û Ý #ß 8Ñ 8Ý %Ý !ß DÕ Dã ß $Ð $ß 6ß RÝ 0å "Ý )Ý 1ß IÕ Ið ×Ò˜Ó!€â
,€æÝ'Ý)ð 	ˆ&�+‰+Øˆ&�+‰+Øˆ�‰Øˆv×ÑØ	ˆ6�<‰<ðÐ ð �]‰]ÚXó€
ð ˜d 3™i˜[¨$¨s©)Ð3Ñ4Ð ô�Zô ð (/§~¢~Ó6¢~ !‘V“X’+¡~Ñ6€Ø × Ñ �h×'Ñ'Ô (à.0Ð �$�s˜NÐ*Ñ+Ó 0ð 3ð °Cð ¸cô ñ
 ˜Ð 6¸¿¹Ô AÙ ˜Ð 6¸¿¹Ô AÙ ˜Ð%<¹dÀ4»jÔ IÙ ˜ .°%Ô 8Ù ˜Ð#=¸u¿|¹|Ô LÙ ˜Ð&LÈiÔ XÙ ˜Ð#IÈ6Ô Rð3�ð 3˜ô 3ð	&�3ð 	&˜3ô 	&ð ×#Ò# B§J¢JÐ/CÓ$D×$HÑ$HÈ&ÓQ€ð —j’jÐ!1Ó2Ð ð �jŠjÐBÓC€ð Ÿ
š
Ø3óç�)ð ð
˜ð  ô ÷K#ñ K#ñ\  dÑ+Ø
÷ð ó ó ,ðð ˜ð  cð ¨cô ÷	.ñ 	.÷Yñ Yô&(�*ô (ñ �$Ñ÷Tð Tó ðTð  NRñØðØ!)¨(°C¸¸c°?ÀDÐ3HÑ*IÑ!Jõñ2  eÑ,÷I

ð I

ó -ðI

ôd#�Gô #ôLvE�Wô vEôr+I�^ô +I÷\ Rñ  RñF  dÑ+÷g"ð g"ó ,ðg"ðT! ð ØÐ/Ð0°#Ð5Ñ6ð àˆd�^ó ó ð òòð ØØØØØØ!Ø"ñ	€ð 0<×/AÑ/AÔ/CÔDÒ/C¡t qˆa‘ Ó"Ò"Ñ/CÒD€
Ø—*’*Ð0Ó1€ð ØØØØØØØØØØØØØØñÐ ð& Ø
Ø
Ø
Ø
Ø
ØØØñð  ð€ð ØØØØØØØØØØØØØñ�ùòmG 7ùófF Es   ÅO#ÎO(