+
    –°³jMA  ã                  ó  a € 0 t $ ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	 ^ RI
Ht ^ RIHtHt ^ RIHtHt ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHu Ht ^ RIHt ^ RIHt ^ R	IH t  ^R
I!H"t"H#t#H$t$ ^RI%H&t& ^RI'H(t(H)t)H*t* ]'       d   ^ RI+H,t,H-t-H.t. ^ RI/H0t0 ^ RI1H2t2 ]! R4      t3]! R4      t4]Pj                  ! ]64      t7R R lt8]	R R l4       t9]$R R l4       t:R4R R llt;R R lt<]$R R l4       t= ! R R]P|                  4      t?]$R  R! l4       t@]$R" R# l4       tAR$ R% ltB]P†                  Pˆ                  tD]DPŠ                  ]DPŒ                  ]DPŽ                  ]DP�                  ]DP’                  ]DP”                  ]DP–                  ]DP˜                  ]DPš                  ]DPœ                  ]DPž                  ]DP                   ]DP¢                  ]DP¤                  P¦                  ]DP¤                  P¨                  ]DPª                  ]DP¬                  ]DP®                  ]DP°                  ]DP²                  ]DP´                  ]DP¶                  0t\]! ]\4      t\]$R& R' l4       t]R( R) lt^R* R+ lt_^ s`R,]aR-&   R. R/ ltbR0 R1 ltcR5R2 R3 lltdR# )6é    )ÚannotationsN)Úcontextmanager)Úpartial)ÚAnyÚTYPE_CHECKING)Ú	ParamSpecÚTypeVar)ÚSymInt)Úget_decompositions)Úbind_symbols)Úaot_functionÚ
aot_moduleÚmake_boxed_compiler)Ústrip_overloads)Údefault_partitionÚ
draw_graphÚ#min_cut_rematerialization_partition)ÚCallableÚ	GeneratorÚSequence)ÚNode)ÚIntLikeTypeÚ_PÚ_Rc               ó    € V ^8„  d   QhRRRR/# )é   Úfx_gúfx.GraphModuleÚreturn© )Úformats   "Ú[/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/_functorch/compilers.pyÚ__annotate__r#   /   s   € ÷ ñ ˜ð ¨>ñ ó    c                ó  € V P                   P                  R \        P                  P                  P
                  R7       F,  p\        P                  P                  P                  Vn        K.  	  V P                  4        V # )Úcall_function©ÚopÚtarget)	ÚgraphÚ
find_nodesÚtorchÚopsÚatenÚ_to_copyÚtor)   Ú	recompile)r   Únodes   & r"   Ú_canonicalizer3   /   s[   € Ø—
‘
×%Ñ%Ø¤5§9¡9§>¡>×#:Ñ#:ð &ö ˆô —i‘i—n‘n×'Ñ'ˆŽñð 	‡N�NÔØ€Kr$   c               ó   € V ^8„  d   QhRR/# )r   r   zGenerator[None, None, None]r    )r!   s   "r"   r#   r#   9   s   € ÷ ?ñ ?Ð:ñ ?r$   c               #  óÜ   "  € \         P                  P                  R 4      p  Rx € \         P                  P                  V 4       R#   \         P                  P                  T 4       i ; i5i)FN)r,   Ú_CÚ_jit_set_autocast_mode)Úold_jit_autocast_flags    r"   Ú_disable_jit_autocastr9   8   sL   é € ô "ŸH™H×;Ñ;¸EÓBÐð?Ûô 	�‰×'Ñ'Ð(=Ö>øŒ�‰×'Ñ'Ð(=Õ>üs   ‚ A,£A §!A,Á!A)Á)A,c               ó$   € V ^8„  d   QhRRRRRR/# )r   r   r   ÚinpszSequence[Any]r   útorch.jit.ScriptModuler    )r!   s   "r"   r#   r#   D   s"   € ÷ 0ñ 0�^ð 0¨=ð 0Ð=Sñ 0r$   c                óö  € ^ RI Hp V! V 4      p \        4       ;_uu_ 4        \        V 4       V P                  P                  R\        P                  P                  P                  R7       Fw  p\        VP                  4      ^8X  g   K  \        VP                  4      ^8X  g   K;  RVP                  9   g   KN  \        P                  P                  P                  Vn        Ky  	  V P                  P                   F^  p/ pVP                  P!                  4        F5  w  rV\#        V\        P$                  4      '       d   VP&                  pWdV&   K7  	  WCn        K`  	  V P                  P)                  4        V P+                  4        \        P,                  P/                  V 4      p\        P0                  P3                  VP                  4       \        P,                  P5                  VP7                  4       4      p\        P,                  P9                  V4      p\:        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       g   V! V!   RRR4       V#   + '       g   i     X# ; i)	zæ
Compiles the :attr:`fx_g` with Torchscript compiler.

.. warning::
    This API is experimental and likely to change.

Args:
    fx_g(fx.GraphModule): The input Fx graph module to be compiled.

Returns:
    Torch scripted model.
)Ú_unwrap_lazy_graph_moduler&   r'   Údtypec              3  ót   "  € T F.  p\         P                  P                  P                  V4      x € K0  	  R # 5i©N)r,   Ú_subclassesÚfake_tensorÚis_fake_tensor)Ú.0Úts   & r"   Ú	<genexpr>Úts_compile.<locals>.<genexpr>r   s*   é € ÐQÉDÀq”5×$Ñ$×0Ñ0×?Ñ?À×BÐBËDùs   ‚68TFN)Útorch.fx._lazy_graph_moduler>   r9   r   r*   r+   r,   r-   r.   r/   ÚlenÚargsÚkwargsr0   r)   ÚnodesÚitemsÚ
isinstanceÚdeviceÚtypeÚlintr1   ÚjitÚscriptr6   Ú_jit_pass_remove_mutationÚfreezeÚevalÚoptimize_for_inferenceÚany)r   r;   r>   r2   Ú
new_kwargsÚkÚvÚfs   &&      r"   Ú
ts_compiler^   C   sª  € õ Fá$ TÓ*€Dä	×	 Õ	 Ü˜Ôà—J‘J×)Ñ)Ø¤u§y¡y§~¡~×'>Ñ'>ð *ö 
ˆDô �4—9‘9‹~ Ö"¤s¨4¯;©;Ó'7¸1Ö'<ÀÈDÏKÉKÖAWÜ#Ÿi™iŸn™n×/Ñ/�–ñ	
ð —J‘J×$Ô$ˆDØˆJØŸ™×)Ñ)Ö+‘�Ü˜a¤§¡×.Ò.ØŸ™�AØ !˜1“ñ ,ð %ŽKñ %ð 	�
‰
�‰Ôà�‰Ôä�I‰I×Ñ˜TÓ"ˆô 	�‰×*Ñ*¨1¯7©7Ô3ä�I‰I×Ñ˜QŸV™V›XÓ&ˆÜ�I‰I×,Ñ,¨QÓ/ˆß‹sÑQÉDÓQ�s�sŠsÑQÉDÓQ×QÒQÙˆtŠH÷; 
!ð< €H÷= 
!Ö	 ð< €Hús1   ¡A%I'ÂI'Â'I'Â:E-I'È(I'È<I'ÉI'É'I8	c          
     ó,   € V ^8„  d   QhRRRRRRRRR	R/# )
r   r   r   Ú_r   ÚnameÚstrÚ
clear_metaÚboolr   r    )r!   s   "r"   r#   r#   w   s4   € ÷ ñ Ø
ðØ ðØ(+ðØ9=ðàñr$   c                óJ   € \        V P                  4       \        WVR 7       V # ))rc   )ÚprintÚcoder   )r   r`   ra   rc   s   &&&&r"   Ú_draw_graph_compilerh   w   s   € ô 
ˆ$�)‰)ÔÜˆt jÕ1Ø€Kr$   c               ó    € V ^8„  d   QhRRRR/# )r   ra   rb   r   z5Callable[[fx.GraphModule, list[Any]], fx.GraphModule]r    )r!   s   "r"   r#   r#      s    € ÷ Hñ HØ
ðHà:ñHr$   c                ó6   € \        \        \        V R 7      4      # )©ra   )r   r   rh   rk   s   &r"   Údraw_graph_compilerl      s   € ô œwÔ':ÀÔFÓGÐGr$   c               ó$   € V ^8„  d   QhRRRRRR/# ©r   r   r   r`   r   r   r    )r!   s   "r"   r#   r#   †   s!   € ÷ 	ñ 	ˆnð 	 ð 	¨ñ 	r$   c                ó   € V # )z²
Returns the :attr:`fx_g` Fx graph module as it is. This is a no-op compiler
and can be used to check accuracy.

.. warning::
    This API is experimental and likely to change.

r    ©r   r`   s   &&r"   Únoprq   …   s	   € ð €Kr$   c                  óL   a € ] tR t^’tRRRR/R V 3R llltR V 3R lltR	tV ;t# )
ÚDebugInterpreterÚinitial_envNÚenable_io_processingTc               ó(   € V ^8„  d   QhRRRRRRRR/# )r   rK   r   rt   zdict[Node, Any] | Noneru   rd   r   r    )r!   s   "r"   r#   ÚDebugInterpreter.__annotate__“   s2   € ÷ 
ñ 
àð
ð ,ð
ð #ð	
ð
 
ñ
r$   c               	ó`   <€ \        V P                  .VO5!  V n        \        SV `  ! VR VRV/ # )rt   ru   )r   ÚmoduleÚsymbol_mappingÚsuperÚrun)Úselfrt   ru   rK   Ú	__class__s   &$$*€r"   r|   ÚDebugInterpreter.run“   sI   ø€ ô +à�K‰Kð
ð ó
ˆÔô
 ‰wŠ{Øð
Ø*ð
ØAUñ
ð 	
r$   c               ó    € V ^8„  d   QhRRRR/# )r   Únr   r   r   r    )r!   s   "r"   r#   rw   ¢   s   € ÷ 5ñ 5˜$ð 5 3ñ 5r$   c                	óD  <a a
aaa€ R  V 3R lloR V3R lloR V3R llo
R V
V3R llp\         SS `  V4      pRVP                  9   dÕ   \        P                  ! VP                  R,          4      w  rE\        P                  ! V4      w  rg\        V4      \        V4      8w  d#   \        \        V4       R	\        V4       24      h\        \        \        V4      4      WF4       F6  w  or‰\        V	\        P                  4      '       g   K(  V! W‰VV 3R
 l4       K8  	  V# )c               ó    € V ^8„  d   QhRRRR/# )r   Únir   r   Úintr    )r!   s   "r"   r#   Ú/DebugInterpreter.run_node.<locals>.__annotate__£   s   € ÷ 	ñ 	˜[ð 	¨Sñ 	r$   c                ó  <€ \        V \        4      '       g   V # \        P                  ! V P                  P
                  P                  SP                  4      4      pVP                  '       g   \        R V 24      h\        V4      # )zexpected r to be a number, got )rO   r
   ÚsympyÚexpandr2   ÚexprÚxreplacerz   Ú	is_numberÚAssertionErrorr…   )r„   Úrr}   s   & €r"   Úsubst_symintÚ/DebugInterpreter.run_node.<locals>.subst_symint£   sa   ø€ Ü˜b¤&×)Ò)Ø�	Ü—’˜RŸW™WŸ\™\×2Ñ2°4×3FÑ3FÓGÓHˆAØ—;—;�;Ü$Ð'FÀqÀcÐ%JÓKÐKÜ�q“6ˆMr$   c               ó    € V ^8„  d   QhRRRR/# )r   Únisztuple[IntLikeType, ...]r   ztuple[int, ...]r    )r!   s   "r"   r#   r†   «   s   € ÷ 	9ñ 	9Ð$;ð 	9Àñ 	9r$   c                óh   <€ \         ;QJ d    . V3R  lV  4       F  NK  	  5# ! V3R  lV  4       4      # )c              3  ó4   <"  € T F  pS! V4      x € K  	  R # 5irA   r    )rE   r„   r�   s   & €r"   rG   ÚHDebugInterpreter.run_node.<locals>.subst_symint_tuple.<locals>.<genexpr>¬   s   øé € Ð8±C¨b™ b×)Ð)³Cùs   ƒ)Útuple)r’   r�   s   &€r"   Úsubst_symint_tupleÚ5DebugInterpreter.run_node.<locals>.subst_symint_tuple«   s%   ø€ ß”5Ô8±CÓ8—5Ð8�5Ô8±CÓ8Ó8Ð8r$   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úaútorch.TensorÚbr   rd   r    )r!   s   "r"   r#   r†   ®   s!   € ÷ 	ñ 	¨ð 	¸,ð 	È4ñ 	r$   c                ó  <€ S! V P                  4       4      ^ 8”  di   \        V P                  4       FO  pS! V P                  V4      4      VP                  V4      8w  g   K0  S! V P	                  V4      4      ^8”  g   KN   R# 	  R# )r   FT)ÚnumelÚrangeÚndimÚstrideÚsize)rš   rœ   Úidxr�   s   && €r"   Úcheck_significant_stridesÚ<DebugInterpreter.run_node.<locals>.check_significant_strides®   sb   ø€ Ù˜AŸG™G›IÓ&¨Ô*Ü  §¡ž=�Cá$ Q§X¡X¨c£]Ó3°q·x±xÀ³}ÖDÙ(¨¯©°«Ó5¸Ö9â$ñ )ñ r$   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   Únvr›   ÚrvÚdesczCallable[[], str]r   ÚNoner    )r!   s   "r"   r#   r†   ¸   s*   € ÷ 	ñ 	�lð 	¨ð 	Ð<Mð 	ÐRVñ 	r$   c           
     ó„  <€ \        V4      '       g   \        R \        V4       24      hV P                  VP                  8w  d-   \        V! 4        RV P                   RVP                   24      hS! V P	                  4       4      VP	                  4       8w  dL   \        V! 4        RV P	                  4        RS! V P	                  4       4       RVP	                  4        24      hS! W4      pV'       gL   \        V! 4        RV P                  4        RS! V P                  4       4       RVP                  4        24      hR# )z"expected desc to be callable, got z: ú != z aka N)Úcallabler�   rQ   r?   r¢   r¡   )r§   r¨   r©   Úsame_stridesr¤   r—   s   &&& €€r"   ÚcheckÚ(DebugInterpreter.run_node.<locals>.check¸   s  ø€ Ü˜D—>’>Ü$Ð'IÌ$ÈtË*ÈÐ%VÓWÐWØ�x‰x˜2Ÿ8™8Ô#Ü$©« x¨r°"·(±(°¸4ÀÇÁ¸zÐ%JÓKÐKÙ! "§'¡'£)Ó,°·±³	Ô9Ü$Ù“v�h˜b §¡£ ¨5Ñ1CÀBÇGÁGÃIÓ1NÐ0OÈtÐTV×T[ÑT[ÓT]ÐS^Ð_óð ñ 5°RÓ<ˆLßÜ$Ù“v�h˜b §¡£ ¨UÑ3EÀbÇiÁiÃkÓ3RÐ2SÐSWÐXZ×XaÑXaÓXcÐWdÐeóð ñ  r$   Úvalr¬   c                 ó(   <€ R S  RSP                    2# )zoutput z where ©rz   )Úir}   s   €€r"   Ú<lambda>Ú+DebugInterpreter.run_node.<locals>.<lambda>Ö   s   ø€ ¨°¨s°'¸$×:MÑ:MÐ9NÑ&Or$   )r{   Úrun_nodeÚmetaÚpytreeÚtree_flattenrJ   r�   ÚziprŸ   rO   r,   ÚTensor)r}   r�   r¯   rŽ   Ún_valsÚ_n_specÚr_valsÚ_r_specr§   r¨   r¤   r´   r�   r—   r~   s   f&        @@@@€r"   r·   ÚDebugInterpreter.run_node¢   sè   ý€ ÷	ð 	÷	9ð 	9÷	ð 	÷	ñ 	ô ‰GÑ˜QÓˆØ�A—F‘FŒ?Ü$×1Ò1°!·&±&¸µ-Ó@‰OˆFÜ$×1Ò1°!Ó4‰OˆFô �6‹{œc &›kÔ)Ü$¬¨F« }°D¼¸V»¸Ð%FÓGÐGÜ ¤¤s¨6£{Ó!3°VÖD‘	��2Ü! "¤e§l¡l×3Ò3ÙÙ�bÕOÖPñ Eð ˆr$   r³   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r|   r·   Ú__static_attributes__Ú__classcell__)r~   s   @r"   rs   rs   ’   s+   ø† ð
ð /3ð
ð &*÷	
ò 
÷5ö 5r$   rs   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r   r   r`   r   r   zDCallable[[DebugInterpreter, Any, dict[Node, Any] | None, bool], Any]r    )r!   s   "r"   r#   r#   Û   s$   € ÷ &ñ &Ø
ð&Ø ð&àIñ&r$   c                ó,   € \        V 4      P                  # )z˜
Returns a (slow) interpreter over the FX graph module that also checks
various debugging properties (e.g., that tracing strides matched real
strides.)
)rs   r|   rp   s   &&r"   Ú	debug_noprÊ   Ú   s   € ô ˜DÓ!×%Ñ%Ð%r$   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r   r   r`   r   r   r<   r    )r!   s   "r"   r#   r#   ç   s"   € ÷ ñ ˜Nð ¨sð Ð7Mñ r$   c                ó´   € \        V 4       \        P                  P                  V 4      p\        P                  P	                  VP                  4       4      pV# rA   )r   r,   rS   rT   rV   rW   )r   r`   r]   s   && r"   Úsimple_ts_compilerÍ   æ   s=   € ä�DÔÜ�	‰	×Ñ˜Ó€AÜ�	‰	×Ñ˜Ÿ™›Ó"€AØ€Hr$   c               ó    € V ^8„  d   QhRRRR/# )r   r]   zCallable[..., Any]r   r    )r!   s   "r"   r#   r#   î   s   € ÷ .ñ .Ð!ð .Ð&8ñ .r$   c                ó"   € \        V \        4      # rA   )r   rÍ   )r]   s   &r"   Únnc_jitrÐ   î   s   € Ü˜Ô,Ó-Ð-r$   c               ó$   € V ^8„  d   QhRRRRRR/# rn   r    )r!   s   "r"   r#   r#     s!   € ÷ ñ ˜ð ¨3ð °>ñ r$   c                ó0   € \        V P                  4       V # rA   )rf   rg   rp   s   &&r"   Úprint_compilerÓ     s   € ä	ˆ$�)‰)ÔØ€Kr$   c               ó$   € V ^8„  d   QhRRRRRR/# )r   ÚfnzCallable[_P, _R] | nn.ModulerL   r   r   r    )r!   s   "r"   r#   r#     s&   € ÷ $*ñ $*Ø$ð$*àð$*ð "ñ$*r$   c                óÜ   € R\         R\         R\        R\        /pVP                  V4       \	        V \
        P                  P                  4      '       d   \        V 3/ VB # \        V 3/ VB # )a:  
Wrapper function over :func:`aot_function` and :func:`aot_module` to perform
memory efficient fusion. It uses the
:func:`min_cut_rematerialization_partition` partitioner to perform efficient
recomputation. It uses NVFuser to compile the generated forward and backward
graphs.

.. warning::
    This API is experimental and likely to change.

Args:
    fn (Union[Callable, nn.Module]): A Python function or a ``nn.Module``
        that takes one or more arguments. Must return one or more Tensors.
    **kwargs: Any other overrides you want to make to the settings

Returns:
    Returns a ``Callable``  or ``nn.Module`` that retains the eager behavior
    of the original :attr:`fn`, but whose forward and backward graphs have
    gone through recomputation optimizations, and the graphs have been
    compiled with nvfuser.

Úfw_compilerÚbw_compilerÚpartition_fnÚdecompositions)
r^   r   Údefault_decompositionsÚupdaterO   r,   ÚnnÚModuler   r   )rÕ   rL   Úconfigs   &, r"   Úmemory_efficient_fusionrà     sd   € ð6 	”zØ”zØÔ;ØÔ0ð	€Fð ‡M�M�&ÔÜ�"”e—h‘h—o‘o×&Ò&Ü˜"Ñ' Ñ'Ð'ä˜BÑ) &Ñ)Ð)r$   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r   r   r;   zSequence[torch.Tensor]r   r<   r    )r!   s   "r"   r#   r#   =  s$   € ÷ "ñ "Ø
ð"Ø 6ð"àñ"r$   c                óê   € V P                  R 4       \        RV Uu. uF  q"P                  VP                  3NK  	  up R24       ^ RIHp V! 4       P                  4       ! V!   \        W4      # u upi )ÚfooaQ  
##############################################################
# To minimize FX graph, copy and paste the below and run it  #
##############################################################

import torch
import torch.fx as fx
from functorch.compile import minifier, check_nvfuser_subprocess, check_nvfuser_correctness_subprocess

inps = a?  
inps = [torch.ones(shape, dtype=dtype, device='cuda') for (shape, dtype) in inps]
from foo import FxModule
mod = FxModule().cuda()

with torch.jit.fuser("fuser2"):
  # check_nvfuser_subprocess can be replaced with check_nvfuser_correctness_subprocess
  minifier(fx.symbolic_trace(mod), inps, check_nvfuser_subprocess)
)ÚFxModule)Ú	to_folderrf   Úshaper?   rã   rä   Úcudar^   )r   r;   r´   rä   s   &&  r"   Údebug_compilerè   =  so   € ð 	‡N�N�5ÔÜ	ð	ñ &*Ó*¡T �'‰'�1—7‘7Ó	¡TÑ*Ð+ð ,ð	ôõ* áƒJ‡O�OÔ�tÒä�dÓ!Ð!ùò 	+s   œ A0
r…   Úgraph_indexc               ó    € V ^8„  d   QhRRRR/# )r   Úinput_data_pathrb   r   úlist[torch.Tensor]r    )r!   s   "r"   r#   r#   `  s   € ÷ ñ  ð Ð(:ñ r$   c                ót  € . p\        V R4      ;_uu_ 4       p\        P                  ! V4      p. pV Fæ  p\        V4      ^8X  d   TpV! \        P                  ! 4       4      pM¤Vw  rWr‰p
V	\
        P                  \
        P                  \
        P                  \
        P                  \
        P                  \
        P                  \        \        09   d   \
        P                  ! ^ ^WyV
R7      pM\
        P                  ! WyV
R7      pVP                  V4       Kè  	  RRR4       V#   + '       g   i     T# ; i)zR
Return a random input for the given inputs meta generated from _save_fx_default.
Úrb)r?   rP   N)ÚopenÚpickleÚloadrJ   Úrandomr,   r…   Úint32Úint64rd   Úuint8ÚfloatÚrandintÚrandÚappend)rë   Úinputsr]   Úinputs_metar¸   rQ   Úinput_ræ   Ú_strider?   rP   s   &          r"   Ú
get_inputsrþ   `  së   € ð "$€FÜ	ˆo˜t×	$Ô	$¨Ü—k’k !“nˆØˆÛˆDÜ�4‹y˜AŒ~Ø�ÙœfŸmšm›oÓ.‘à6:Ñ3�˜W¨VØÜ—I‘IÜ—K‘KÜ—K‘KÜ—J‘JÜ—I‘IÜ—K‘KÜÜð	ô 	ô #Ÿ]š]¨1¨a°ÈFÔS‘Fä"ŸZšZ¨À6ÔJ�FØ�M‰M˜&Ö!ñ'  ÷ 
%ð. €M÷/ 
%Ö	$ð. €Mús   —DD&Ä&D7	c               ó0   € V ^8„  d   QhRRRRRRRRRR	R
R/# )r   Úcurrent_namerb   Úfolder_nameÚdump_example_inputrd   Úgmztorch.fx.GraphModuleÚexample_inputsrì   r   z	nn.Moduler    )r!   s   "r"   r#   r#     sL   € ÷ fñ fØðfàðfð ðfð 	ð	fð
 'ðfð ñfr$   c           	     óœ   a aaa	a
€ ^ RI Hp R V	3R llo	R V VVV	3R llo
R V
3R llpR V
3R	 llpR
 V
3R llpV! VVVVV\        R7      # )a  
The forward, backward, and joint computation graph will be stored in
{folder_name}/{current_name}/{current_name}_forward_{graph_index},
{folder_name}/{current_name}/{current_name}_backward_{graph_index}, and
{folder_name}/{current_name}/{current_name}_joint_{graph_index} respectively.
The input shape of the graphs will be stored in the .input files.
These files can be loaded with pickle,
and is a list of format (type, shape, stride, dtype, device).
In the case of type = int or float, it is just (type,).
For joint graph input, it is a nested list [[],[]]
where the two inner lists have the same format.
If dump_example_input is True, example_inputs will be stored in .pt file.
Since each function might produce multiple graphs,
the graph_index is used to distinguish different graphs
)Úaot_module_simplifiedc               ó    € V ^8„  d   QhRRRR/# )r   rK   r   r   z	list[Any]r    )r!   s   "r"   r#   Ú&_save_fx_default.<locals>.__annotate__—  s   € ÷ ñ ˜Sð  Yñ r$   c                óð  <€ . p\        V 4      ^ 8”  dL   \        V ^ ,          \        4      '       d/   VS! V ^ ,          4      ,          pVS! V ^,          4      ,          pV# V  F‘  p\        V4      \        J g   \        V4      \
        J d   VP                  \        V4      34       KF  VP                  \        V4      VP                  VP                  4       VP                  VP                  34       K“  	  V# )r   )rJ   rO   r–   rQ   r…   rö   rù   ræ   r¡   r?   rP   )rK   Ú
input_metaÚargÚget_input_metas   &  €r"   r  Ú(_save_fx_default.<locals>.get_input_meta—  s¾   ø€ Øˆ
Üˆt‹9�qŒ=œZ¨¨Q­´×7Ò7Ø™.¨¨a­Ó1Õ1ˆJØ™.¨¨a­Ó1Õ1ˆJØÐÛˆCÜ�C‹yœCÓ¤4¨£9´Ó#5Ø×!Ñ!¤4¨£9 ,Ö/à×!Ñ!Ü˜#“Y §	¡	¨3¯:©:«<¸¿¹ÀCÇJÁJÐOöñ	 ð Ðr$   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   Ú
gm_to_saver   rK   r   Ú	type_namerb   r   rª   r    )r!   s   "r"   r#   r  ¦  s,   € ÷ !ñ !Ø"ð!Ø*-ð!Ø:=ð!à	ñ!r$   c                óV  <€ \        V P                  P                  4      ^ 8X  d.   \        P                  \        P
                  RSV\        4       R# \        P                  ! V 4      pVP                  P                  \        P                  P                  P                  4       4       VP                  4        S	! V4      p\        P                  ! S RS 2RR7       VP!                  S RS RS RV R\         2	4       \#        S RS RS RV R\         RS RV R\         R2R4      ;_uu_ 4       p\$        P&                  ! WE4       RRR4       S'       d:   \        P(                  ! VS RS RS RV R\         RS RV R\         R	24       R# R#   + '       g   i     LS; i)
r   z!No nodes in graph {%s}_{%s}_{%s}.NÚ/T)Úexist_okr`   z.inputÚwbz.pt)rJ   r*   rM   ÚlogÚloggingÚWARNINGré   ÚcopyÚdeepcopyÚset_codegenr,   ÚfxÚCodeGenr1   ÚosÚmakedirsrå   rï   rð   ÚdumpÚsave)
r  rK   r  r  r
  r]   r   r  r  r  s
   &&&   €€€€r"   Úgraph_saver_helperÚ,_save_fx_default.<locals>.graph_saver_helper¦  s¥  ø€ ô ˆz×Ñ×%Ñ%Ó&¨!Ô+Ü�G‰GÜ—‘Ø3ØØÜôñ ä�]Š]˜:Ó&ˆØ
�‰×ÑœUŸX™XŸ^™^×3Ñ3Ó5Ô6Ø
�‰Œá# DÓ)ˆ
ä
�Š�{�m 1 \ NÐ3¸dÕCØ
�‰Øˆm˜1˜\˜N¨!¨L¨>¸¸9¸+ÀQÄ{ÀmÐTô	
ô Øˆm˜1˜\˜N¨!¨L¨>¸¸9¸+ÀQÄ{ÀmÐSTÐUaÐTbÐbcÐdmÐcnÐnoÔp{Ðo|ð  }Cð  DØ÷
ô 
ð Ü�KŠK˜
Ô&÷	
÷
 Ü�JŠJØØ�-˜q  ¨a°¨~¸Q¸y¸kÈÌ;È-ÐWXÐYeÐXfÐfgÐhqÐgrÐrsÔtð  tAð  ADð  Eöñ ÷
÷ 
ús   Ä6FÆF(	c               ó$   € V ^8„  d   QhRRRRRR/# ©r   r  r   r  rì   r   r    )r!   s   "r"   r#   r  É  s$   € ÷ ñ ØðØ,>ðà	ñr$   c                ó   <€ S! WR 4       V # )Úforwardr    ©r  r  r!  s   &&€r"   Úgraph_saver_forwardÚ-_save_fx_default.<locals>.graph_saver_forwardÉ  s   ø€ ñ 	˜2¨yÔ9Øˆ	r$   c               ó$   € V ^8„  d   QhRRRRRR/# r$  r    )r!   s   "r"   r#   r  Ï  s$   € ÷ ñ ØðØ,>ðà	ñr$   c                ó4   <€ S! WR 4       \         ^,          s V # )Úbackward)ré   r'  s   &&€r"   Úgraph_saver_backwardÚ._save_fx_default.<locals>.graph_saver_backwardÏ  s   ø€ ñ 	˜2¨zÔ:ä�qÕˆØˆ	r$   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r  r   Ú
joint_argsrì   r   z%tuple[fx.GraphModule, fx.GraphModule]r    )r!   s   "r"   r#   r  ×  s$   € ÷ 1ñ 1Øð1Ø(:ð1à	.ñ1r$   c                ó,   <€ S! WR 4       \        W4      # )Újoint)r   )r  r0  r!  s   &&€r"   Úgraph_saver_jointÚ+_save_fx_default.<locals>.graph_saver_joint×  s   ø€ ñ 	˜2¨7Ô3Ü  Ó0Ð0r$   )r×   rØ   rÙ   rÚ   )Úfunctorch.compiler  rÛ   )r   r  r  r  r  r  r(  r-  r3  r  r!  s   fff&&    @@r"   Ú_save_fx_defaultr6    s\   ü€ õ, 8÷ð ÷!ó !÷Fð ÷ð ÷1ð 1ñ !Ø
ØØ'Ø(Ø&Ü-ôð r$   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r   rb   r  r  rd   r   z Callable[[bool, nn.Module], Any]r    )r!   s   "r"   r#   r#   é  s2   € ÷ Tñ TØðTØ$'ðTØ=AðTà%ñTr$   c                ó(   € ^ s \        \        WV4      # )aK  
Dump the forward, backward, and joint computation graph.
Example Usage:
save_fx_func = graph_dumper_aot(current_name, folder_name, dump_example_input = False)
optimize_ctx = torchdynamo.optimize(
    save_fx_func
)
with torch.enable_grad():
    with optimize_ctx:
        result = forward_and_backward_pass(model, example_inputs)
)ré   r   r6  )r   r  r  s   &&&r"   Úgraph_dumper_aotr9  é  s   € ð €KÜÔ# \Ð@RÓSÐSr$   )T)F)eÚ__conditional_annotations__Ú
__future__r   r  r  r  rð   rò   Ú
contextlibr   Ú	functoolsr   Útypingr   r   Útyping_extensionsr   r	   rˆ   r,   Útorch.fxr  Útorch.nnrÝ   Útorch.utils._pytreeÚutilsÚ_pytreer¹   r
   Útorch._decompr   Ú%torch.fx.experimental.symbolic_shapesr   Úaot_autogradr   r   r   Úcompile_utilsr   Úpartitionersr   r   r   Úcollections.abcr   r   r   Útorch.fx.noder   Útorch.typesr   r   r   Ú	getLoggerrÂ   r  r3   r9   r^   rh   rl   rq   ÚInterpreterrs   rÊ   rÍ   rÐ   r-   r.   ÚdetachÚgelu_backwardÚleaky_relu_backwardÚsigmoid_backwardÚthreshold_backwardÚhardtanh_backwardÚhardsigmoid_backwardÚhardswish_backwardÚtanh_backwardÚsilu_backwardÚelu_backwardÚcudnn_batch_normÚcudnn_batch_norm_backwardÚmasked_fillÚScalarr¼   ÚeluÚ
leaky_reluÚhardtanhÚ	hardswishÚhardsigmoidÚconj_physicalÚis_same_sizerÛ   rÓ   rà   rè   ré   Ú__annotations__rþ   r6  r9  )r:  s   @r"   Ú<module>rf     sH  øðß "Ð "ã Û Û 	Û Û Ý %Ý ß %ß 0ã ã Ý Ý ß $Ð $Ý Ý ,Ý >ç GÑ GÝ *÷ñ ÷ ß=Ñ=å"Ý'ñ ˆtƒ_€ÙˆTƒ]€à×Ò˜Ó!€õ
ð ô?ó ð?ð ô0ó ð0÷fõHð ô	ó ð	ôE�r—~‘~ô EðP ô&ó ð&ð ôó ðõ.ð ‡y�y‡~�~€à‡K�KØ×ÑØ×ÑØ×ÑØ×ÑØ×ÑØ×ÑØ×ÑØ×ÑØ×ÑØ×ÑØ×ÑØ×"Ñ"Ø×Ñ×ÑØ×Ñ×ÑØ‡H�HØ‡O�OØ‡M�MØ‡N�NØ×ÑØ×ÑØ×Ñð-Ð ñ4 ,Ð,BÓCÐ ð ôó ðõ
$*õN"ð@ €ˆSÓ õõ>f÷TTñ Tr$   