
    9i                    
   % S 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Jr  SSKJrJrJr  SSK
JrJrJrJr  SSK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 J!r!J"r"J#r#J$r$  S
SK%J&r&J'r'J(r(J)r)J*r*J+r+J,r,J-r-  S
SK.J/r/J0r0  S
SK1J2r2  S
SK3J4r4J5r5J6r6J7r7J8r8  S
SK9J:r:J;r;J<r<J=r=J>r>J?r?J@r@JArAJBrBJCrCJDrDJErEJFrFJGrGJHrHJIrIJJrJJKrK  SSKLJMrMJNrNJOrO  SSKPJQrQ  SSKRJSrSJTrT  SSKUJVrVJWrWJXrXJYrYJZrZJ[r[J\r\  SSK]J^r^J_r_J`r`JaraJbrbJcrc  SSKdJereJfrfJgrgJhrhJiri  SSKjJkrkJlrlJmrmJnrn  \(       a  SSKoJprp  SSKqJrrr  \R                  " \t5      ru\R                  \R                  \R                  \R                  \R                  \R                  \R                  \R                  \R                  \R                  \GR                   \GR                  \GR                  \GR                  \GR                  \GR                  \GR
                  \GR                  \GR                  \GR                  \GR                  \GR                  \GR                  \GR                  \GR                  \GR                  0r\S\
R&                  \
R&                  /\O4   r\\\O   \\\O   S4   4   r\GR(                  \#GR*                  \GR,                  \#GR.                  \GR0                  \#GR2                  \GR4                  \#GR6                  \GR8                  \#GR:                  \GR<                  \#GR>                  0r\GR                  \R                  \GRB                  \R                  \R                  \GR                  \R                  \GR0                  \GR8                  \GR<                  \GR4                  \GR,                  \GR(                  \R                  \GR                  \R                  \GR                  \R                  \R                  \GR                   \R                  \R                  4r\GR                  \GR                  \GR                  \GR                  \GR                  \GR                  4r\GRH                  4r\GR                  \GR                  \GR                  \GR
                  \GRL                  4r\GRP                  \GRR                  \GRT                  \GRV                  \GRX                  4r0 q\\S\4   \S\4   4   \S'   0 q\\S\4   \S\4   4   \S'   S r " S  S!\O5      r\GRh                  S" 5       rg)#a\  
Built-in function and type variable tracking for TorchDynamo's symbolic execution.

This module contains variable tracker classes for Python built-in functions, types,
and operations during graph compilation. It handles symbolic execution of:

- Built-in functions (len, getattr, isinstance, etc.)
- Type constructors (int, float, str, list, dict, etc.)
- Built-in operators and methods
- Special Python constructs (super, hasattr, etc.)

Key classes:
- BuiltinVariable: Tracks built-in functions and handles their execution
- TypeVariable: Manages type constructor calls and type checking
- SuperVariable: Handles super() calls in class hierarchies

These variable trackers ensure that built-in Python operations are correctly
handled during symbolic execution, either by executing them directly when safe
or by creating appropriate graph nodes when needed.
    N)defaultdictOrderedDict)IterableKeysViewSequence)AnyCallableTYPE_CHECKINGUnion)	sym_floatsym_int)is_sparse_any)BaseTorchFunctionMode)is_traceable_wrapper_subclass   )configgraph_break_hints	polyfills	variables)AttributeMutationErrorObservedAttributeErrorObservedUserStopIterationraise_observed_exceptionunimplemented_v2Unsupported	UserErrorUserErrorType)GuardBuilderinstall_guard)DummyModule)
AttrSourceGetItemSourceGlobalSourceis_constant_source
TypeSource)check_constant_argscheck_numpy_ndarray_argscheck_unspec_or_constant_argscheck_unspec_python_argscmp_name_to_op_mappingdict_methodsextract_fake_example_valuefrozenset_methodsget_fake_valueguard_if_dynis_tensor_getset_descriptoris_wrapper_or_member_descriptoristypenumpy_operator_wrapperproxy_args_kwargsset_methodsstr_methodstensortype_to_dtype   )#AsPythonConstantNotImplementedErrorValueMutationNewVariableTrackerConstantVariable)EventVariableStreamVariable)ConstDictVariableDefaultDictVariableDictKeysVariableDictViewVariableFrozensetVariableis_hashableSetVariable)BaseListVariableListIteratorVariableListVariableSizeVariableTupleIteratorVariableTupleVariable)FakeItemVariablesupported_comparison_opsSymNodeVariableTensorVariableUnspecializedPythonVariable)MutableMappingVariableUserDefinedDictVariableUserDefinedObjectVariableUserDefinedVariable)	PyCodegen)InstructionTranslatorrW   .BUILTIN_TO_TENSOR_FN_MAPBUILTIN_TO_TENSOR_RFN_MAPc                  r  ^^^	^
^ [        [        5      S:  a  g S m " U4S jS[        5      n [        R                  " S5      m[        R                  " S5      m	[        R                  " S[        R
                  S9m[        R                  " S[        R
                  S9m
U " 5          U4S j[        4U4S j[        4UU	4S j[        4UU
4S	 j[        4U4S
 j[        4/nU H$  u  p#U H  nU" U5        Tc   eT[        U'   M     M&     U	4S j[        4U
4S j[        4U4S j[        4/n[        R                  [        R                  [        R                  1nU H:  u  p#U H/  nXF;   a  M
  U" U5        Tc   eT[        U   :w  d  M&  T[        U'   M1     M<     S S S 5        g ! , (       d  f       g = f)Nr   c                   *   > \ rS rSrSrSU 4S jjrSrg)8populate_builtin_to_tensor_fn_map.<locals>.GetMethodMode   z
Mode to extract the correct methods from torch function invocations
(Used to get the correct torch.Tensor methods from builtins)
 Nc                 .   > U=(       d    0 nUmU" U0 UD6$ Nr^   )selffunctypesargskwargsmost_recent_funcs        _/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/torch/_dynamo/variables/builtin.py__torch_function__Kpopulate_builtin_to_tensor_fn_map.<locals>.GetMethodMode.__torch_function__   s"    \rF#(((    )r^   N)__name__
__module____qualname____firstlineno____doc__rh   __static_attributes__)rf   s   rg   GetMethodModer\      s    	
	) 	)rj   rq   r8   )dtypec                    > U " T5      $ r`   r^   )oinp0s    rg   <lambda>3populate_builtin_to_tensor_fn_map.<locals>.<lambda>   s	    qwrj   c                    > U " T5      $ r`   r^   rt   inp0_ints    rg   rv   rw      s	    q{rj   c                    > U " TT5      $ r`   r^   )rt   ru   inp1s    rg   rv   rw      s    qt}rj   c                    > U " TT5      $ r`   r^   )rt   rz   inp1_ints    rg   rv   rw      s    q8,rj   c                    > U " TS5      $ Nr   r^   ry   s    rg   rv   rw      s    q1~rj   c                    > U " ST5      $ Nr8   r^   )rt   r|   s    rg   rv   rw     s    !At*rj   c                    > U " ST5      $ r   r^   )rt   r~   s    rg   rv   rw         qH~rj   c                    > U " ST5      $ r   r^   ry   s    rg   rv   rw   	  r   rj   )lenrX   r   torchonesint32un_ops
un_int_opsbin_opsbin_int_opstensor_and_int_opsoperatormatmulimatmulgetitemrY   )rq   setups_and_oplistssetup_fnop_listoprsetups_and_oplistsrskipsru   rz   r|   r~   rf   s          @@@@@rg   !populate_builtin_to_tensor_fn_mapr      sw   
#$q( 	
)- 
) ::a=D::a=Dzz!5;;/Hzz!5;;/H	'"J/$g.,k:%'9:N
 "4H'333/?(,  "4 % &{3%'9:O
 //8#3#3X5E5EF!4H<'333#'?'CC4D-b1  "53 
s   'C#F(F((
F6c            
       T  ^  \ rS rSr% Sr\" 5       rS1\R                  kr\	S 5       r
\\R                  S 5       5       rS r\\R                  S 5       5       r\\R                  S\\S	\4   \\\   \S	\4   4   4   4S
 j5       5       r\\R                  S 5       5       r\S 5       rS rShU 4S jjrS\4S jrS rU 4S jrSiS jrS rS r S r!S r"\S 5       r#S r$\S\\%   S\&4S j5       r'SjS jr(SjS jr)0 r*\\\S	4   \S\+\   \\\4   /\4   4   \,S '   SSS!\+S"   S#S$SS"4S% jr-      SkU 4S& jjr.SjS' jr/\/r0\/r1SjS( jr2SjS) jr3SjS* jr4SjS+ jr5SjS, jr6\4r7\4r8SlS- jr9SlS. jr:SlS/ jr;SjS0 jr<SjS1 jr=S2 r>SjS3 jr?SjS4 jr@ Sm SjS5 jjrAS6 rBSmS7 jrCSjS8 jrD\CrE\CrFSjS9 jrGS: rHSjS; jrISjS< jrJ\SjS= j5       rK\  SjS> j5       rLSjS? jrMSjS@ jrNSjSA jrOSjSB jrPSjSC jrQSjSD jrRSjSE jrSSjSF jrTSjSG jrUSjSH jrVSjSI jrWSjSJ jrXSjSK jrY SmSSSL\SM\4SN jjrZSSSL\SM\SO\4SP jr[SSSL\SM\4SQ jr\SSSL\4SR jr]SSSL\4SS jr^SSSL\S#\4ST jr_SjSU jr`SjSV jraSjSW jrbSjSX jrcSjSY jrdSjSZ jreSjS[ jrfSjS\ jrgSjS] jrhSjS^ jriSjS_ jrjSjS` jrkSjSa jrlSjSb jrmSjSc jrnSSSd\Se\4Sf jroSgrpU =rq$ )nBuiltinVariablei  a  
A VariableTracker that represents a built-in value (functions and operators).
A lot of the code here assumes it will be a function object.

The BuiltinVariable class wraps Python built-in functions (like len, isinstance, etc.)
and operators (like +, -, *, etc.) to enable symbolic execution during tracing. This allows
Dynamo to properly handle these operations when converting Python code to FX graphs while
maintaining correct semantics and enabling optimizations.
fnc                 ^    [        UR                  [        R                  5      5        U " XS9$ Nsource)r   
make_guardr   BUILTIN_MATCH)clsvaluer   s      rg   create_with_source"BuiltinVariable.create_with_source(  s&    f''(B(BCD5((rj   c                  :   1 [         i[        i[        i[        i[        i[
        i[        i[        i[        i[        i[        i[        i[        i[        i[        i[        i[         i["        i[$        i[$        R&                  i[(        i[*        i[,        R                   i[,        R.                  i[,        R0                  i[,        R2                  i[,        R4                  i[,        R6                  i[,        R                  i[,        R8                  i[,        R:                  i[,        R<                  i[,        R>                  i[,        R@                  i[,        RB                  i[,        RD                  i[,        RF                  i[,        RH                  i[,        RJ                  i[,        RL                  i[,        RN                  i[,        RP                  i[,        RR                  i[,        RT                  i[,        RV                  i[,        RX                  i[,        RZ                  i[,        R\                  i[,        R^                  i[,        R`                  i[,        Rb                  i[,        Rd                  i[,        Rf                  i[,        Rh                  i[,        Rj                  i[,        Rl                  i[,        Rn                  in SSK8J9n  U Ru                  URv                  " 5       5        U Ru                  S [x        Rz                  Rw                  5        5       5        U $ )Nr8   )rN   c              3   z   #    U  H1  n[        U[        [        R                  5      5      (       d  M-  Uv   M3     g 7fr`   )
isinstancetypemathsqrt.0xs     rg   	<genexpr>;BuiltinVariable._constant_fold_functions.<locals>.<genexpr>n  s%     W4
1d499o8V114s   ,;	;)>absallanyboolcallablechrcomplexdivmodfloatgetattrintr   maxminordpowreprroundstrformatsumr   r   posnegnot_truthinvertmulr   floordivtruedivmodaddsubr   length_hintlshiftrshiftand_or_xoripowimulr   	ifloordivitruedivimodiaddisubilshiftirshiftiandixoriorindextensorrN   updatevaluesr   __dict__)fnsrN   s     rg   _constant_fold_functions(BuiltinVariable._constant_fold_functions-  sU   :
:
:
 :
 	:

 :
 :
 :
 :
 :
 :
 :
 :
 :
 :
 :
  !:
" #:
$ %:
& ':
( JJ):
* +:
, -:
. LL/:
0 LL1:
2 LL3:
4 MM5:
6 NN7:
8 OO9:
: LL;:
< LL=:
> OO?:
@ A:
B C:
D LLE:
F LLG:
H LLI:
J K:
L   M:
N OOO:
P OOQ:
R MMS:
T LLU:
V LLW:
X MMY:
Z MM[:
\ ]:
^ _:
` a:
b MMc:
d MMe:
f MMg:
h i:
j k:
l MMm:
n MMo:
p LLq:
r NNs:
v 	5

+2245

Wdmm224WW
rj   c                 <    U R                   U R                  5       ;   $ r`   )r   r   ra   s    rg   can_constant_fold_through)BuiltinVariable.can_constant_fold_throughq  s    ww$77999rj   c                     1 [         R                  i[         R                  i[         R                  i[         R                  i[         R
                  i[         R                  i[         R                  i[         R                  i[         R                  i[         R                  i[         R                  i[         R                  i[         R                  i[         R                  i[         R                  i[         R                   i[         R"                  i[         R$                  i[         R&                  i[         R(                  i[         R*                  i[         R,                  i[         R.                  i[         R0                  i[         R2                  i[         R4                  i[         R6                  i[         R8                  i[         R:                  i[         R<                  i[         R>                  i[         R@                  i[         RB                  i[         RD                  i[         RF                  i[         RH                  i[         RJ                  i[         RL                  i[         RN                  in U $ r`   )(r   r   r   r   r   r   r   r   r   r   r   r   r   ltgtgeleneeqr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   s    rg   _fx_graph_functions#BuiltinVariable._fx_graph_functionst  sQ   (
LL(
LL(
 LL(
 MM	(

 OO(
 LL(
 LL(
 OO(
 (
 (
 LL(
 LL(
 KK(
 KK(
 KK(
  KK!(
" KK#(
$ KK%(
& LL'(
(   )(
* OO+(
, OO-(
. MM/(
0 LL1(
2 LL3(
4 MM5(
6 MM7(
8 9(
: ;(
< =(
> ?(
@ MMA(
B MMC(
D MME(
F G(
H I(
J MMK(
L MMM(
N LLO(
R 
rj   return.c                     [         R                  / SQ[         R                  4[         R                  / SQ[         R                  4[         R
                  / SQ[         R                  4[         R                  / SQ[         R                  4[         R                  / SQ[         R                  4[         R                  / SQ[         R                  4[        / SQ[         R                  4[         R                  / SQ[         R                  4[         R                  / SQ[         R                   4[         R"                  / S	Q[         R$                  40
n U $ )
N)__add____radd____iadd__)__sub____rsub____isub__)__mul____rmul____imul__)__truediv____rtruediv____itruediv__)__floordiv____rfloordiv____ifloordiv__)__mod____rmod____imod__)__pow____rpow____ipow__)
__lshift____rlshift____ilshift__)
__rshift____rrshift____irshift__)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   s    rg   _binopsBuiltinVariable._binops  s     LL>NLL>NLL>N?!! B""  LL>N5x}}ELL>NOO<   OO<  'U
> 
rj   c            
      "  ^^^^^^^^ SSK JmJm  SSKJm  SSKJm  SSKJm  SSK	J
mJmJm  0 n [        R                  5       R                  5        GH  u  nu  p#/ X'   / X'   Uu  pEnUUS.U4S jjnX   R!                  T["        4U45        X   R!                  ["        T4U45        US	. SS
 jjnX   R!                  T["        4U45        X   R!                  ["        T4U45        US.SS jjn	X   R!                  [$        ["        4U	45        X   R!                  ["        [$        4U	45        X   R!                  [$        ["        4U	45        X   R!                  ["        [$        4U	45        GM     SS jn
SS jn[&        [&        4U4[&        [(        4U4[(        [&        4U4[(        [(        4U
4[(        [*        4U
4[*        [(        4S 4[,        [.        [*        [0        44S 4[.        [.        4S 4/nU [2        R4                     R7                  U5        SS jn[,        ["        4U4[(        [(        4U
4[(        [*        4U
4/nU [2        R8                     R7                  U5        SS jn[,        [*        4U4[(        [*        4U4[*        [,        4U4[*        [(        4U4/nU [2        R:                     R7                  U5        UUUUUUUU4S jn[<        R>                  " 5        H&  n[A        U5      (       d   eX;  d   eU" U5      X'   M(     U $ )Nr8   )BaseUserFunctionVariableUserFunctionVariableNNModuleVariable)supported_const_comparison_ops)BaseTorchVariable)UserDefinedClassVariablerT   rU   )forward_namereverse_namec                v   > [        UT5      (       a  UR                  XU/0 5      $ UR                  XU/0 5      $ r`   )r   call_method)txabr   r!  rU   s        rg   user_defined_handler=BuiltinVariable._binop_handlers.<locals>.user_defined_handler  s=    , a!455==A3CC==A3CCrj   )r   c                *    UR                  XU/0 5      $ r`   r#  )r$  r%  r&  r   s       rg   user_defined_inplace_handlerEBuiltinVariable._binop_handlers.<locals>.user_defined_inplace_handler  s     }}RsB??rj   r   c          
      n    SSK Jn  U" U U R                  R                  " SU/[	        X/0 5      Q76 5      $ Nr8   wrap_fx_proxycall_function)builderr1  outputcreate_proxyr4   )r$  r%  r&  r   r1  s        rg   dynamic_handler8BuiltinVariable._binop_handlers.<locals>.dynamic_handler   s=    2$II**'.?.K rj   c                 R    [        / UR                  QUR                  U 5      Q5      $ r`   )rL   itemsunpack_var_sequencer$  r%  r&  s      rg   tuple_add_handler:BuiltinVariable._binop_handlers.<locals>.tuple_add_handler<  s'     !G177!GQ-B-B2-F!GHHrj   c                 R    [        / UR                  QUR                  U 5      Q5      $ r`   )rJ   r9  r:  r;  s      rg   size_add_handler9BuiltinVariable._binop_handlers.<locals>.size_add_handler?  s'     F!'' FA,A,A",E FGGrj   c                 R    [        / UR                  U 5      QUR                  Q5      $ r`   )rL   r:  r9  r;  s      rg   rv   1BuiltinVariable._binop_handlers.<locals>.<lambda>d  s-    ..r2"rj   c                 `    [        / UR                  QUR                  U 5      Q[        5       S9$ Nmutation_type)rI   r9  r:  r:   r;  s      rg   rv   rB  p  s+    :agg: 5 5b 9:"2"4"rj   c                 T    [        U5      " / UR                  QUR                  Q5      $ r`   )r   r9  r;  s      rg   rv   rB  w  s*    a"rj   c                     UR                  5       (       d  UR                  U 5      (       d  g UR                  U 5      nU R                  R                  R                  U5        UR                  R                  U5        U$ r`   )is_immutablehas_unpack_var_sequencer:  r4  side_effectsmutationr9  extend)r$  r%  r&  seqs       rg   list_iadd_handler:BuiltinVariable._binop_handlers.<locals>.list_iadd_handler  s_    ~~q'@'@'D'D''+CII""++A.GGNN3Hrj   c                 D   [        U[        5      (       a  X!p! UR                  UR                  UR	                  5       -  [        5       S9$ ! [         aI  n[        [        U5      U [        [        [        R                  UR                  5      5      S9   S nAg S nAff = f)N)r9  rF  rd   )r   r=   	__class__r9  as_python_constantr:   MemoryErrorr   r   listmapcreaterd   )r$  lstconstexcs       rg   expand_list_like9BuiltinVariable._binop_handlers.<locals>.expand_list_like  s    #/00"U
}}))e&>&>&@@"2"4 %    (Ic"2"9"9388DEs   2A 
B?BBc                 X  >^ ^
 SU 4S jjn[         [         4U4/nT [        ;   a~  [         [         4U4/n[        T 5      nUR                  [        [
        4UR                  4[
        [        4UR                  4/5        U 4S jnUR                  [
        [
        4U45        U$ [         [         4U4/nT TR                  5       ;   Gac  T R                  R                  S5      (       GaB  T " [        5       S 5      m
SU
4S jjnUnUn[        [        T[        TT[        T4nUR                  U[         4U4[         U4U4/5        [        T 5      nUR                  T[        4T[        44U 4S j4TT4U 4S j4TT4U4TT4U4[        [         [         4[        [         [         44U4[        [
        4UR"                  4[
        [        4UR"                  4[        [
        4UR                  4[
        [        4UR                  4/	5        SU 4S jjn	UR                  [
        [
        4U	45        U$ )	Nc                    >  [        T" UR                  UR                  5      5      $ ! [         aI  n[        [	        U5      U [        [        [         R                  UR                  5      5      S9   S nAg S nAff = f)NrR  )	r=   r   	TypeErrorr   r   rV  rW  rX  rd   )r$  r%  r&  r[  r   s       rg   compare_by_valueYBuiltinVariable._binop_handlers.<locals>.create_cmp_op_handlers.<locals>.compare_by_value  s^    +Bqww,@AA  ,S	!#&6&=&=sxx"HIs   %) 
A<?A77A<c                 d   > U R                  [        R                  " U [        T   5      X/0 5      $ r`   )inline_user_function_returnr;   buildpolyfill_fn_mappingr$  r%  r&  r   s      rg   handlerPBuiltinVariable._binop_handlers.<locals>.create_cmp_op_handlers.<locals>.handler  s3    99'--b2Eb2IJQFTV rj   is_c                    > [        T5      $ r`   r<   )r$  r%  r&  none_results      rg   neverNBuiltinVariable._binop_handlers.<locals>.create_cmp_op_handlers.<locals>.never  s    +K88rj   c                 P   > [        T" UR                  UR                  5      5      $ r`   )r=   r   rg  s      rg   rv   QBuiltinVariable._binop_handlers.<locals>.create_cmp_op_handlers.<locals>.<lambda>  s    -=bqttn-Mrj   c                    > [        T" U R                  R                  UR                  5      U R                  R                  UR                  5      5      5      $ r`   )r=   r4  get_submodule
module_keyrg  s      rg   rv   rp  #  s?    -= "$&II$;$;ALL$I$&II$;$;ALL$I!".rj   c                   > [        U5      [        U5      La#  [        R                  " TR                  S:g  5      $ XL a  [        R                  " T" X5      5      $ [	        U[
        R                  5      (       aV  [	        U[
        R                  5      (       a6  UR                  UR                  La  [        R                  " T" X5      5      $ g g g )Nrj  )r   r=   rX  rk   r2   r   ExceptionVariableexc_type)r$  leftrightr   s      rg   	handle_isRBuiltinVariable._binop_handlers.<locals>.create_cmp_op_handlers.<locals>.handle_isL  s     Dze4/66r{{e7KLL}/66r$GGtY%@%@AA"5)*E*EFF MM?/66r$GG @ G Brj   r$  rW   )r=   rf  r   rM  rO   r;   _comparison_with_symnodeappendr   rk   
startswithobjectrP   rG   r@   r?   r>   _comparison_with_tensor)r   ra  resultop_varrh  rm  obj_op_nonenone_op_objtypes_that_are_never_nonery  rl  r  r  r  r  rT   rU   r  r  s   `         @rg   create_cmp_op_handlers?BuiltinVariable._binop_handlers.<locals>.create_cmp_op_handlers  s   $ $%568HIJ  (( -.>?AQRS(, -o>";;
 -o>";;	
 A7KL(*:;=MNOF3::<<AWAWB B !409 $# ##$$',%%	-)  78HI'
 ./HI'	 ), "6 G!5 G N !1 0 78QR,
 67OP, "0@P Q!/@P Q - ,_="::
 -n="::
 -o>";;
 -o>";;_35nH A9MNMrj   r{  )!	functionsr  r  	nn_moduler  r   r  r   r  user_definedr  rT   rU   r   r  r9  r}  r;   rO   rJ   rL   r=   rI   rG   rH   r   r   rM  r   r   rN   r   r   )op_handlersr   magic_method_namesin_place_opr   r!  inplace_namer'  r+  r6  r<  r?  list_like_addition_handlersrO  list_like_iadd_handlersr\  list_like_expansion_handlersr  r  r  r  r  rT   rU   r  r  s                     @@@@@@@@rg   _binop_handlersBuiltinVariable._binop_handlers  s    	N/:,	
 	
$  	 $$&,,.
- KO')K$7I4L *)D D6 O""%79MN O""!#679MN
 DP@+@
 $++%79UV $++!#679UV
 JL  O""!?3_E O""!?3_E
 $++!?3_E $++!?3_EW /d	I	H  |, 
 }- 
 - 
 .!
  01!
 "=1 !%'79MN	 "#34W4
 	$z 	HLL!(()DE	" /!
 .!
  01!
 	 & 	HMM"))*AB	* ,-/?@-.0@A-/?@.0@A	
 	% 	HLL!(()EF_	 _	B +113BB<<<(((4R8KO 4
 rj   c                     [         R                  5       R                  U 5      nUc  g / nU H=  u  u  pVn[        X5      (       d  M  [        X&5      (       d  M,  UR	                  U5        M?     U$ r`   )r   r  get
issubclassr}  )r   a_typeb_typehandlersmatchestype1type2rh  s           rg   _find_binop_handler#BuiltinVariable._find_binop_handlere  sb    "22488<'/#NUG&((Z-F-Fw' (0 rj   c                 <    U R                   U R                  5       ;   $ r`   )r   r   r   s    rg   can_insert_in_graph#BuiltinVariable.can_insert_in_graphq  s    ww$22444rj   c                 2   > [         TU ]  " S0 UD6  Xl        g )Nr^   )super__init__r   )ra   r   re   rS  s      rg   r  BuiltinVariable.__init__t  s    "6"rj   c                     U R                   c  SnOU R                   R                  nU R                  R                   SU S3$ )NNone())r   rk   rS  )ra   names     rg   __repr__BuiltinVariable.__repr__x  s=    77?D77##D..))*!D633rj   c                     U R                   $ r`   r-  r   s    rg   rT  "BuiltinVariable.as_python_constant  s    wwrj   c                    > [         [        R                   [        [        R                  [        [        R
                  0nU R                  U;   a  XR                     $ [        TU ]!  5       $ r`   )	r   r   r   int64r   float64r   r  as_proxy)ra   DTYPErS  s     rg   r  BuiltinVariable.as_proxy  sM    %**5==

 77e>!w!!rj   c                     U R                   R                  nU R                   R                  S:X  d   eX!R                  R                  ;  d   S5       eUR                  UR                  USS95        g )Nbuiltinszshadowed globalT)r   )r   rk   rl   r$  	f_globalsappend_outputcreate_load_global)ra   codegenr  s      rg   reconstructBuiltinVariable.reconstruct  sc    wwww!!Z///::///B1BB/g8848HIrj   c                     [        X5      $ r`   )r&   ra   rd   re   s      rg   constant_argsBuiltinVariable.constant_args  s    "400rj   c                     SnU HG  n[        U[        R                  5      (       a    gU=(       d    [        U[        R                  5      nMI     U$ NF)r   r   GetAttrVariablerP   )ra   rd   
any_tensorargs       rg   tensor_argsBuiltinVariable.tensor_args  sF    
C#y8899#Pz#y7O7O'PJ  rj   c                     SnU HG  n[        U[        R                  5      (       a    gU=(       d    [        U[        R                  5      nMI     U$ r  )r  r   r  rP   )ra   	arg_typesr  arg_types       rg   tensor_args_type BuiltinVariable.tensor_args_type  sF    
!H(I$=$=>>#Uz(I<T<T'UJ " rj   c                 6   / n/ n[         R                  " XR                  5       5       HF  n[        U[        R
                  5      (       a  UR                  U5        M5  UR                  U5        MH     [        S U 5       5      =(       a    U R                  " U6 $ )Nc              3   j   #    U  H)  nUR                   b  [        UR                   5      OSv   M+     g 7fr  )r   r$   )r   ts     rg   r   BBuiltinVariable.python_and_tensor_constant_only.<locals>.<genexpr>  s/      
  -.HH,@qxx(eK s   13)		itertoolschainr   r   r   rP   r}  r   r  )ra   rd   re   r  non_tensor_argsis         rg   python_and_tensor_constant_only/BuiltinVariable.python_and_tensor_constant_only  s    }}7A!Y5566""1%&&q)	 8
  
 
 
 3   /2	3rj   c                     U  Vs/ s H  o"R                  5       PM     snUR                  5        VVs0 s H  u  p4X4R                  5       _M     snn4$ s  snf s  snnf r`   )rT  r9  )rd   re   r   kvs        rg   unwrap_unspec_args_kwargs)BuiltinVariable.unwrap_unspec_args_kwargs  sX    0451$$&528,,.8
2@$!A##%%.8
 
 	
5 8
s
   AAc                 F    U R                  5       =(       a    [        X5      $ r`   )r   r(   r  s      rg   has_constant_handler$BuiltinVariable.has_constant_handler  s#    --/ 
4Q5
 	
rj   r  
has_kwargsc                   ^ ^^^^	^
^^^^^ SSK Jm  [        T 5      m/ m[        U4S jT 5       5      (       a  U4S j$ [        R
                  " T 5      (       a*  [        T [        5      (       d	  T [        L a    SU 4S jjnU$ TR                  5       (       ay  T [        R                  L a"  [        TS   [        R                  5      (       aD  TR                  T5      (       a  TR                  $ T(       a  TR!                  TR                  5        [#        T5      S:X  ah  T(       da  [        R$                  " T /TQ76 m
T
(       d  OB[#        T
5      S:X  a  T
u  m	TR!                  U	4S j5        OSU
4S	 jjnTR!                  U5        ['        TS
T R(                   3S 5      mT(       a  SU UU4S jjnTR!                  U5        TR+                  5       (       a@  [-        S T 5       5      (       a  T(       d	  SU 4S jjnOSU 4S jjnTR!                  U5        UU U4S jm[#        T5      S:X  a  U4S j$ [#        T5      S:X  a  Tu  mSUU4S jjnU$ SUU4S jjnU$ )Nr8   )LazyVariableTrackerc              3   <   >#    U  H  n[        UT5      v   M     g 7fr`   )r  )r   r  r  s     rg   r   0BuiltinVariable._make_handler.<locals>.<genexpr>  s     E9az!0119s   c                 n   > TR                  X Vs/ s H  o3R                  5       PM     snU5      $ s  snf r`   )r2  realize)r$  rd   re   r  objs       rg   rv   /BuiltinVariable._make_handler.<locals>.<lambda>  s-    C,=,=$/$QYY[$/-/s   2
c                    > T[         L a<  [        S U 5       5      (       d%  [        S[        U5      S/ [        R
                  QS9  [        R                  " TU40 UD6$ )Nc              3      #    U  H@  n[        U[        R                  5      =(       a    [        UR                  [        5      v   MB     g 7fr`   )r   r   r=   r   r   r   s     rg   r   WBuiltinVariable._make_handler.<locals>.create_exception_class_object.<locals>.<genexpr>  s>      4 " q)"<"<= 1"177C01!s   AA
zassert with non-string messagez1Dynamo only supports asserts with string messagesgb_typecontextexplanationhints)AssertionErrorr   r   r   r   SUPPORTABLEr   ru  )r$  rd   re   r   s      rg   create_exception_class_objectDBuiltinVariable._make_handler.<locals>.create_exception_class_object  sh     ' 4 "4 1 1
 % @ #D	$W> 1 = =>	 !222tFvFFrj   r   r   c                    > T" U /UQ76 $ r`   r^   )r$  rd   _binop_handlers      rg   rv   r    s    M"4Lt4Lrj   c                 @   > T H  nU" U /UQ76 nU(       d  M  Us  $    g r`   r^   )r$  rd   r  r   rvbinop_handlerss        rg   call_binop_handlers:BuiltinVariable._make_handler.<locals>.call_binop_handlers  s$    ,]T]2#%I -rj   call_c                   >  T	" U /UQ70 UD6nUb  U$ g ! [          a     [        R                  " T	5      R                  " U /UQ70 UD6  e ! [          ar  nTR	                  X5      nU(       dO  [
        R                  ST	U5        [        SST	 SU SU 3STR                   3/ [        R                  QS9   S nA g  S nA g S nAff = f[         a3  nTR	                  X5      nU(       d  e UR                  5          S nAg S nAff = f)Nz1incorrect arg count %s %s and no constant handlerz"invalid call to builtin op handlerzinvalid args to z:  z/Encountered TypeError when trying to handle op r  )r`  inspect	signaturebindr  logwarningr   rk   r   	DIFFICULTr   remove_from_stats)
r$  rd   re   r  er  r[  r   r  self_handlers
          rg   call_self_handler8BuiltinVariable._make_handler.<locals>.call_self_handler  s%   ,)">t>v>F)% *  )),7<<RQ$Q&Q   % /2/G/G/U,3KK S , !
 -(L*:<.4&PQRXQY(Z.]^`^i^i]j,k&D(9(C(C&D	   4  # ,+.+C+CD+Q(/))++,sE    
D*A
D
CA!C6D<DCD)DDc              3   B   #    U  H  n[        U[        5      v   M     g 7fr`   )r  r=   r   s     rg   r   r  +  s     GYJq"233Y   c                   >  T" U Vs/ s H  o3R                  5       PM     sn6 n[        R                  " U W5      $ s  snf ! [         aI  n[        [        U5      U [	        [        [        R                  UR                  5      5      S9   S nANjS nAf[         a-  n[        SST SU 3S/ [        R                  QUS9   S nANS nAff = f)NrR  constant fold exceptionattempted to run function  with arguments 7Encountered exception when attempting to constant fold.r  r  r  r  from_exc)rT  	Exceptionr   r   rV  rW  r=   rX  rd   r9   r   r   
DYNAMO_BUGr;   re  )r$  rd   re   r   resr[  r   s         rg   constant_fold_handler<BuiltinVariable._make_handler.<locals>.constant_fold_handler/  s     >BCd224dC" +00S99! D$ 0 I!%c*:*A*A388&L!M
 ? ($=&@DTUYTZ$[(a"A$5$@$@"A%(s1   A =A A 
C
?BC
#CC
c                 0  > [        X5      (       ao   T" U Vs/ s H  o3R                  5       PM     sn0 UR                  5        VVs0 s H  u  pEXER                  5       _M     snnD6n[        R                   " U W5      $ g s  snf s  snnf ! [         a-  n[	        SST SU 3S/ [
        R                  QUS9   S nANUS nAf[         aI  n[        [        U5      U [        [        [        R                  UR                  5      5      S9   S nANS nAff = f)Nr  r  r  r  r  rR  )r(   rT  r9  r9   r   r   r  r  r   r   rV  rW  r=   rX  rd   r;   re  )	r$  rd   re   r   r  r  r  r[  r   s	           rg   r  r  G  s   4TBB"$BF!G$Q"6"6"8$!G# KQ,,.#"JX$!A';';'=$=.#"#C(  /44R==- C "H#"  C ,(A*DRDHXY]X^(_,e&E(9(D(D&E),  ) 4 $S	 "%)#.>.E.Esxx*P%Qs?   B BB B$B B 
D#B??D?DDc                    > U  Vs/ s H  oR                  5       PM     nn[        SSTR                   ST ST 3STR                   SU ST S3STR                   SU S	TR                   S
3SS/S9  g s  snf )Nz Failed to trace builtin operatorzbuiltin r  z4Dynamo does not know how to trace builtin operator `z` with argument types z (has_kwargs r  zAvoid calling builtin `z?. Consider using an equivalent alternative function/method to `z`.zIf you are attempting to call a logging function (e.g. `print`), you can try adding it to `torch._dynamo.config.reorderable_logging_functions`.z"Please report an issue to PyTorch.r  )python_type_namer   rk   )rd   r  real_arg_typesr  r   r  s      rg   call_unimplemented_v2<BuiltinVariable._make_handler.<locals>.call_unimplemented_v2c  s    @DE224NE:"2;;-q1ZLIRSUS^S^R_ `''5&6mJ<qR .bkk]:PQ_P` aTTVT_T_S``bde8 Fs   A6c                    > T" U5      $ r`   r^   )r$  rd   re   r  s      rg   rv   r  t  s    ,A$,Grj   c                 :   > T" XU5      nU(       a  U$ T" U5        g r`   r^   )r$  rd   re   r  r  rh  s       rg   builtin_dispatch7BuiltinVariable._make_handler.<locals>.builtin_dispatchx  s    Rv.I%d+rj   c                 P   > T H  nU" XU5      nU(       d  M  Us  $    T" U5        g r`   r^   )r$  rd   re   r   r  r  r  s        rg   r   r!    s-    "BBf-Br!	 # &d+rj   r{  )lazyr  r   r   r  isclassr  r  GeneratorExitr  r   r   r   rP   r  _handle_insert_op_in_graphr}  r   r  r   rk   r   r   )r   r  r  r  r  r  r  r   r  r  r  r  rh  r  r  r  s   ```     @@@@@@@@rg   _make_handlerBuiltinVariable._make_handler  s   -b!+-E9EEE  ??2r9%% ]"G+G" 10""$$("""y|Y-E-EFF##I..555 > >? y>Qz,@@PiPN!^$)#1  LM&  34seBKK=$94@, ,B OO-.((**GYGGG": :0>4 OO12	  x=AGG]a!JW, ,  , ,  rj   r$  rW   c                    [        U5      S:X  a0  [        SSU  SU 3SU R                   S3/ [        R                  QS9  [        U5      S:X  d   e US   R                  US	5      $ ! [         a    [        [        U5         g f = f)
Nr   z1unimplemented builtin op vars() with no argumentszvars: r  3Dynamo does not know how to trace builtin operator z with no argumentsr  r8   r   )	r   r   r   r   r  var_getattrr   r   r`  ra   r$  rd   s      rg   	call_varsBuiltinVariable.call_vars  s    t9>K av.QRVRYRYQZZlm6)556	 4yA~~	47&&r:66% 	4$Y3	4s   A' 'BBc           
         SSK JnJn  U(       a(  U R                  " / UQUR	                  5       Q76 (       d  g SSK Jn  SSKJnJn  U" XU5      (       a  UR                  (       d  [        5         [        US   [        5      (       dM  U R                  [        ;   a  [        U R                     n	O[        U R                     n	US   n
US   US'   XS'   O [        U R                     n	OU R                  n	UR!                  X5      nU" XX#5      $ U R                  n U R"                  " U0 UD6(       a&  SSKJn  SSKJn  U" XU" UR,                  5      X#5      $ U[.        ;   a4  [        US   [0        R2                  5      (       a  [.        U   US   US   /p,U[4        R6                  L aO  [        US   [8        5      (       a7  [:        R<                  US   [0        R2                  R!                  S5      US   /p,[?        X#5      (       a^  [A        S	 U 5       5      (       dG  URB                  RD                  " S
[G        U5      /[I        X#5      Q76 nU" [0        RJ                  X5      $ U[4        RL                  L aK  [O        U5      S:X  a<  [        US   [0        R                  5      (       a  US   RQ                  USUSS  U5      $ URB                  RD                  " S
U/[I        X#5      Q76 n[A        S U 5       5      (       a  U" [R        UU5      $ [U        X#5      (       a^  U RW                  X#5      u  nnU" U0 UD6n[A        S [X        RZ                  " X#R	                  5       5       5       5      nU" [\        UUUUS9$ [_        S U 5       5      (       a  [8        R                   " XS 5      $ U[4        R`                  L a8  [        US   [0        R\                  5      (       a  US   Rc                  5       US'   U" X5      $ ! [d         a6    [g        SSU  SU SU 3SU R                   S3/ [h        Rj                  QS9   g f = f)Nr8   )r1  wrap_fx_proxy_cls)SourcelessBuilder)can_dispatch_torch_functiondispatch_torch_functionr   r   )	unique_id)invoke_and_store_as_constantc              3   Z   #    U  H!  n[        U5      [        R                  :H  v   M#     g 7fr`   )r   r   rP   r   r  s     rg   r   =BuiltinVariable._handle_insert_op_in_graph.<locals>.<genexpr>  s#      BAE#S	Y555s   )+r2  __eq__c              3   B   #    U  H  n[        U[        5      v   M     g 7fr`   r   rM   r7  s     rg   r   r8    s     E:c#344r  c              3   |   #    U  H2  n[        U[        R                  5      (       d  M$  UR                  v   M4     g 7fr`   r   r   rQ   need_unwrapr   s     rg   r   r8    s-      "C!!Y%J%JK "AMMC   #<<)	raw_valuer>  c              3   B   #    U  H  n[        U[        5      v   M     g 7fr`   r   rO   r   s     rg   r   r8    s     BTZ?33Tr  z,unimplemented builtin op on tensor argumentszpartial tensor op: r  r*  z with tensor argumentsr  )6r3  r1  r0  r  r   r1  torch_functionr2  r3  exportr   r   rP   r   rY   rX   rX  r  bytecode_transformationr4  r  r5  rk   IN_PLACE_DESUGARING_MAPr   r=   r   r   rO   r   selectr'   r   r4  r5  r3   r4   NumpyNdarrayVariabler   r   r#  rM   r)   r  r  r  rQ   r   r   rT  NotImplementedErrorr   r   r  )ra   r$  rd   re   r1  r0  r1  r2  r3  rb   tmpfn_varr   r4  r5  proxy_args_kwargsr@  r>  s                       rg   r&  *BuiltinVariable._handle_insert_op_in_graph  s   =$**CDC6==?CC 	/X 'r88 9913!$q'>::ww";;8A7@q'C"1gDG!G3DGG<Dww&--b7F*2tDDWWe	33TDVD?C3Ibkk2D  ,,Q332 2 326a$q'8JDX%%%*T!Wo*N*N
 LLQ!2299!<Q  (55c BAEB ? ? 		..#*2. 't4 ))G)GSS hkk!INtAw	(@(@AA
 Aw**2xab6JJII** #40E
 EEEE($ 
 *$77!%!?!?!Mw11	! "&__T==?C"  )/' +  BTBBB&--b>> )))jGYBB/ / #1g88:DG$R//" 	F-dV1TF!F8DQRVRYRYQZZpq6)556		s;   <O? DO? &AO? AO? A-O? >-O? ,AO? ?=P?>P?call_function_handler_cacherd   r;   re   dict[str, VariableTracker]c           	         U(       aL  UR                  5        VVs0 s H  u  pEXER                  5       _M     nnnU R                  /S U 5       QSP7nOU R                  /S U 5       Q7nU R                  R	                  U5      nU(       dO  U R                  U R                  U Vs/ s H  n[        U5      PM     sn[        U5      5      =U R                  U'   nU" XU5      $ s  snnf s  snf )Nc              3   8   #    U  H  n[        U5      v   M     g 7fr`   r   r   s     rg   r   0BuiltinVariable.call_function.<locals>.<genexpr>:       4t!d1ggt   Tc              3   8   #    U  H  n[        U5      v   M     g 7fr`   rT  r   s     rg   r   rU  <  rV  rW  )r9  r  r   rP  r  r'  r   r   )	ra   r$  rd   re   r  r  keyrh  r   s	            rg   r2  BuiltinVariable.call_function1  s     17@anF@77;4t4;d;C7754t45C2266s;>B>P>P404a$q'40$v,? D,,S1G r(( A 1s   C%'C+
c                 H  > U R                   [        L a  US:X  a  [        U5      S:X  d   e[        U5      S:X  d   eUu  pVnUR                  5       n[	        U[
        5      (       aQ  UR                  R                  R                  U5      (       a'  UR                  5       (       a  UR                  XU5      $ US:X  GaL  U R                   [        L aL  [        U5      S:X  a=  [        U5      S:X  d   eUR                  R                  R                  XS   USS  5      $ U R                   [        L a  [        U5      S:X  a{  U(       dt  [        0 [        [        5       S9n[	        US   [        5      (       a  US   R                   [        L a  U$ UR                  R                  R                  U US   USS  5      $ U R                   [         L a  [        U5      S:X  a  US   R#                  U5      (       a  U(       d  [	        US   [        5      (       aG  US   R                   [         L a1  US   R%                  U5      n	[&        R(                  " U	[        5       S9$ UR                  R                  R                  U US   USS  5      $ U R                   [*        L ao  [-        / [        5       S9n
[	        US   [        5      (       a  US   R                   [*        L a  U
$ UR                  R                  R                  U US   USS  5      $ U R                   [.        L av  [        U5      S:X  ag  US;   aa  [	        US   [0        5      (       aI   [3        [.        U5      nU" US   R5                  5       5      n[&        R0                  R7                  U5      $ U R                   [        L a  US
:X  a  [&        R0                  " S 5      $ U R                   [        L a%  US:X  a  [        RD                  " U[        /UQ70 UD6$ U R                   [        L a  [3        U R                   U5      nU[F        ;   a  [	        US   [&        RH                  5      (       a#  US   RJ                  RM                  XUSS  U5      $ [	        US   [&        R                  5      (       a  US   RM                  XUSS  U5      $ U R                   [N        L a  [3        U R                   U5      nU[P        ;   a  [	        US   [&        RR                  5      (       a#  US   RT                  RM                  XUSS  U5      $ [	        US   [&        RV                  5      (       a  US   RM                  XUSS  U5      $ U R                   [X        L a[  [3        U R                   U5      nU[Z        ;   a;  [	        US   [&        R\                  5      (       a  US   RM                  XUSS  U5      $ U R                   [^        L a`  [        U5      S:  aQ  [3        U R                   U5      nU[`        ;   a1  [	        US   [0        5      (       a  US   RM                  XUSS  U5      $ U R                   [.        L ab  [        U5      S:  aS  [	        US   [0        5      (       a;  [0        R6                  " [3        [.        U5      " US   R5                  5       5      5      $ [b        TU ]  XX45      $ ! [8        [:        4 aJ  n[=        [?        U5      U[+        [A        [0        R6                  URB                  5      5      S	9   S nAGNS nAff = f)N__setattr__   r   __new__r8   rE  r   )fromhexhexrR  r  fromkeys)2r   r  r   r  r   rT   r4  rK  is_attribute_mutationis_python_constantmethod_setattr_standardtrack_new_user_defined_objectdictr@   r:   r   tuplehas_force_unpack_var_sequenceforce_unpack_var_sequencer   rL   rV  rI   r   r=   r   rT  rX  OverflowError
ValueErrorr   r   rW  rd   call_custom_dict_fromkeysr+   rS   _dict_vtr#  setr5   UserDefinedSetVariable_set_vtrF   	frozensetr-   rD   r   r6   r  )ra   r$  r  rd   re   r  name_varvaldict_vt	init_argslist_vtr   r  r  resolved_fnrS  s                  rg   r#  BuiltinVariable.call_methodE  s    77f!6t9>!>v;!###!%C3++-C3 9::II**@@EE//11222EE9ww& SY!^6{a'''yy--KKq'48  ww$3t9>&+BDTDVWd1g77DGJJ$<N"N yy--KKGH  5 ING99"==d1g77DGJJ%<O $Q A A" EI$22!1A1C  yy--KKGH  ww$&r9I9KLd1g77DGJJ$<N"Nyy--KKGH  77eD	Q4;M3M$q'#344	 -BT!W779:C$55<<SAA 77f!3--d3377d?tz1"<<RWWPVWW77d?!$''40Kl*d1gy'H'HII7++77$qr(FSSQ)D)DEE7..rab6JJ77c>!$''40Kk)d1gy'G'GHH7??66rab6RRQ)>)>??7..rab6JJ77i!$''40K//d1gy'B'BCC7..rab6JJ77c>c$i1n!$''40Kk)d1g'7887..rab6JJ77eD	Q$q'#344'..E4(a)C)C)EF  w"2T::a &z2 ,Q!#&6&=&=qvv"FG s   A[ \!?\\!c           	      h   [        U[        [        R                  45      (       a  [        U[        R                  5      (       a  UR	                  US/ 0 5      nOUnU R
                  [        L a  [        O[        nSSK	J
n  U" UUR                  R                  SUUR                  5       40 5      S9$ g )Nitemr   r0  r2  r$  rL  )r   rO   r   rP   r#  r   r   r   r   torch._dynamo.variables.builderr1  r4  r5  r  )ra   r$  r  rz  fn_r1  s         rg   _call_int_floatBuiltinVariable._call_int_float  s     cOY-E-EFGG#y7788r62r:!WW^'CE ii,,#]]_&	  Hrj   c                 H   [        U[        5      (       a  [        UR                  [        R                  5      (       a  U$ [        UR                  [        R                  [        R                  45      (       d   e[        R                  " XR                  5       S:g  5      $ g r   )
r   rO   sym_numr   SymBoolr2   SymIntSymFloatrX  r  ra   r$  r  s      rg   	call_boolBuiltinVariable.call_bool  st     c?++ #++u}}55

 #++enn'EFFFF"))"lln.ABB ,rj   c                    [        U[        R                  5      (       a0  [        R                  R	                  [        UR                  5      S9$ [        U[        R                  5      (       GaF  [        UR                  S5      (       a  UR                  R                  nOW[        UR                  S5      (       a  UR                  R                  nO%[        S[        U5      S/ [        R                  QS9  [        UR                  5      R                  [         R                  L a#   [        R                  R	                  W" 5       S9$ [%        W5      (       a$  [        SS[        UR                  5       S	3S
/S9  g UR&                  n [        R                  " U5      nUR/                  XR/0 5      $ [        U[        R0                  45      (       af  [3        UR4                  5      S:X  a  UR6                   nO"SR9                  S UR4                   5       5      n[        R                  R	                  US9$ g ! ["         a     g f = f! [(         a   n[*        R-                  SU5         S nAg S nAff = f)N)r   __str__r  z+failed to call str() on user defined objectz5User defined object has no __str__ or __repr__ methodr  z0Attempted to a str() method implemented in C/C++ z5 has a C/C++ based str method. This is not supported.zWrite the str method in Pythonz)Failed to create UserFunctionVariable: %sr   , c              3   @   #    U  H  oR                  5       v   M     g 7fr`   )rT  )r   r%  s     rg   r   +BuiltinVariable.call_str.<locals>.<genexpr>  s     !K(Q"6"6"8"8(s   )r   r   r  r=   rX  r   r   rT   hasattrr   r  r  r   r   
USER_ERRORr   r  AttributeErrorr1   __func__r  r  r  rd  ru  r   rd   rv  join)ra   r$  r  
str_methodbound_methoduser_func_variabler  r   s           rg   call_strBuiltinVariable.call_str  s   cI::<<--443svv;4GGiAACCsyy),, YY..
J// YY//
 IH W9-889	 CII&&&..8$55<<:<<PP 1<< N#'		?"33h i;<	  *22)2)G)G)U& 556H%QSTTi99;<<388}!<<.		!K#((!KK--4454AA =3 & $ & KK KQOs*   *!H= I =
I
	I

I7I22I7c                 ,   [        U5      S:X  a>  US   R                  U5      (       a%  US   R                  U5      nU R                  X5      $ [        U5      S:X  a  U R	                  XS   US   5      $ [        U5      S:  a  U R                  X5      $ g )Nr8   r   r   )r   rh  ri  _call_min_max_seq_call_min_max_binary)ra   r$  rd   r9  s       rg   _call_min_maxBuiltinVariable._call_min_max"  s    t9>d1gCCBGGG55b9E))"44Y!^,,Ra$q'BBY]))"33 rj   c                     [        U5      S:  d   e[        U5      S:X  a  US   $ [        R                  " [        R                  " U R                  U5      U5      $ Nr   r8   )r   	functoolsreducepartialr  )ra   r$  r9  s      rg   r  !BuiltinVariable._call_min_max_seq+  sM    5zA~~u:?8O	 1 1$2K2KR PRWXXrj   c                 	   Ub  Uc  g U R                  X#5      (       Gaj  [        U[        R                  5      (       d  X2p2[        U[        R                  5      (       d   e[        U[        5      (       a5  [        R
                  " [        R                  5      R                  X/0 5      n[        U[        5      (       d  [        U[        5      (       aH  SSK
Jn  U" [        U5      UUR                  R                  " SU R                  /[!        X#/0 5      Q76 S9$ UR#                  5       (       a  [        U[        R$                  5      (       a%  SS Kn[        R(                  " UR*                  5      nO$[        R
                  " [        R,                  5      nU R                  [.        L a  SU0OSU0nUR                  X/U5      nO[        U[        R$                  5      (       aJ  SS Kn[.        UR0                  [2        UR4                  0U R                     n	[        R(                  " U	5      nOM[.        [        R0                  [2        [        R4                  0U R                     n
[        R
                  " U
5      nUR                  XU/0 5      n[7        S X#4 5       5      (       a  [9        S	 X#4 5       5      (       a  [        R                  R;                  U5      $ UR#                  5       (       a  UR=                  5       nOUR>                  nU R                  [.        L a  [/        UR>                  U5      nO[3        UR>                  U5      n[9        S
 X#4 5       5      n[        R@                  R;                  XU5      $ U$ [        U[        5      (       d  [        U[        5      (       as  U R                  [.        L a  [        RB                  O[        RD                  nUR                  R                  " SU/[!        X#/0 5      Q76 n[        RF                  " XS 5      $ [        U[H        5      (       aO  [        U[H        5      (       a9  U R                  UR=                  5       UR=                  5       5      n[I        U5      $ g g )Nr8   r0  r2  r{  r   r   r   c              3   v   #    U  H/  n[        U[        R                  [        R                  45      v   M1     g 7fr`   )r   r   rQ   r=   )r   r  s     rg   r   7BuiltinVariable._call_min_max_binary.<locals>.<genexpr>g  s?      	  A !==!22   s   79c              3   B   #    U  H  n[        U[        5      v   M     g 7fr`   r;  )r   rs  s     rg   r   r  q  s     KFSz#'788Fr  c              3   |   #    U  H2  n[        U[        R                  5      (       d  M$  UR                  v   M4     g 7fr`   r=  r   s     rg   r   r  }  s-      "#!!Y%J%JK "AMM#r?  )%r  r   r   rP   rM   TorchInGraphFunctionVariabler   r   r2  rO   r3  r0  r   r4  r5  r   r4   rc  rH  numpyNumpyVariableclipclampr   maximumr   minimumr   r   from_tensor_variablerT  r@  rQ   sym_maxsym_minrX  r=   )ra   r$  r%  r&  r0  npr   re   r  np_fntorch_fnraw_braw_resr>  py_fnrL  r   s                    rg   r  $BuiltinVariable._call_min_max_binary2  s   9	 A!!a!9!9::1a!9!9:::: !-..::5<<HVVR
 !_--A1O1O6(G))00' +A626  ##%%a!?!?@@&"009B"??LB(,3%eQZ))"c6:a!?!?@@& "**c2::>twwGE"007B #U]]CGPH"??IB))"!fb9  	 	 	 	 KQFKKK$55JJ6RR''))002EKKE77c>!!++u5G!!++u5G! "V" 
 !<<QQ[ 
 ?++z!_/M/M%)WW^EMMEII**):A62)FE #))"T::+,,A?O1P1PGG$$&$$&E $E** 2Q,rj   c                     [        [        5      R                  X[        R                  " S5      /0 5      nUR                  U/ 0 5      $ )N__abs__r   r   r2  r=   rX  )ra   r$  r  
abs_methods       rg   call_absBuiltinVariable.call_abs  D    $W-;;&--i892

 ''B33rj   c                     [        [        5      R                  X[        R                  " S5      /0 5      nUR                  U/ 0 5      $ )N__pos__r  )ra   r$  r  
pos_methods       rg   call_posBuiltinVariable.call_pos  r  rj   c                     [        U[        R                  5      (       a  [        SSS/ S9  [	        U5      n[
        R                  " U5      n[        R                  R                  U5      $ )Nzunsupported index(Tensor)r  z;Dynamo does not support tracing builtin index() on a Tensorr  )	r   r   rP   r   r/   r   r   r=   rX  )ra   r$  r  constant_values       rg   
call_indexBuiltinVariable.call_index  sZ    c933443Y	 3!,))00@@rj   c                     [        [        5      R                  X[        R                  " S5      /0 5      nUR                  XU5      $ )N	__round__r  )ra   r$  r  rd   re   round_methods         rg   
call_roundBuiltinVariable.call_round  sB    &w/==&--k:;R
 ))"F;;rj   c                     [        U0 5      (       a  [        R                  " U5      $ U R                  " U6 (       a(  [	        S U 5       5      n[        R                  " U5      $ g )Nc              3   r   #    U  H-  n[         R                  R                  [        U5      5      v   M/     g 7fr`   )r   r=   rX  r/   r7  s     rg   r   -BuiltinVariable.call_range.<locals>.<genexpr>  s-      PT	**11,s2CDDPTs   57)r(   r   RangeVariable_dynamic_argsrg  r,  s      rg   
call_rangeBuiltinVariable.call_range  s[    (r22**400& PT D **400rj   c                 t    [        S U 5       5      =(       d     [        S UR                  5        5       5      $ )Nc              3   B   #    U  H  n[        U[        5      v   M     g 7fr`   rB  r   s     rg   r   0BuiltinVariable._dynamic_args.<locals>.<genexpr>  s     @4a:a114r  c              3   B   #    U  H  n[        U[        5      v   M     g 7fr`   rB  r   s     rg   r   r    s      H
4CqJq/**Or  )r   r   r  s      rg   r  BuiltinVariable._dynamic_args  s7    @4@@ 
C H
4:MMOH
 E
 	
rj   c                 .    [         R                  " U5      $ r`   )r   SliceVariabler,  s      rg   
call_sliceBuiltinVariable.call_slice  s    &&t,,rj   c           
      ~    SSK Jn  U" UUR                  R                  " SU R                  /[        X#5      Q76 5      $ r/  )r3  r1  r4  r5  r   r4   )ra   r$  rd   re   r1  s        rg   
_dyn_proxyBuiltinVariable._dyn_proxy  s=    *II""+<T+J
 	
rj   c                    [        U[        R                  5      (       a   eU R                  " U0 UD6(       a  U R                  " U/UQ70 UD6$ [        R
                  R                  U R                  5      nUc  U" / [        5       S9$ UR                  U5      (       Ga  UR                  (       Gax  [        UR                  5      (       Gd]  [        U[        5      (       a4  [        UR                  R                  [        R                   5      5        GO[#        USS5      (       a_  [        U[$        5      (       aJ  ['        U[(        [*        45      (       d/  UR,                  R.                  R1                  UR                  5        [        U[        R2                  5      (       a3  [        UR                  R                  [        R4                  5      5        OQ[        U[        R6                  5      (       d2  [        UR                  R                  [        R8                  5      5        U" [;        UR=                  U5      5      [        5       S9$ g )NrE  r   F)r   r   IteratorVariabler  r  rG   cls_forr   r:   rJ  r   r$   rK   r   r   r   TUPLE_ITERATOR_LENr   r@   r2   rF   rD   r4  guard_on_key_orderr   MappingProxyVariableMAPPING_KEYS_CHECKUnspecializedNNModuleVariableSEQUENCE_LENGTHrV  r:  ra   r$  r  rd   re   r   s         rg   _call_iter_tuple_list%BuiltinVariable._call_iter_tuple_list  s    c9#=#=>>>>t.v.??27777((009;.0  ((,,zzz"4SZZ"@"@c#899!

--l.M.MN
  Xu55&s,=>> &s[:K,L M M		4488D!#y'E'EFF &JJ11,2Q2QR (Y-T-TUU &JJ11,2N2NO S,,R01.0 7 -rj   c                     [         R                  R                  U R                  5      nU" [	        UR                  U5      5      [        5       S9$ rD  )r   rG   r  r   rV  ri  r:   r  s         rg   _call_iter_tuple_generator*BuiltinVariable._call_iter_tuple_generator  sB    ((009..r23*,
 	
rj   c                    [        U[        R                  5      (       aP  [        R                  R	                  U R
                  5      nU" [        UR                  U5      5      [        5       S9$ [        U[        R                  5      (       d+  [        U[        5      (       a,  UR                  U5      (       a  U R                  " X/UQ70 UD6$ U R                  " X/UQ70 UD6$ rD  )r   r   r  rG   r  r   rV  ri  r:   LocalGeneratorObjectVariablerT   rh  r  r  r  s         rg   _call_tuple_list BuiltinVariable._call_tuple_list  s    c95566,,44TWW=CS22267.0  YCCDDs56611"55222LTLVLL--bGGGGrj   c                    [        U[        R                  5      (       a  UnOJ[        U[        R                  5      (       a  UR	                  US/ 0 5      nOU R
                  " X/UQ70 UD6nUcg  [        R                  " [        R                  R                  5      R                  X/UQ0 5      n[        U5      (       a  [        R                  " U5      nU$ )N__iter__)r   r   r  r  r#  r  r  r   r  iter_r2  r   ObjectIteratorVariable)ra   r$  r  rd   re   rets         rg   	call_iterBuiltinVariable.call_iter  s    c95566CY4455//"j"b9C ,,RFtFvFC; 00""((mBtb1  4yy
  66s;
rj   c           	         SSK JnJn  SSKJn  [        U[        R                  UUU45      (       a  [        R                  R                  S5      $ [        U[        5      (       a2  [        R                  R                  [        UR                  5      5      $ [        U[        [        [        [        [         ["        45      (       a  [        R                  R                  S5      $ g )Nr8   )r  FunctoolsPartialVariabler  TF)r  r  r  r  r  r   r   r  r=   rX  rU   r   r   rO   rP   rI   rL   rH   )ra   r$  r  r  r  r  s         rg   call_callableBuiltinVariable.call_callable:  s    Q/22(( 	
 
 --44T::011--44Xcii5HII $

 

 --44U;;

rj   c                 R    [        U5      S:X  a  US   $ [        SSU SU 3SS/S9  g )	Nr   r8   zbad args to builtin cast()z	got args r  z0Dynamo expects exactly 2 args to builtin cast().z3Ensure your call to cast() has exactly 2 arguments.r  )r   r   )ra   r  rd   re   s       rg   	call_castBuiltinVariable.call_castW  s:    t9>7N0vQvh/JHI		
rj   c                    [        U[        R                  5      (       a*  [        R                  " U[        UR                  5      5      $ [        U[        5      (       a*  [        R                  " U[        UR                  5      5      $ g r`   )	r   r   r  r;   re  dirr   r   r   r  s      rg   call_dirBuiltinVariable.call_dirb  s]    c9==>>"((S^<<c?++"((S[99 ,rj   c                 @    [         R                  " U[        /UQ70 UD6$ r`   )r   call_custom_dictrf  ra   r$  rd   re   s       rg   	call_dictBuiltinVariable.call_dicth  s    //DJ4J6JJrj   c                    [        U5      n[        U5      S:X  a  [        US   [        R                  5      (       az  [        US   R
                  [        R                  5      (       aN  U R                  R                  R                  US   R
                  5      (       d  US   R                  U 5      US'   U R                  [        R                  " U [        R                  5      [        R                  " X5      /UQU5      $ )Nr8   r   )rV  r   r   r   r  r  r  r4  rK  has_pending_mutationget_forwarded_dictrd  r;   re  r   construct_dict)r$  user_clsrd   re   s       rg   r   BuiltinVariable.call_custom_dictk  s    DzIN47I$=$=>>47;;	(J(JKKII**??QLL
 1g004DG--!!"i&>&>?""20848
 	
rj   c                    U[         [        [        1;   d   eU(       aG  U[        L d   e[        U5      S:X  a  [        U5      S:X  a  SU;   d   e/ UQUR	                  S5      P7n[        U5      S:X  a%  [
        R                  " S5      n[        [        X/S9  [        U5      S:X  a  / UQ[
        R                  " S 5      P7n[        U5      S:X  d   eUu  pVU[        La  [        O[        n[        U[         5      (       aW  UR                  5        Vs/ s H  n[
        R                  " U5      PM     nnU" [         R                  XV5      U[        5       S9$ UR                  U 5      (       aK  UR!                  U 5      n	[#        S U	 5       5      (       a#  U" [         R                  X5      U[        5       S9$ [%        S	UR&                   S
U SU 3SUR&                   S3SS/S9  g s  snf )Nr8   r   r   z-fromkeys expected at least 1 arguments, got 0rR  r   rE  c              3   8   #    U  H  n[        U5      v   M     g 7fr`   )rE   )r   r  s     rg   r   <BuiltinVariable.call_custom_dict_fromkeys.<locals>.<genexpr>  s     04a;q>>4rW  zfailed to call dict.fromkeys()z.fromkeys(): r  zFailed to call zo.fromkeys() because arguments could not be automatically converted to a list, or some dict key is not hashable.z(Manually convert the argument to a list.zEnsure all keys are hashable.r  )rf  r   r   r   popr=   rX  r   r`  r@   rA   r   keysra  r:   rh  ri  r   r   rk   )
r$  r  rd   re   msgr  r   DictVariableTyper  r  s
             rg   rl  )BuiltinVariable.call_custom_dict_fromkeys~  s    D+{;;;;{***t9>c&kQ&67f;LLL/T/6::g./Dt9>"))?C %Y?t9>9T9+22489D4yA~~
!)!<BU 	 c4  7:xxzBz!#**1-zCB#c)8CSCU  ..r22004D04000'MM$."2"4  	4(()tfAfXF)(*;*;)< =0 0 ;/
	
 Cs    G*c           
      d   U(       a   eU(       d  [        / [        5       S9$ [        U5      S:w  a1  [        [        U[
        R                  " S[        U5       S35      /S9  US   n[        U[        R                   5      (       a  UR                  [        5       S9$ UR                  U5      (       a#  UR                  U5      n[        U[        5       S9$ [        U[        R                  5      (       a  [        UR                  [        5      (       ax  UR!                  US5      n[        U[        R"                  5      (       aG  UR%                  XbU5      n[        U[         5      (       a  U$ ['        [(        5      R+                  X5      $ [        [        U[
        R                  " S5      /S9  g )	NrE  r8   z&set() takes 1 positional argument but  were givenrR  r   r  z!failed to construct builtin set())rF   r:   r   r   r`  r=   rX  r2   r   clonerh  ri  r   rT   r   r   r+  UserMethodVariablerd  r   rn  call_set)ra   r$  rd   re   r  r9  iter_fnouts           rg   r  BuiltinVariable.call_set  sh   zr1A1CDDt9>$$++@T;W 1g#y,,--99+;+=9>>..r2211"5Eu4D4FGGY@@AAjIIxG
 G
 oob*5G'9#?#?@@44WFKc;//J&s+44R== "))*MNO	
rj   c           
         U(       a   eU(       d  [        / 5      $ [        U5      S:w  a1  [        [        U[        R
                  " S[        U5       S35      /S9  US   n[        U[        R                   5      (       a/  [        UR                   Vs/ s H  oUR                  PM     sn5      $ UR                  U5      (       a  UR                  U5      n[        U5      $ [        [        U[        R
                  " S5      /S9  g s  snf )Nr8   z,frozenset() takes 1 positional argument but r  rR  r   z'failed to construct builtin frozenset())rD   r   r   r`  r=   rX  r2   r   	set_itemsvtrh  ri  )ra   r$  rd   re   r  r   r9  s          rg   call_frozensetBuiltinVariable.call_frozenset  s    z$R((t9>$$++Fs4ykQ\] 1g#y2233$CMM%BMqddM%BCC..r2211"5E$U++ "))*STU	
	 &Cs   Dc                    U(       a  [        U5      S:X  a  SU;   d   eUR                  SS5      nU Vs/ s H#  n[        [        5      R	                  X/0 5      PM%     nn[
        R                  " X$[        5       S9$ s  snf )Nr8   strictF)r(  rF  )r   r  r   iterr2  r   ZipVariabler:   )ra   r$  rd   re   r(  r  s         rg   call_zipBuiltinVariable.call_zip  sx    v;!#F(:::He,NRSds%33BrBdS$$/?/A
 	
 Ts   *A>c                      US   R                  USUSS  U5      $ ! [         a1  n[        [        U5      U[	        UR
                  5      S9   S nAg S nAff = f)Nr   __len__r8   rR  )r#  r  r   r   rV  rd   )ra   r$  rd   re   r  s        rg   call_lenBuiltinVariable.call_len  sS    	E7&&r9d12hGG 	E$T!WbtAFF|D	Es    
A'AAc                 6    US   R                  USUSS  U5      $ )Nr   __getitem__r8   r*  r	  s       rg   call_getitemBuiltinVariable.call_getitem  s#    Aw""2}d12hGGrj   c           	        ^  TR                  5       nUR                  5       n[        T[        R                  5      (       a9  TR                  b,  U4S jn[        R                  R                  U" TU5      5      $ [        T[        R                  5      (       aL  [        TR                  [        R                  5      (       a#  [        SST SU S3S	/ [        R                   QS9  [        T[        R                  5      (       a]  S
UR"                  R$                  ;   aC  [        R                  R                  UR"                  R'                  UTR                  5      5      $ [        T[        R(                  5      (       a   [        R                  " [        WU5      5      $ [        U[*        5      (       d  [-        [/        US
S 5      5      (       a  U4nO[0        R2                  S:  a,  [        U[        R4                  5      (       a  UR6                  nO?[        U[8        5      (       a  [;        S U 5       5      (       a  UnO[=        [>        US/S9   [A        WW5      n[        R                  R                  U5      $ ! [         a*    [        SST SU S3ST 3/ [        R                  QS9   GNf = f! [>         a    WW;   n Ngf = f)Nz6builtin isinstance() cannot determine type of argumentzisinstance(r  r  z=Dynamo doesn't have a rule to determine the type of argument r  c                 p   >^ U4S jm[        U5      [        L a  [        U4S jU 5       5      $ T" U5      $ )Nc                 N  > U [         ;  a  TR                  5       R                  R                  S   n[	        U5      (       a2  U [
        R                  R                  R                  L a  [        X5      $ [        TR                  5       U 5      $ [         U    nTR                  U;   $ )Nexample_value)r7   r  nodemetar   r   nn	parameter	Parameterr   r  python_typerr   )tyexample_valdtypesr  s      rg   
check_typeOBuiltinVariable.call_isinstance.<locals>._tensor_isinstance.<locals>.check_type  s    !44&)lln&9&9&>&>&O9+FF "ehh&8&8&B&B B
 $.k#>>#-coo.?#DD04F99..rj   c              3   4   >#    U  H  nT" U5      v   M     g 7fr`   r^   )r   r?  rB  s     rg   r   NBuiltinVariable.call_isinstance.<locals>._tensor_isinstance.<locals>.<genexpr>!  s     D"z"~~s   )r   rg  r   )
tensor_vartensor_typerB  r  s     @rg   _tensor_isinstance;BuiltinVariable.call_isinstance.<locals>._tensor_isinstance  s3    /" $-DDDD%k22rj   z<isinstance() called on user defined object with C extensionszeUser-defined object with C extensions can have torch.Tensor attributes; intentionally graph breaking.__instancecheck__)r]  
   c              3   |   #    U  H2  n[        U[        5      =(       d    [        [        US S5      5      v   M4     g7f)rJ  N)r   r   r   r   )r   tps     rg   r   2BuiltinVariable.call_isinstance.<locals>.<genexpr>J  s5      8
% r4 THWR9Ld-S$TT%s   :<z?isinstance() arg 2 must be a type, a tuple of types, or a unionrR  )!r>  rI  r   r   r  rT  r   r   rP   rr   r=   rX  rT   r   rc   MemberDescriptorTyper  rS  r   rJ  !UserDefinedExceptionClassVariabler   r   r   sysversion_info	UnionType__args__rg  r   r   r`  r  )ra   r$  r  isinstance_typer  rH  isinstance_type_tuplers  s     `     rg   call_isinstanceBuiltinVariable.call_isinstance  s   	(H *<<>c933449N3. --44"38 
 c9>>??JIIu11E
 E
 V%cU"_,=Q?<6)556 sI??@@#'@'@'I'II--44));;OSYYW  c9FFGG#**:h+PQQ ot,,O%8$?1
 1
 &5$6!(ZU__.
 .
 %4$<$<!//C 8
%8
 5
 5
 %4!$U
	4 X'<=C ))0055C # 	P%cU"_,=Q?[\_[`a5)445		~  	433C	4s#   J  J7  0J43J47K	K	c           	           UR                  5       nUR                  5       n[
        R                  " [        WW5      5      $ ! [         a'    [        SSU SU S3SS/[        R                  QS9   NPf = f)z,Checks if first arg is subclass of right argz(issubclass() with non-constant argumentszissubclass(r  r  z7issubclass() with non-constant arguments not supported.z#Make sure your arguments are types.r  )rT  rI  r   r   r  r   r=   r  )ra   r$  left_tyright_ty
left_ty_pyright_ty_pys         rg   call_issubclassBuiltinVariable.call_issubclasse  s    	 335J"557K ))*Z*MNN # 		B%gYb
!<U9&11			s    A .A32A3c                 .    [         R                  " X#5      $ r`   )r   SuperVariablera   r$  r%  r&  s       rg   
call_superBuiltinVariable.call_supery  s    &&q,,rj   c                    US   n UR                  U5      $ ! [         a    [        U5      S:X  a  US   s $ e [         aI  n[	        U[
        R                  5      (       a$  UR                  5         UR                  S   s S nA$ e S nAff = f)Nr   r   r8   )	next_variabler   r   r   r   r   rG   r  r9  )ra   r$  rd   r  exs        rg   	call_nextBuiltinVariable.call_next|  s    1g
	$$R((( 	4yA~Aw 	#y99::$$&yy|#		s&    B
B=B?BBBc                    UR                  5       (       aj  UR                  5       n[        U[        R                  5      (       a*  [        R
                  " [        UR                  U5      5      $ UR                  X5      $ g r`   )	rc  rT  r   r   r   r=   r  r   call_obj_hasattr)ra   r$  r  attrr  s        rg   call_hasattrBuiltinVariable.call_hasattr  sd    ""$$**,D#y8899 11'#&&$2GHH''11	 %rj   c                     U Vs/ s H,  nUR                  U5      (       a  UR                  U5      OUPM.     nn[        R                  " X#[	        5       S9$ s  snf rD  )rJ  r:  r   MapVariabler:   )ra   r$  r   seqsrN  s        rg   call_mapBuiltinVariable.call_map  sc     
 ,/+F+Fr+J+JC##B'PSS 	 
 $$R=M=OPP	
s   3Ac                     UR                  U5      (       a  UR                  U5      OUn[        R                  " X#[	        5       S9$ rD  )rJ  r:  r   FilterVariabler:   )ra   r$  r   rN  s       rg   call_filterBuiltinVariable.call_filter  s<    -0-H-H-L-Lc%%b)RU''?O?QRRrj   c                 `   U R                   =(       a    [        U R                   U5      nU R                  [        L a>   [	        U R                  U5      n[        W5      (       d  [        R                  " XU5      $ [        R                  " XUS9$ ! [
         a    [        [
        U5         NXf = fr   )r   r!   r   r  r   r  r   r   r;   re  r   r  )ra   r$  r  r   r   s        rg   r+  BuiltinVariable.var_getattr  s    >DKK!>77f=. E??&,,R??((FCC	 " =(<=s   B B-,B-r  rr  c                    UR                  5       (       d  [        SSU SU SU S3SS/S9  UR                  5       n[        U[        5      (       a  US:X  a  S	nUR
                  R                  R                  U5      (       av  [        U[        R                  5      (       aW  US
;   aQ  UR                  (       a@  UR
                  R                  R                  U5      (       a  [        SSU SU SU S3S/ S9  UR
                  R                  R                  X%5      (       a%  UR
                  R                  R                  X%5      $ Ub?  U R                  XU5      nUR                  5       S;   d   eUR                  5       (       d  U$ UR                  =(       a    [!        UR                  U5      nUS;   a   UR                  5       n[        U["        5      (       a  US:X  ad  [%        UR&                  5       V	V
s/ s H.  u  p[(        R*                  " XU=(       a    [-        Xy5      5      PM0     nn	n
[        R.                  " XS9$ US:X  a!  [(        R*                  " XR0                  U5      $ US:X  a   [2        R4                  " UR6                  5      $ [        U[        R:                  5      (       a  UR=                  X5      $ [        U[        R                  [        R>                  [        R2                  [        R@                  [        RB                  [        RD                  45      (       Ga@  [        U[        RD                  5      (       af  [G        URH                  RJ                  [L        RN                  5      (       a3  [P        RR                  (       a  US;   a  [        SSU 3SU S3SU S3/S9  [        U[        5      (       a  URT                  RV                  RX                  S   n[        U[Z        R\                  5      (       aR  [_        U5      (       aB  UR`                  (       a  [P        Rb                  (       d  [        SSS/ [d        Rf                  QS9   UR=                  X5      $ [        U[        Rj                  5      (       a  [m        URH                  U5      n[        U[Z        Rn                  Rp                  [Z        Rn                  Rr                  45      (       aB  [Z        Rt                  Rv                  Ry                  U5      (       a  [        Rj                  " XS9$ U[z        ;   a  [        Rh                  " X%US9$ g [        U[|        5      (       a  UR~                  (       d  XRRH                  R                  ;  a  [m        URH                  U5      nOURH                  R                  U   n[P        R                  (       a&  UR                  R                  URH                  X]5        [(        R*                  " XU5      $ [        U[        R                  5      (       a0  US;   a*  [2        R4                  " [m        UR                  U5      5      $  UR=                  X5      $ s  sn
n	f ! [8         a     GNf = f! [8         a    [        Rh                  " X%US9s $ f = f! [8         a    [        Rh                  " X%US9s $ f = f)Nz)getattr() with non-constant name argumentzgetattr(r  r  z:getattr() with non-constant name argument is not supportedz1Ensure the name argument of getattr() is a stringr  _gradgrad)named_parameters
parametersnamed_buffersbuffersnamed_modulesmodulesz,getattr() on nn.Module with pending mutationzPIntentionally graph breaking on getattr() on a nn.Module with a pending mutation)TF>   __base__	__bases__	__flags__r  r   r  r  )assertRaisesRegexassertNotWarnsassertWarnsRegexassertWarnszFailed to trace unittest methodzfunction: unittest.TestCase.z3Dynamo does not know how to trace unittest method `z` zAvoid calling `TestCase.z%`. Please report an issue to PyTorch.r8  zAttempted to wrap sparse Tensorr  z-torch.compile does not support sparse Tensors)rk   rl   )Grc  r   rT  r   rP   r4  rK  rb  r   r  is_state_mutatedr  has_pending_mutation_of_attr	load_attrrm  r   r!   r   	enumerater  r;   re  r"   rL   r  r=   rX  r  rI  r  r+  NamedTupleVariableDistributedVariabler  rT   r  r   rS  unittestTestCaser   enable_trace_unittestrL  r9  r:  r   Tensorr   rD  capture_sparse_computer   r  r  r  r   _opsOpOverloadPacket
OpOverload_dynamotrace_rulesis_aten_op_or_tensor_methodr*   r    is_torchr   replay_record_enabledexec_recorderrecord_module_accessr2   r  r   )ra   r$  r  rr  defaultr  hasattr_varr   r   r  r&  
tuple_argsfake_valmembers                 rg   call_getattrBuiltinVariable.call_getattr  s    **,,C"3%r(2gYa@XJK	 **, c>**twD99!!77<<#yFFGG ,,		..CCCHH$ N"*3%r$r'! D%2  99!!>>sII99))33C>>++BX>K113}DDD1133<
3::t <99..0eT**{*
 )2%//(B	& )C ,11 "v'J-2J )C	 # &  )66zQQz).44RPP{*/66uGG c95566??2,,((,,**--2233

 

 3	 C CDDsyy22H4E4EFF00 !=:4&A"UVZU[[] ^24& 9= =	 #~..99>>..?x66%h//YYf.K.K$ A "$S> 1 = =>	Kr00 YCCDDSYY-F44ejj6K6KL --++GGOO ==fTT// 006JJ 0[))||t99+=+== D1++D1++  55ciiN"((V<<C7788T F
 >
 $**73664+@AAKr00{& ' j ' K 006JJK< ' K 006JJKsU   ;AY5 >5Y/3Y5 
&Y5 1%Y5 "Z Z+ /Y5 5
ZZZ('Z(+[[rs  c                 ~	   [        U[        R                  [        R                  [        R                  [        R
                  [        R                  45      (       a  UR                  USX4/0 5      $ UR                  R                  R                  U5      (       Ga{  UR                  5       (       Gae  UR                  5       n[        U[        R                  5      (       Ga  SSKJn  US:X  a(  [!        SSU SU SU S3S	/ ["        R$                  QS
9  GOUS:X  Ga  UR&                  c  [!        SSU SU SU S3SS/S
9  O1UR(                  UR(                  :w  a  [!        SSU SU SU S3SS/S
9  UR                  R*                   Vs/ s H   owR&                  UR&                  :X  d  M  UPM"     nnU H(  nUR                  R*                  R-                  U5        M*     [/        U5         [0        R2                  " 5          U" UUR                  R4                  " S[0        R6                  R8                  /[;        X$/0 5      Q76 5      n	S S S 5        S S S 5        S n
UR                  R5                  SU
W	R=                  5       40 5        U
" UR=                  5       R>                  R@                  S   5        U	$ US;   a  SnO+[C        U5      (       a  [!        SSU SU SU S3SSU S3/S
9  UR                  R                  RE                  X%U5        U$ [        U[        RF                  5      (       GaE  UR                  RI                  5       (       d  [K        S5      eUR                  5       (       a  [        U[        R                  5      (       a  [M        UR=                  5       R>                  U5      n URO                  XR                  5       5      n[        U[        R                  5      (       ar  [M        UR=                  5       R>                  U5      n[T        RV                  " URX                  S5      nXL a)  U[0        RZ                  R\                  R^                  L a  U$ URa                  U5        g g s  snf ! , (       d  f       GN== f! , (       d  f       GNG= f! [P        [R        4 a    S n Nf = f)Nr\  r8   r0  requires_gradz!setattr() on Tensor.requires_gradzsetattr(r  r  zsetattr() on Tensor.requires_grad not supported. Mutating requires_grad can introduce a new leaf from non-leaf or vice versa in the middle of the graph, which AOTAutograd does not currently know how to handle.r  dataz&Failed to mutate tensor data attributezVDyanmo only supports mutating `.data` of tensor created outside `torch.compile` regionzWDon't mutate `.data` on this tensor, or move the mutation out of `torch.compile` regionz9Failed to mutate tensor data attribute to different dtypezPDyanmo only supports mutating `.data` of tensor to a new one with the same dtyper2  c                     U R                   nUS:  a  US-
  n[        R                  R                  R	                  U 4U45        U $ r  )_versionr   _C	_autograd_unsafe_set_version_counter)r   versions     rg   _lower_version_count_by_1?BuiltinVariable.call_setattr.<locals>._lower_version_count_by_1	  s>    "#**"Q;&-kG**FFtgZX rj   r8  )r{  r|  r|  zFailed to set tensor attributez6Dyanmo doesn't support setting these tensor attributeszDon't mutate attribute 'z@' on tensors, or move the mutation out of `torch.compile` regionz?Can't inplace modify module params/buffers inside HigherOrderOp)1r   r   PlacementVariabler  rT   NestedUserFunctionVariableru  r#  r4  rK  rb  rc  rT  rP   r3  r1  r   r   r  r   rr   tracked_fakesremovedynamo_disable_gradr   no_gradr5  r  set_r4   r  r9  r:  r0   
store_attrr  is_root_tracerr   r.   r+  r  r   r  getattr_staticmodule_typer;  Moduler\  convert_to_unspecialized)ra   r$  r  rr  rs  r  r1  tf	to_remover   r  assigning_fake_valgetattr_varexisting_fake_attrmod_setattrs                  rg   call_setattrBuiltinVariable.call_setattrD	  sO    ++,,3344++	
 	
 ??2}xorJJII""88==++--..0D#y77882 ?*$ C"*3%r$r#a @%l ? 1 = => V^ zz)($L&.se2dV2cU!$D)P!M#	 cii/($_&.se2dV2cU!$D)J!M#	" &(YY%<%<!%<r		SZZ@W%<  ! (		//66r: ( -R0%--/+II22 / % 1 1 "3C:r!B 3B0! II**'1)	 .clln.A.A.F.F.WX J.. "D066 % @"*3%r$r#a @$\6tf =N N	 II""--c=JY778899++--,U  **,,Y--2 2 &4CLLN4G4G%L"'"%//"6Q6Q6S"TK k9+C+CDD)78L8L8N8S8SUW)X& #*"8"8-"XK*@'588??+F+FF**((,7 9}! 3B/00F '(>? '"&K'sC   Q>-Q>.RA	RR;R' 
R	R
R$'R<;R<c                 ,    UR                  USU/0 5      $ )N__delattr__r*  )ra   r$  r  rr  s       rg   call_delattrBuiltinVariable.call_delattr	  s     r=8*bAArj   c                     UR                  5       nUR                  =(       a    [        UR                  5      nUc<  [        U[        R                  5      (       a  UR                  (       a  UR                  nU[        R                  L a5  UR                  R                  S[        5      n[!        [#        U5      S5      n[$        R&                  " XU5      $ ! [         a(  n[        [        R                  [        U5      SS9S eS nAff = f)Nunknown_python_type)	case_namer  r  )r>  rI  r   r   INVALID_INPUTr   r   r%   r   r   rT   
cls_sourcer   r  r4  install_global_by_idr!   r#   r;   re  )ra   r$  r  py_typeerrorr   r  s          rg   	call_typeBuiltinVariable.call_type	  s    	oo'G 6
3:: 6N3	 C CDD^^Fell"9911"e<DT 2H=F$$R&99' # 	++E
/ 		s   C 
D
"#DD
c                     UR                  U5      (       a9  [        [        UR                  U5      5      5      n[        R
                  " U5      $ g r`   )rJ  rV  reversedr:  r   rL   )ra   r$  r  r9  s       rg   call_reversedBuiltinVariable.call_reversed
  sC    &&r**#"9"9""=>?E**511 +rj   c                     UR                  U5      (       ab  [        U[        R                  5      (       dB  [        R                  " UR                  U5      [        5       S9nUR                  US/ U5        U$ g g )NrE  sort)rh  r   r   rP   rI   ri  r:   r#  )ra   r$  r  re   list_vars        rg   call_sortedBuiltinVariable.call_sorted
  su     ,,R00)):
 :
 !----b1.0H   VR8O:
0rj   c                 2   [        U[        5      (       a8  [        R                  " U[        R                  " UR                  5       5      S S9$ [        U[        5      (       a5  UR                  US5      R                  (       a  UR                  US/ 0 5      $ g )Nr  __neg__)
r   rO   rX  r   r   r  rT   rk  r   r#  ra   r$  r%  s      rg   call_negBuiltinVariable.call_neg
  sz    a))"))qzz|,  q344""2y177==YB77 rj   c                 x    UR                  5       n[        U5      n[        R                  R	                  XSU5      $ r`   )rT  r   r   StringFormatVariablerX  )ra   r$  _format_stringrd   re   format_strings         rg   call_formatBuiltinVariable.call_format*
  s3    &99;M*--44]&QQrj   c                 b   [        U5      S:  at  [        US   [        R                  5      (       aR  US   nUR                  R                  UR                  5      n[        R                  R                  [        U5      5      $ [        U5      S:X  a  [        US   [        R                  [        R                  45      (       a  US   R                  (       a5  [        US   R                  R                  [        R                   5      5        [        US   R"                  5      n[        R                  R                  U5      $ [        U5      S:X  a.  [        US   [$        5      (       a  US   nUR'                  U5      $ [)        US   [        R*                  5      (       a5  [        R                  R                  [        US   R,                  5      5      $ [)        US   [        R.                  5      (       a5  [        R                  R                  [        US   R"                  5      5      $ [)        US   [        R0                  5      (       a5  [        R                  R                  [        US   R2                  5      5      $ [5        S[7        U5      SU 3S/[8        R:                  QS9  g )Nr   r8   zid() with unsupported argsz5Dynamo doesn't know how to trace id() call with args zkSupported args are Tensors, and functions/nn.Modules/user-defined objects from outside the compiled region.r  )r   r   r   r  r4  rr  rs  r=   rX  idr  rT   r   r   r   r   ID_MATCHr   rP   call_idr2   r  r   SkipFunctionVariabler  
fake_valuer   r   r   r  )ra   r$  rd   nn_mod_variabler   constant_resulttensor_variables          rg   r  BuiltinVariable.call_id/
  s	   t9q=ZQ1K1KLL"1gO))))/*D*DEC--44RW==Y!^
G//1T1TU!
 !
 Aw~~d1gnn778M8MNO a/O--44_EEY!^
47N C C"1gO"**2..DGY;;<<--44RQ

^DDDGY;;<<--44RQ5FGGDGY??@@--44RQ8J8J5KLL4D	STXSYZ8 '22		rj   c                 F    [        SSU S3SS/[        R                  QS9  g )Nzcopy.deepcopy()zcopy.deepcopy(r  z'Dynamo does not support copy.deepcopy()zAvoid calling copy.deepcopy()r  )r   r   r  )ra   r$  r   s      rg   call_deepcopyBuiltinVariable.call_deepcopyQ
  s2    %$QCq)A/"..		
rj   c                 2   SSK Jn  SSKJn  U R                  nU[
        R                  [
        R                  4;   a  [        U[        5      =(       ap    [        U[        5      =(       aY    [        [        UR                  5       R                  5      5      [        [        UR                  5       R                  5      5      :H  nU[
        R                  L a  [        R                  " U5      $ [        R                  " U(       + 5      $ Xe;  aB  [!        SUR"                   SU SU S3SUR"                   S	U SU 3/ [$        R&                  QS
9  [        U[        5      (       a{  [        U[        5      (       af  UR(                  =(       a    UR(                  bF  UR(                  UR(                  :w  a,   [*        R,                  " UR(                  UR(                  5        [        U[        5      (       a  UOUnUR2                  R5                  SXbR                  5       UR                  5       40 5      n	U" [7        U5      UU	5      $ ! [.         aF    [!        SUR"                   SU SU S3SU SU SUR"                   S3/ [$        R0                  QS
9   Nf = f)Nr8   r  %supported_tensor_comparison_op_valuesz unsupported Tensor comparison opr  r  r  *Dynamo does not support the comparison op z with Tensor arguments r  z8failed to broadcast when attempting Tensor comparison opz.Dynamo was unable to broad cast the arguments z, when attempting to trace the comparison op .r2  )r3  r0  r   r  r   r   rj  is_notr   rP   r  r,   r  r9  r=   rX  r   rk   r   r  sizer   broadcast_shapesRuntimeErrorr  r4  r5  r   )
ra   r$  rw  rx  r0  r  r   	is_result
tensor_clsrL  s
             rg   r  'BuiltinVariable._comparison_with_tensor\
  s=   .AWW(,,0040 Iun5I1$--/2F2FGH01A1F1FGHI  X\\!'..y99'..9}==::;;-qbq9H V))-b96)556 t^,,5.11)uzz6		UZZ'
&&tyy%**= (n==T5
		&&R--/5>>3C!Db
 !
 	
    V!{{m1TF"UG1="PQUPVVXY^X_ `BBD++a!Q9-889s   4+I AJJc           
         SSK Jn  U R                  nXT;  aB  [        SUR                   SU SU S3SUR                   SU SU 3/ [
        R                  QS	9  [        U[        R                  5      (       a%  [        R                  " U" [        5       S 5      5      $ UR                  R                  S
XRR                  5       UR                  5       40 5      n[        R                   " UUS S9$ )Nr8   r  z!unsupported SymNode comparison opr  r  r  r  z with SymNode arguments r  r2  r  )r   r  r   r   rk   r   r  r   r   r  r=   r  r4  r5  r  rO   rX  )ra   r$  rw  rx  r  r   rL  s          rg   r|  (BuiltinVariable._comparison_with_symnode
  s    AWW:;;;-qbq9H V**.r%:6)556 eY??@@--b4.@AA		&&R--/5>>3C!Db
 %%
 	
rj   c                 n    [        U[        [        [        45      (       a  UR	                  USU/0 5      $ g )N__xor__r   rB   rF   rT   r#  rb  s       rg   call_xorBuiltinVariable.call_xor
  5    a*K9RSTT==YR88 Urj   c                 n    [        U[        [        [        45      (       a  UR	                  USU/0 5      $ g )N__ixor__r  rb  s       rg   	call_ixorBuiltinVariable.call_ixor
  5    a*K9RSTT==Z!b99 Urj   c                 n    [        U[        [        [        45      (       a  UR	                  USU/0 5      $ g )Nr   r  rb  s       rg   call_subBuiltinVariable.call_sub
  r	  rj   c                 n    [        U[        [        [        45      (       a  UR	                  USU/0 5      $ g )Nr   r  rb  s       rg   	call_isubBuiltinVariable.call_isub
  r  rj   c           
         [        U[        5      (       a  [        U[        5      (       a  g [        U[        [        45      (       af  [        U[        [        45      (       aK  [        R                  " UUR                  R
                  " S[        R                  /[        X#/0 5      Q76 S S9$ [        U[        [        [        45      (       a  UR                  USU/0 5      $ g )Nr2  r  __and__)r   r=   rO   rX  r4  r5  r   r   r4   rB   rF   rT   r#  rb  s       rg   	call_and_BuiltinVariable.call_and_
  s    a)**z!=M/N/Na/+;<==*!12C
 C
 #))		&&#X]]5Fvr5R   a*K9RSTT==YR88 Urj   c           
         [        U[        5      (       a  [        U[        5      (       a  g [        U[        [        45      (       af  [        U[        [        45      (       aK  [        R                  " UUR                  R
                  " S[        R                  /[        X#/0 5      Q76 S S9$ [        U[        [        [        45      (       a  UR                  USU/0 5      $ g )Nr2  r  __iand__)r   r=   rO   rX  r4  r5  r   r   r4   rB   rF   rT   r#  rb  s       rg   	call_iandBuiltinVariable.call_iand
  s    a)**z!=M/N/Na/+;<==*!12C
 C
 #))		&&#X]]5Fvr5R   a*K9RSTT==Z!b99 Urj   c           
         [        U[        5      (       a  [        U[        5      (       a  g [        U[        [        45      (       af  [        U[        [        45      (       aK  [        R                  " UUR                  R
                  " S[        R                  /[        X#/0 5      Q76 S S9$ [        U[        [        [        [        [        [        45      (       a  UR                  USU/0 5      $ g )Nr2  r  __or__)r   r=   rO   rX  r4  r5  r   r   r4   r@   rB   rR   rF   rS   rT   r#  rb  s       rg   call_or_BuiltinVariable.call_or_
  s    a)**z!=M/N/Na/+;<==*!12C
 C
 #))		&&#X\\4Eqfb4Q   ! &')

 

 ==XsB77 rj   c           
         [        U[        5      (       a  [        U[        5      (       a  g [        U[        [        45      (       af  [        U[        [        45      (       aK  [        R                  " UUR                  R
                  " S[        R                  /[        X#/0 5      Q76 S S9$ [        U[        [        [        [        [        45      (       a  UR                  USU/0 5      $ g )Nr2  r  __ior__)r   r=   rO   rX  r4  r5  r   r   r4   r@   rB   rR   rF   rT   r#  rb  s       rg   call_iorBuiltinVariable.call_ior  s    a)**z!=M/N/Na/+;<==*!12C
 C
 #))		&&#X\\4Eqfb4Q   ! &)	
 	
 ==YR88 rj   c           
         [        U[        5      (       aK  [        R                  " UUR                  R                  " S[
        R                  /[        U/0 5      Q76 S S9$ [        U[        5      (       a  UR                  n[        U[        [        45      (       a,  [        R                  " [        UR                  5      S:H  5      $ g )Nr2  r  r   )r   rO   rX  r4  r5  r   r   r4   rC   dv_dictrI   r@   r=   r   r9  r  s      rg   	call_not_BuiltinVariable.call_not_   s    a))"))		&&#X]]5FsB5O   a)**		Aa,(9:;;#**3qww<1+<==rj   r%  r&  c                 ,    UR                  USU/0 5      $ )N__contains__r*  rb  s       rg   call_containsBuiltinVariable.call_contains2  s     }}R!b99rj   r-  )r   N)r  rV   r{  )rd   zlist[VariableTracker]re   rQ  r   r;   )r$  rW   r  r;   r`   )rrk   rl   rm   rn   ro   r  	_SENTINELr;   _nonvar_fieldsclassmethodr   staticmethodr  cacher   r   r   rf  r	   rg  rV  r   r  r  r  r  r  r  rT  r  r  r  r  r  r  r  r  r   r   r'  r-  r&  rP  r   __annotations__r2  r#  r~  call_int
call_floatr  r  r  r  r  call_mincall_maxr  r  r  r  r  r  r  r  r  r  r  r  
call_tuple	call_listr  r  r  r
  r  rl  r  r%  r+  r/  r3  rW  r^  rc  rh  rm  rr  rv  r+  r  r  r  r  r  r  r  r  r  r  r  r|  r  r  r  r  r  r  r  r#  r'  r+  rp   __classcell__)rS  s   @rg   r   r     s    I		'	'N
 ) ) __@  @D: __*  *X __#TfuT#Yf0E%EFF #  #J __X  Xt 	 	54# 4"J13 
 



 H T$Z H T H  H T4Kn 	  fck')S/)*
 	
	
" 
)#) ()) -	)
 
)(z; &	z;
 -z; 
z;x* H JC$5Bn4Ya+F HH44A<	

-
 04,),\
H6 "J I<:	
:K 
 
$ .
#.
 .
`"
H
4
EHd6LO(-2QS
D" ZK#ZK ZK "	ZKx]-#]- ]- "	]-
 ]-~B#B B "	B:3 :/ :02 7 2o 2
#  "	""R
 D	
3
j
69:9:9$:" D>$:):.=:BQ: :rj   r   c              #      #    SSK Jn  UR                  U S5      n UR                  U 5        S v   UR	                  U 5        g ! UR	                  U 5        f = f7f)Nr8   )GradModeVariableF)r  r;  rX  enterexit)r$  r;  gmvs      rg   r  r  8  sC     "

!
!"e
,C		"s   AA AAA)ro   
contextlibr  r  r  loggingr   r   rQ  rc   typingr  collectionsr   r   collections.abcr   r   r   r   r	   r
   r   r   r   r   torch._subclasses.meta_utilsr   torch.overridesr   torch.utils._python_dispatchr   r  r   r   r   r   r[  r   r   r   r   r   r   r   r   guardsr   r   replay_recordr    r   r!   r"   r#   r$   r%   utilsr&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   baser9   r:   r;   constantr=   ctx_managerr>   r?   dictsr@   rA   rB   rC   rD   rE   rF   listsrG   rH   rI   rJ   rK   rL   r   rM   rN   rO   rP   rQ   r  rR   rS   rT   rU   torch._dynamo.codegenrV   torch._dynamo.symbolic_convertrW   	getLoggerrk   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   rF  _HandlerCallbackr   rg  _TrackersTyper   cmp_eqr   cmp_ner   cmp_ltr   cmp_ler   cmp_gtr   cmp_gerf  r   r   r   r   r   r   r   r   r   r   r   r   r   rX   rf  r2  rY   r   r   contextmanagerr  r^   rj   rg   <module>r[     s&  *        
    0 8 8 6 6  $ 6 1 F > >	 	 	 1 '     ( Y X & 6      /D! MM8<<MM8<<MM8<<))x''MM8<<h&&hoohooMM8<<MM8==LL(,,MM8<< " fjj&**5F  d?+U43H#3M-NNOKK!!KK!!KK!!KK!!KK!!KK!!  LLLLOOLLLLKKKKKKKKKKKKLLMMMMMMMMMM-4 MMLLLLMMMMLL oo
 OOOO  LLLLLLMM
 JL $xS18CH3EEF K KM 4c 2HS#X4F FG L8Ev^(:o ^(:BQ  rj   