+
    &j_t                       ^ RI Ht  ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHtH	t	 ^ RI
Ht ^ RIHt ^ RIHtHtHtHtHt ^ RIHtHtHt ^ RIt^ RIHt ^R	IHt ^R
IHt ]'       d%   ^ RIt^ RI H!t! ^ RIH"t" ^RI#H$t$ ^RI%H&t& ^RIH't'H(t( R R lt)]PT                  ! ]+4      t,]PZ                  P]                  ]+R4      t/ ! R R]04      t1 ! R R]14      t2 ! R R]14      t3 ! R R]14      t4 ! R R]44      t5 ! R R]44      t6 ! R R ]44      t7 ! R! R"]44      t8 ! R# R$]44      t9 ! R% R&]44      t: ! R' R(]14      t; ! R) R*]14      t< ! R+ R,]14      t= ! R- R.]14      t> ! R/ R0]14      t? ! R1 R2]?4      t@ ! R3 R4]14      tA ! R5 R6]14      tB ! R7 R8]14      tC ! R9 R:]14      tD ! R; R<]14      tE ! R= R>]	4      tF ! R? R@]14      tG ! RA RB]14      tH ! RC RD]14      tI ! RE RF]14      tJ ! RG RH]K4      tL ! RI RJ]14      tM ! RK RL]14      tN ! RM RN]N4      tO ! RO RP]N4      tP ! RQ RR]P4      tQ ! RS RT]P4      tR ! RU RV]N4      tS ! RW RX]N4      tT ! RY RZ]N4      tU ! R[ R\]N4      tV ! R] R^]N4      tW]X]O]Y]P]Z]Q][]S]\]R]]]T]0]U]^]V]_]W/	t`R_ R` ltaRaRRbR/Rc Rd lltbRe Rf ltcRg Rh ltd]P                  P                  P                  ]P                  P                  P                  ]P                  P                  P                  ]P                  P                  P                  ]P                  P                  P                  3tlRi Rj ltmRk Rl ltn]! ^Rm7      Rn Ro l4       toRp Rq ltp]q! 4       trRr]rRsRtRuRt/Rv Rw llts ! Rx Ry4      ttRz R{ ltuRR| R} lltvR~ R ltwR R ltxRR R lltyR R ltzR R lt{R R lt|RR R llt}R R lt~R R ltRR R lltR# )    )annotationsN)autoEnum)	lru_cache)Path)extract_stack
format_excformat_listFrameSummaryStackSummary)AnyNoReturnTYPE_CHECKING)get_file_path_2)config)counters)VariableTracker)	CompileId)DynamoTracerOutput)InstructionTranslatorBase)DynamoFrameTypeFrameExecStrategyc                    V ^8  d   QhRRRR/# )   	case_namestrreturn )formats   "i/Users/jameslopez/projects/CWCArchive/cwc-podcast/.venv/lib/python3.14/site-packages/torch/_dynamo/exc.py__annotate__r!   :   s      c c     c                4    RV P                  RR4      ,           # )z,For more information about this error, see: _-zhFor more information about this error, see: https://pytorch.org/docs/main/generated/exportdb/index.html#)replace)r   s   &r    exportdb_error_messager'   :   s"    	I


C
%	&r"   graph_breaksc                  2   a  ] tR t^FtRtR V 3R lltRtV ;t# )TorchDynamoExceptiona  Base exception class for all TorchDynamo-specific exceptions.

Attributes:
    _torch_dynamo_tracer_output: Optional tracer output attached to the exception
    frame_exec_strategy: Optional frame execution strategy to control how convert_frame
        should handle this exception. When set, convert_frame will use this strategy
        instead of the default behavior. This allows exceptions to signal specific
        execution strategies (e.g., SKIP, RUN_ONLY) without requiring separate
        exception types for control flow.
c               $    V ^8  d   QhRRRRRR/# )r   argsr   kwargsr   Noner   )r   s   "r    r!   !TorchDynamoException.__annotate__R   s&     B Bc BS BT Br"   c                	D   < \         SV `  ! V/ VB  R V n        R V n        R # N)super__init___torch_dynamo_tracer_outputframe_exec_strategy)selfr,   r-   	__class__s   &*,r    r3   TorchDynamoException.__init__R   s%    $)&)FJ(=A r"   )r4   r5   )__name__
__module____qualname____firstlineno____doc__r3   __static_attributes____classcell__r7   s   @r    r*   r*   F   s    	B Br"   r*   c                      ] tR t^XtRtR# )InternalTorchDynamoErrorr   Nr9   r:   r;   r<   r>   r   r"   r    rB   rB   X       r"   rB   c                      ] tR t^\tRtR# )ResumePrologueTracingErrorr   NrC   r   r"   r    rF   rF   \   rD   r"   rF   c                  B   a  ] tR t^`t$ R]R&   RR/R V 3R llltRtV ;t# )RestartAnalysis
str | Nonerestart_reasonNc               $    V ^8  d   QhRRRRRR/# )r   r,   r   rJ   rI   r   r.   r   )r   s   "r    r!   RestartAnalysis.__annotate__c   s!        c  :    r"   c               	0   < Wn         \        SV `  ! V!   R # r1   )rJ   r2   r3   )r6   rJ   r,   r7   s   &$*r    r3   RestartAnalysis.__init__c   s    ,$r"   )rJ   r9   r:   r;   r<   __annotations__r3   r>   r?   r@   s   @r    rH   rH   `   s           r"   rH   c                      ] tR t^htRtR# )SpeculationRestartAnalysisr   NrC   r   r"   r    rR   rR   h   rD   r"   rR   c                      ] tR t^ltRtRtR# )AutogradGradRestartAnalysiszRaised when autograd.grad consumed grad_fns that are returned.

On restart, autograd.grad will graph break instead of being traced.
r   Nr9   r:   r;   r<   r=   r>   r   r"   r    rT   rT   l   s    r"   rT   c                      ] tR t^stRtRtR# )RequiresGradRestartAnalysiszRaised when a source-less requires_grad_() intermediate leaks as output.

On restart, requires_grad_() will graph break instead of being traced,
preserving partial acceleration for code before the call.
r   NrU   r   r"   r    rW   rW   s   s    r"   rW   c                      ] tR t^{tRtR# )UnspecializeRestartAnalysisr   NrC   r   r"   r    rY   rY   {   rD   r"   rY   c                      ] tR t^tRtR# ) CompileCollectiveRestartAnalysisr   NrC   r   r"   r    r[   r[      rD   r"   r[   c                      ] tR t^tRtR# )TensorifyScalarRestartAnalysisr   NrC   r   r"   r    r]   r]      rD   r"   r]   c                      ] tR t^tRtR# )	SkipFramer   NrC   r   r"   r    r_   r_      rD   r"   r_   c                  2   a  ] tR t^tRR V 3R llltRtV ;t# )TorchRuntimeErrorc               $    V ^8  d   QhRRRRRR/# r   msgr   
real_stackStackSummary | Noner   r.   r   )r   s   "r    r!   TorchRuntimeError.__annotate__   "     
 
C 
-@ 
D 
r"   c                	   < \         SV `  V4       Wn        Ve
   VV n        R # \        P                  P
                  P                  4       V n        R # r1   r2   r3   rd   torch_guardsTracingContextr   re   r6   rd   re   r7   s   &&&r    r3   TorchRuntimeError.__init__   H     %  	 --;;= 	r"   rd   re   r1   r9   r:   r;   r<   r3   r>   r?   r@   s   @r    ra   ra          
 
 
r"   ra   c                  .   a  ] tR t^tR V 3R lltRtV ;t# )InvalidBackendc                    V ^8  d   QhRRRR/# )r   namer   r   r.   r   )r   s   "r    r!   InvalidBackend.__annotate__   s     
 
S 
T 
r"   c                	0   < \         SV `  R V: R24       R# )zInvalid backend: z=, see `torch._dynamo.list_backends()` for available backends.N)r2   r3   )r6   rw   r7   s   &&r    r3   InvalidBackend.__init__   s    x'de	
r"   r   rr   r@   s   @r    ru   ru      s    
 
r"   ru   c                  .   a  ] tR t^tR V 3R lltRtV ;t# )ResetRequiredc                   V ^8  d   QhRR/# r   r   r.   r   )r   s   "r    r!   ResetRequired.__annotate__   s     
 
$ 
r"   c                	N   < \         SV `  \        P                  ! R 4      4       R# )z
                Must call `torch._dynamo.reset()` before changing backends.  Detected two calls to
                `torch.compile()` with a different backend compiler arguments.
                N)r2   r3   textwrapdedent)r6   r7   s   &r    r3   ResetRequired.__init__   s!    OO	
r"   r   rr   r@   s   @r    r|   r|      s    
 
r"   r|   c                  :   a  ] tR t^tR V 3R lltR R ltRtV ;t# )ShortenTracebackc               (    V ^8  d   QhRRRRRRRR/# )r   r,   r   first_useful_frametypes.FrameType | Noner-   r   r.   r   )r   s   "r    r!   ShortenTraceback.__annotate__   s,     5 55.D5PS5	5r"   c               	4   < \         SV `  ! V/ VB  Wn        R # r1   )r2   r3   r   )r6   r   r,   r-   r7   s   &$*,r    r3   ShortenTraceback.__init__   s     	$)&)"4r"   c                   V ^8  d   QhRR/# )r   r   ztyping.Selfr   )r   s   "r    r!   r      s     ' 'k 'r"   c                	    V P                   pV P                  e   Ve   \        P                  '       d   V # VP                  V P                  Jd   VP
                  pVe   K,  Q R4       hV P                  V4      # )Nz#internal error, please report a bug)__traceback__r   r   verbosetb_frametb_nextwith_traceback)r6   tbs   & r    remove_dynamo_frames%ShortenTraceback.remove_dynamo_frames   sf    ""*bjFNNNKkk!8!88B>H#HH>""2&&r"   r   )r9   r:   r;   r<   r3   r   r>   r?   r@   s   @r    r   r      s    5 5' 'r"   r   c                  .   a  ] tR t^tR V 3R lltRtV ;t# )BackendCompilerFailedc               (    V ^8  d   QhRRRRRRRR/# )	r   
backend_fnr   inner_exception	Exceptionr   r   r   r.   r   )r   s   "r    r!   "BackendCompilerFailed.__annotate__   s8     	E 	E	E #	E 3		E
 
	Er"   c                	   < \        VR R4      V n        W n        RV P                  : R\        V4      P                   RV 2p\
        SV `  WCR7       R# )r9   ?zbackend=z	 raised:
z: r   N)getattrbackend_namer   typer9   r2   r3   )r6   r   r   r   rd   r7   s   &&&& r    r3   BackendCompilerFailed.__init__   sZ     $J
C@.**-Z_8M8V8V7WWYZiYjkDr"   )r   r   rr   r@   s   @r    r   r      s    	E 	Er"   r   c                  Z   a  ] tR t^tRRRRR/R V 3R lllltR R ltRR R	 lltR
tV ;t# )Unsupportedr   Nre   c               0    V ^8  d   QhRRRRRRRRRR	R
R/# )r   rd   r   gb_type
skip_frameboolr   rI   re   rf   r   r.   r   )r   s   "r    r!   Unsupported.__annotate__   sF       	
   ( 
r"   c               	   < \         SV `  V4       V'       g)   \        P                  P                  P                  4       pWPn        Wn        W0n        R V n	        V P                  4        W n        RV n        R # )NF)r2   r3   rk   rl   rm   r   re   rd   r   categoryadd_to_statsr   logged)r6   rd   r   r   r   re   r7   s   &&&&$$r    r3   Unsupported.__init__   s[     	55CCEJ$$$(#*r"   c                   V ^8  d   QhRR/# r~   r   )r   s   "r    r!   r      s     2 24 2r"   c                	0   V P                   f   Q h\        V P                   ,          V P                  ;;,          ^,          uu&   \        V P                   ,          V P                  ,          ^ 8:  d%   \        V P                   ,          V P                   R # R # r1   r   r   rd   r6   s   &r    remove_from_statsUnsupported.remove_from_stats   sc    }}((()Q.)DMM"488,1'1 2r"   c                    V ^8  d   QhRRRR/# )r   r   r   r   r.   r   )r   s   "r    r!   r      s     * *S *t *r"   c                	f    Wn         \        V,          V P                  ;;,          ^,          uu&   R# )   Nr   )r6   r   s   &&r    r   Unsupported.add_to_stats   s      488$)$r"   )r   r   r   rd   re   r   ) F)unimplemented)	r9   r:   r;   r<   r3   r   r   r>   r?   r@   s   @r    r   r      s0     !% +/ *2* *r"   r   c                      ] tR t^tRtR# )$UnknownPropertiesDuringBackwardTracer   NrC   r   r"   r    r   r      rD   r"   r   c                      ] tR t^tRtR# )RecompileErrorr   NrC   r   r"   r    r   r      rD   r"   r   c                      ] tR t^tRtR# )InfiniteGeneratorErrorr   NrC   r   r"   r    r   r          r"   r   c                      ] tR t^tRtRtR# )CondOpArgsMismatchErrorz7
Internal error from cond() due to arguments mismatch.
r   NrU   r   r"   r    r   r      s    r"   r   c                      ] tR tRt]! 4       t]! 4       t]! 4       t]! 4       t]! 4       t	]! 4       t
]! 4       t]! 4       tRtR# )UserErrorTypei  r   N)r9   r:   r;   r<   r   DYNAMIC_CONTROL_FLOWANTI_PATTERNSTANDARD_LIBRARYCONSTRAINT_VIOLATIONDYNAMIC_DIMINVALID_INPUTINVALID_OUTPUT*UNSUPPORTED_ALIASED_MUTATED_DYNAMIC_INPUTSr>   r   r"   r    r   r     s>    66Lv6&KFMVN15.r"   r   c                  2   a  ] tR tRtRR V 3R llltRtV ;t# )	UserErrori  c               (    V ^8  d   QhRRRRRRRR/# )	r   
error_typer   rd   r   r   rI   r   r.   r   )r   s   "r    r!   UserError.__annotate__  s,      '.1>H	r"   c                p  < VeU   \        V\        4      '       g   Q hVP                  R4      '       d   VR,          pM	VR,          pV\        V4      ,          p\        SV `  V4       \        P                  P                  P                  4       V n
        RV n        RV n        Wn        W n        W n        R# )a  
Type of errors that would be valid in Eager, but not supported in TorchDynamo.
The error message should tell user about next actions.

error_type: Type of user error
msg: Actionable error message
case_name: (Optional) Unique name (snake case) for the usage example in exportdb.
N. 
F)
isinstancer   endswithr'   r2   r3   rk   rl   rm   r   re   r   r   r   rd   message)r6   r   rd   r   r7   s   &&&&r    r3   UserError.__init__  s      i----||C  s
t))44C--66DDF$r"   )r   r   r   rd   re   r   r1   rr   r@   s   @r    r   r     s      r"   r   c                  2   a  ] tR tRtRR V 3R llltRtV ;t# )StepUnsupportedi,  c               $    V ^8  d   QhRRRRRR/# rc   r   )r   s   "r    r!   StepUnsupported.__annotate__-  s"      C -@ D r"   c                	   < \         SV `  V4       Wn        V'       g)   \        P                  P
                  P                  4       pW n        R V n        R# )FN)	r2   r3   rd   rk   rl   rm   r   re   r   rn   s   &&&r    r3   StepUnsupported.__init__-  s<    55CCEJ$r"   )r   rd   re   r1   rr   r@   s   @r    r   r   ,  s      r"   r   c                      ] tR tRtRtR# )UnsafeScriptObjectErrori6  r   NrC   r   r"   r    r   r   6  rD   r"   r   c                  2   a  ] tR tRtRR V 3R llltRtV ;t# )UncapturedHigherOrderOpErrori:  c               $    V ^8  d   QhRRRRRR/# rc   r   )r   s   "r    r!   )UncapturedHigherOrderOpError.__annotate__;  rh   r"   c                	   < \         SV `  V4       Wn        Ve
   VV n        R # \        P                  P
                  P                  4       V n        R # r1   rj   rn   s   &&&r    r3   %UncapturedHigherOrderOpError.__init__;  rp   r"   rq   r1   rr   r@   s   @r    r   r   :  rs   r"   r   c                      ] tR tRtRtR# )FailOnRecompileLimitHitiH  r   NrC   r   r"   r    r   r   H  rD   r"   r   c                      ] tR tRtRtR# )PackageErroriL  r   NrC   r   r"   r    r   r   L  rD   r"   r   c                  6   a  ] tR tRtRR/R V 3R llltRtV ;t# )ObservedExceptioniP  re   Nc               (    V ^8  d   QhRRRRRRRR/# r   r,   r   re   rf   r-   r   r.   r   )r   s   "r    r!   ObservedException.__annotate__R  s,     
 

&9
LO
	
r"   c               	   < \         SV `  ! V/ VB  Ve
   VV n        R # \        P                  P                  P                  4       V n        R # r1   )r2   r3   rk   rl   rm   r   re   r6   re   r,   r-   r7   s   &$*,r    r3   ObservedException.__init__R  sJ     	$)&) %  	 --;;= 	r"   re   rr   r@   s   @r    r   r   P  s    
<@
 
 
r"   r   c                  B   a  ] tR tRt$ R]R&   RR/R V 3R llltRtV ;t# )	ObservedUserStopIterationi]  z
Any | Nonevaluere   Nc               (    V ^8  d   QhRRRRRRRR/# r   r   )r   s   "r    r!   &ObservedUserStopIteration.__annotate__c  s,      &9LO	r"   c               	x   < \         SV `  R VR7       \        V4      ^ 8  d   V^ ,          V n        R# RV n        R# )zunhandled `raise StopIteration`r   N)r2   r3   lenr   r   s   &$*,r    r3   "ObservedUserStopIteration.__init__c  s5     	:zRt9q=aDJDJr"   r   rO   r@   s   @r    r   r   ]  s     <@  r"   r   c                      ] tR tRtRtR# )ObservedLookupErrorim  r   NrC   r   r"   r    r  r  m  r   r"   r  c                      ] tR tRtRtR# )ObservedIndexErrorir  r   NrC   r   r"   r    r  r  r  r   r"   r  c                      ] tR tRtRtR# )ObservedKeyErroriw  r   NrC   r   r"   r    r  r  w  r   r"   r  c                      ] tR tRtRtR# )ObservedGeneratorExiti|  r   NrC   r   r"   r    r  r  |  rD   r"   r  c                      ] tR tRtRtR# )ObservedAttributeErrori  r   NrC   r   r"   r    r	  r	    r   r"   r	  c                      ] tR tRtRtR# )ObservedRuntimeErrori  r   NrC   r   r"   r    r  r    r   r"   r  c                      ] tR tRtRtR# )ObservedNotImplementedErrori  r   NrC   r   r"   r    r  r    rD   r"   r  c                      ] tR tRtRtR# )ObservedTypeErrori  r   NrC   r   r"   r    r  r    r   r"   r  c                    V ^8  d   QhRRRR/# )r   exc_typetype[Exception]r   ztype[ObservedException]r   )r   s   "r    r!   r!     s     , ,O ,@W ,r"   c                    V \         9  d4   \        V R \        V 4      4      p\        RV R2\        3/ 4      \         V &   \         V ,          # )r9   ObservedError)observed_exception_mapr   r   r   r   )r  rw   s   & r    get_dynamo_observed_exceptionr    sN    --xS];+/tfE"%6$8",
x( "(++r"   r,   r-   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r   r  r  txr   r,   z(list[VariableTracker] | list[str] | Noner-   z!dict[str, VariableTracker] | Noner   r   r   )r   s   "r    r!   r!     s:      ! 3	
 . r"   c                  ^RI Hp ^RIHp V'       d:   V Uu. uF,  p\	        V\
        4      '       d   VP                  W4      MTNK.  	  ppM. pVP                  W4      P                  YT;'       g    / 4      p\	        W4      '       g   Q hVP                  V4       VP                  P                  V4       \        V 4      p	V'       d   V	! V!  hV	hu upi )r   )ExceptionVals)SourcelessBuilder)symbolic_convertr  variables.builderr  r   r   createcall_function_attach_traceback_to_exceptionexn_vt_stackset_current_exceptionr  )
r  r  r,   r-   r  r  argargs_exception_vt
raised_excs
   &&$$      r    raise_observed_exceptionr(    s     04 
 2<C1E1E$$R-3N 	 

 (* %++B9GG
6<<RL l2222%%l3OO)),7.x8J%  
'
s   2Cc               $    V ^8  d   QhRRRRRR/# )r   r  r   rd   r   r   r   r   )r   s   "r    r!   r!     s"     8 82 8 8 8r"   c                *    \        \        W.R7       R# )z:Raise a TypeError as an observed exception during tracing.)r,   N)r(  	TypeError)r  rd   s   &&r    raise_type_errorr,    s    Y7r"   c                    V ^8  d   QhRRRR/# )r   r  r   r   r.   r   )r   s   "r    r!   r!     s     . .# .$ .r"   c                :    V P                   P                  4        R # r1   )r"  clear_current_exception)r  s   &r    handle_observed_exceptionr0    s    2 OO++-r"   c               4    V ^8  d   QhRRRRRRRRRRR	R
RR/# )r   er   codetypes.CodeTyper   r   contextexplanationhints	list[str]r   r   r   )r   s   "r    r!   r!     sN     # ##
# 	#
 # # # #r"   c          	        a \        W4      o\        P                  P                  R R V3R lR7       \        P                  RS4       \        pV! VVVVV RR7       R# )artifactc                     R RRR/# )rw   dynamo_graph_break_reasonencodingstringr   r   r"   r    <lambda>,unimplemented_with_warning.<locals>.<lambda>	  s    /
r"   c                    < S # r1   r   )graph_break_msgs   r    r?  r@    s    ?r"   )metadata_fn
payload_fnz%sT)r   r5  r6  r7  from_exclog_warningN)format_error_msg_verboserk   _loggingtrace_structuredgraph_breaks_logdebugr   )r2  r3  r   r5  r6  r7  _unimplementedrB  s   &&$$$$ @r    unimplemented_with_warningrM    sd      /q7O	NN##
 + $  41"Nr"   c          
     ,    V ^8  d   QhRRRRRRRRRR/# )r   r   r   r5  r6  r7  r8  r   r   )r   s   "r    r!   r!     s:        	
 	r"   c                "   \         P                  ! VR 4      P                  4       pRP                  R V 4       4      p\         P                  ! VR 4      P                  4       pV  RV RV RV 2p\	        V 4      pV'       d   VRV 2,          pV# )    r   c              3  z   "   T F1  pR \         P                  ! VR4      P                  4       ,           x  K3  	  R# 5i)z  Hint: rP  N)r   indentlstrip).0hints   & r    	<genexpr>-format_graph_break_message.<locals>.<genexpr>#  s/      HM
X__T6299;;;s   9;z
  Explanation: z

  Developer debug context: z:

 For more details about this graph break, please visit: )r   rR  rS  joinget_gbid_documentation_link)r   r5  r6  r7  	hints_strrd   documentation_links   &&&&   r    format_graph_break_messager\    s     //+v6==?K		 HM I oogv.557G 		 
} 
 #9(C 5W=MN`MabbJr"   )maxsizec                   V ^8  d   QhRR/# )r   r   zdict[str, Any]r   )r   s   "r    r!   r!   7  s      N r"   c                     \        \        4      P                  4       P                  p \	        R\        V 4      R4      p\        V4      ;_uu_ 4       p\        P                  ! V4      pRRR4       / pXP                  4        F  w  rVT F  pYTTR,          &   K  	  K  	  T#   + '       g   i     LA; i  \         d    \        P                  R4       / p Lhi ; i)z
Loads the gb_type to gb_id map from the graph break registry from JSON file with caching.

Includes historical gb_type (mapping behavior of duplicate gb_types with different gb_ids is undefined).
r   zgraph_break_registry.jsonNz!Error accessing the registry fileGb_type)r   __file__resolveparentr   r   openjsonloadr   log	exceptionitems)
script_dirregistry_pathfregistrymappingkventrys           r    _load_gb_type_to_gb_id_maprr  6  s    
(^++-44
'J!<
 -  Ayy|H ! G E()E)$%  ! N !  9:s0   AB5 B")B5 "B2	-B5 2B5 5"CCc                    V ^8  d   QhRRRR/# )r   r   r   r   rI   r   )r   s   "r    r!   r!   Q  s        r"   c                d    Rp\        4       pW9   d   V RW ,          P                  R4       R2# R# )z
Retrieves the GBID documentation link for a given graph break type.

Args:
    gb_type: The graph break type to look up.

Returns:
    A string containing the documentation URL if found, otherwise None.
z;https://meta-pytorch.github.io/compile-graph-break-site/gb/gbGBz.htmlN)rr  rS  )r   GRAPH_BREAK_SITE_URLgb_type_to_gb_id_maps   &  r    rY  rY  Q  sJ     	F  67&#$B';'D'K'KD'Q&RRWX	
 r"   rE  rF  Fr   c               8    V ^8  d   QhRRRRRRRRRRR	R
RR
RR/# )r   r   r   r5  r6  r7  r8  rE  r   rF  r   r   r   r   r   )r   s   "r    r!   r!   l  sZ     %0 %0%0 %0 	%0
 %0 %0 %0 %0 %0r"   c                D   \        WW#4      pV'       d   \        P                  V4       V\        Jdc   Rp\	        VR4      '       d   VP
                  p\        V\        4      '       d   VP                   RV 2p\        WpWhR7      h\        WpWhR7      Vh\        WpV4      h)a  
Called within dynamo to cause a graph break.
Args:
    gb_type: Context-free graph break type. It should be a short string without any
             information specific to the tracing context (i.e. no dynamically-generated strings)
    context: Developer context for the graph break. It can contain tracing context/dynamic strings.
    explanation: User-facing context-dependent explanation for the graph break. Can be dynamic.
    hints: List of user-facing hints for the graph break.
Nre   zJ

*** While handling this graph break, another graph break occurred: ***

r   )	r\  rg  warning_NOTHINGhasattrre   r   r   rd   )	r   r5  r6  r7  rE  rF  r   rd   past_real_stacks	   $$$$$$$  r    r   r   l  s    ( %W{
JCCx8\**&11Oh,,\\N"pqtpuvCcJSS*
	 cJ
//r"   c                  :    ] tR tRtR R ltR R ltR R ltRtR	# )
KeyErrorMsgi  c                    V ^8  d   QhRRRR/# )r   r   r   r   r.   r   )r   s   "r    r!   KeyErrorMsg.__annotate__  s      c d r"   c                	    Wn         R # r1   r   )r6   r   s   &&r    r3   KeyErrorMsg.__init__  s    
r"   c                   V ^8  d   QhRR/# r   r   r   r   )r   s   "r    r!   r    s       r"   c                	,    \        V P                  4      # r1   )r   r   r   s   &r    __str__KeyErrorMsg.__str__  s    4::r"   c                   V ^8  d   QhRR/# r  r   )r   s   "r    r!   r    s      # r"   c                	"    V P                  4       # r1   )r  r   s   &r    __repr__KeyErrorMsg.__repr__  s    ||~r"   r   N)r9   r:   r;   r<   r3   r  r  r>   r   r"   r    r  r    s     r"   r  c               $    V ^8  d   QhRRRRRR/# )r   excr   rd   r   r   r   )r   s   "r    r!   r!     s!     	 	9 	3 	3 	r"   c                    \        V R 4      '       d<   VP                  R4      pV^ ,           RV P                   V^,           V^,           2pV# )	_hop_namez
  Explanation:z
  Higher Order Operator: )r}  	partitionr  )r  rd   liness   && r    !augment_exc_message_with_hop_namer    sT     sK  01Qxj3CMM?58*USTXJW 	 Jr"   c               (    V ^8  d   QhRRRRRRRR/# )	r   r  r   rd   r   exportr   r   r.   r   )r   s   "r    r!   r!     s)     .- .-Y .-S .- .-RV .-r"   c                p   ^ RI pRV n        \        V 4      pVeI   \        V4      ^ 8  d9   VR,          V n        VRRP	                  VP                  V4      4       2,          p\        P                  '       d7   \        V R4      '       d%   VRV P                   RV P                   R2,          p\        P                  '       g   \        V R4      '       d
   VR	,          p\        V R
4      '       d   \        V P                  R4      '       dw   \        V P                  R4      '       d:   VRV P                  P                   RV P                  P                   R2,          pM!VRV P                  P                   R2,          p\        V P                  4      ^ 8X  d   RM\        V P                  ^ ,          4      p\!        W4      p\#        V \$        4      '       d2   \'        WQ,           4      3V P                  R,          ,           V n        R# WQ,           pV3V P                  R,          ,           V n        R# )r   Nz
from user code:
 r   record_filenamez!
Last frame execution written to zD. To run only this frame while debugging, run torch._dynamo.replay('z').
re   z
Set TORCHDYNAMO_VERBOSE=1 for the internal stack trace (please do this especially if you're reporting a bug to PyTorch). For even more developer context, set TORCH_LOGS="+dynamo"
r   minifier_pathbuck_commandz
Minifier script written to zW. Run this buck command to find the smallest traced graph which reproduces this error: r   zQ. Run this script to find the smallest traced graph which reproduces this error.
:r   NN)	tracebackinnermost_user_frame_summaryget_real_stackr   rX  r
   r   replay_record_enabledr}  r  r   r   r  r  r,   r   r  r   KeyErrorr  )r  rd   r  r  re   old_msgnew_msgs   &&&    r    augment_exc_messager    s   '+C$$J#j/A"5+5b>(%bggi.C.CJ.O&P%QRR###5F(G(G01D1D0E F++,E3	

 >>>gc<88J	
 s%&&7_, , 3&&77/0C0C0Q0Q/R S0030C0C0P0P/QQSUC /0C0C0Q0Q/R S_ _C
 MQ&bC,<G/=G#x  .0388B<?-:,r"   c               $    V ^8  d   QhRRRRRR/# )r   r2  r   
compile_idr   r   ztuple[str | None, int | None]r   )r   s   "r    r!   r!     s$     	 		'	"	r"   c                    R pR pV P                   e-   V P                   P                  pV P                   P                  pWn        W#3# r1   )r  filenamelinenor  )r2  r  r  r  s   &&  r    get_exc_messager    sJ     HF%%111:://66Lr"   c                   V ^8  d   QhRR/# )r   r   r   r   )r   s   "r    r!   r!     s     ) ) )r"   c                 (    \        \        4       4      # r1   )filter_stackr   r   r"   r    get_stack_above_dynamor    s    ((r"   c               $    V ^8  d   QhRRRRRR/# )r   r  r   frameDynamoFrameType | Noner   rf   r   )r   s   "r    r!   r!     s)     C C	C1CCr"   c                    \        V R R4      pVf   R# Ve   \        4       pM
\        4       p\        P                  ! W2,           4      # )re   N)r   r  r   	from_list)r  r  re   stack_above_dynamos   &&  r    r  r    sK     lD1J  45)^!!"4"ABBr"   c                    V ^8  d   QhRRRR/# )r   stackr   r   r   )r   s   "r    r!   r!     s        r"   c                   \        4       pV  Fn  pVP                  f   K  RVP                  9   d    V# RVP                  9   g$   VP                  '       d   RVP                  9   d   K]  VP                  V4       Kp  	  V# )Nconvert_frame
eval_frameztorch._dynamo.optimize()r   r  lineappend)r  
user_stackr  s   &  r    r  r    ss    J>>!enn,  5>>)JJJ4

B%   r"   c                    V ^8  d   QhRRRR/# )r   rw   r   r   r   )r   s   "r    r!   r!     s      s s r"   c                x    ^RI Hp \        P                  ! V R2V 4      pV'       d   VP	                  ^4      # V # )r   )TORCH_DYNAMO_RESUME_IN_PREFIXz_(\w+)_at_\d+)resume_executionr  rematchgroup)rw   r  r  s   &  r    remove_resume_prefixr    s4    ?HH56oFME{{1~Kr"   c                    V ^8  d   QhRRRR/# )r   r  z!StackSummary | list[FrameSummary]r   r   r   )r   s   "r    r!   r!   (  s        "C    r"   c                   \        4       pV  Fs  pVP                  f   K  \        VP                  4      pV'       d-   V'       d%   VR,          P                  V8X  d   W!R&   W2n        K\  W2n        VP	                  V4       Ku  	  V# )a  
When we graph break, we create a resume function and make a regular Python call
to it, which gets intercepted by Dynamo. This behavior is normally shown in the
traceback, which can be confusing to a user. So we can filter out resume frames
for better traceback clarity.

Example:
File "..." line 3, in f
    <line 3>
File "..." line 5, in torch_dynamo_resume_in_f_at_80
    <line 5>
File "..." line 10, in torch_dynamo_resume_in_f_at_120
    <line 10>

becomes
File "..." line 10, in f
    <line 10>
r  )r   r  r  rw   r  )r  	new_stackr  rw   s   &   r    collapse_resume_framesr  (  sm    ( I>>!#EJJ/)B-"4"4"<!bMJJU#  r"   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# r   r  r   r3  r4  r  rI   r  r  r   r   r   )r   s   "r    r!   r!   K  s:      	
   "	
 	r"   c                $   R VP                    RVP                   RVP                   R2pVR,          pV\        4       ,          p\	        W4      pVe=   VR,          pVRP                  \        V4      4      ,          pVR,          pVR,          pV# )WON'T CONVERT r    line r   r   z
==========z.========== TorchDynamo Stack Trace ==========
zY
========== The above exception occurred while processing the following code ==========

)co_nameco_filenameco_firstlinenor	   r  rX  r
   )r  r3  r  r  rd   re   s   &&&&  r    rG  rG  K  s     a(8(8'9@S@S?TTVW  CCC:<C+J	
 	rww{:.//txJr"   c                    V ^8  d   QhRRRR/# )r   r3  r4  r   r   r   )r   s   "r    r!   r!   f  s      N s r"   c           	     Z    \        V R R4       R\        V RR4       R\        V R^ 4       R2# )r  z	<unknown>z (r  r  r  ))r   )r3  s   &r    format_frame_infor  f  sF    4K0
1 2D-56 7.231	6r"   c               $    V ^8  d   QhRRRRRR/# )r   r3  ztypes.CodeType | Nonereasonr   r   r   )r   s   "r    r!   r!   n  s"     
 
$9 
3 
3 
r"   c                :    V e   \        V 4      pRV RV 2# RV 2# )Nz6torch.compile intentionally decided to skip the frame z! and fall back to eager.
Reason: zVtorch.compile intentionally decided to skip the frame and fall back to eager.
Reason: )r  )r3  r  
frame_infos   && r    format_skip_frame_messager  n  sB    &t,
DZL Qh 	
h 	
r"   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# r  r   )r   s   "r    r!   r!   |  s:     	8 	8		8
	8  	8 "		8
 		8r"   c           	         \         P                  '       d   \        WW#4      # R VP                   RVP                   RVP
                   R\        4        2# )r  r   r  z 
due to: 
)r   r   rG  r  r  r  r	   )r  r3  r  r  s   &&&&r    format_error_msgr  |  sU     ~~~'?JJDLL>4+;+;*< ==8 8r"   )r   Fr1   )NN)
__future__r   re  loggingr  r   typingenumr   r   	functoolsr   pathlibr   r  r   r	   r
   r   r   r   r   r   torch._guardsrk   torch._utils_internalr   r   r   utilsr   typestorch._dynamo.variablesr   r   output_graphr   r  r   r   r   r'   	getLoggerr9   rg  rH  getArtifactLoggerrJ  RuntimeErrorr*   rB   rF   rH   rR   rT   rW   rY   r[   r]   r_   ra   ru   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r	  r  r  r  StopIterationLookupError
IndexErrorGeneratorExitr  AttributeErrorNotImplementedErrorr+  r  r  r(  r,  r0  _subclassesfake_tensorDataDependentOutputExceptionDynamicOutputShapeExceptionUnsupportedOperatorExceptionUnsupportedFakeTensorException$UnsupportedMutationAliasingException!exceptions_allowed_to_be_fallbackrM  r\  rr  rY  objectr|  r   r  r  r  r  r  r  r  r  r  rG  r  r  r  r   r"   r    <module>r     s   "2   	      X X / /  1   7'0;9 !>>33HnM B< B$	3 		!5 	 *  	 	/ / 	/ 		 		_ 		$ 	
, 

) 
	
( 	
'+ '"
E, 
E$*& *B	+? 		) 		1 	
2 8D 8$ :* 	2 	
#7 
	i 		' 	

, 

 1  	+ 	
	, 	
	* 	
	- 		. 	
	, 	
	"3 		) 	 ,$"(*&4 
 , 6:	
 15B8
.< 
!!>>	!!==	!!>>	!!@@	!!FF% !#L4 1 40 8%0 %0 %0 %0T 	.-b	)CB  F6
	8 	8r"   