
    %Vji                    h   U d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlmZmZ ddlmZmZmZ ddl
mZmZmZmZ ddlZddlmZmZ ddlmZ ddlmZ dd	lmZ d
dl m!Z!m"Z"m#Z#m$Z$ d
dl%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z- d
dl.m/Z/m0Z0 d
dl1m2Z2 d
dl3m4Z4m5Z5m6Z6m7Z7m8Z8 d
dl9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZK ddlLmMZMmNZNmOZO ddlPmQZQ ddlRmSZSmTZT ddlUmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\ ddl]m^Z^m_Z_m`Z`maZambZbmcZc ddldmeZemfZfmgZgmhZhmiZi ddljmkZkmlZlmmZmmnZn erddlompZp ddlqmrZr  ejs        et          Zuejv        ejw        ejx        ejy        ejz        ej{        ej|        ej}        ej~        ej        ej        ej        ej        ej        ej        ej        ej        ej        ej        ej        ej        ej        ej        ej        ej        ej        iZede
j        e
j        geOf         ZeeeO         eeeO         df         f         Zej        e#j        ej        e#j        ej        e#j        ej        e#j        ej        e#j        ej        e#j        iZej        ej{        ej        ej}        ej        ej        ejw        ej        ej        ej        ej        ej        ej        ejy        ej        ejz        ej        ej|        ej~        ej        ejv        ejx        fZej        ej        ej        ej        ej        ej        fZej        fZej        ej        ej        ej        ej        fZej        ej        ej        ej        ej        fZi aeedef         edef         f         ed<   i aeedef         edef         f         ed<   d Z G d  d!eO          Zej        d"             ZdS )#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                  P  	
 t          t                    dk    rd S d  G fddt                    } t          j        d          t          j        d          	t          j        dt          j                  t          j        dt          j                  
 |             5  fdt          ffdt          f	fdt          f
fd	t          ffd
t          fg}|D ]#\  }}|D ]} ||           J t          |<   $	fdt          f
fdt          ffdt          fg}t          j        t          j        t          j        h}|D ]9\  }}|D ]1}||v r ||           J t          |         k    r
t          |<   2:	 d d d            d S # 1 swxY w Y   d S )Nr   c                        e Zd ZdZd fd	ZdS )8populate_builtin_to_tensor_fn_map.<locals>.GetMethodModez
        Mode to extract the correct methods from torch function invocations
        (Used to get the correct torch.Tensor methods from builtins)
         Nc                      |pi }| ||i |S Nr]   )selffunctypesargskwargsmost_recent_funcs        Y/root/voice-cloning/.venv/lib/python3.11/site-packages/torch/_dynamo/variables/builtin.py__torch_function__zKpopulate_builtin_to_tensor_fn_map.<locals>.GetMethodMode.__torch_function__   s'    \rF#4((((    )r]   N)__name__
__module____qualname____doc__rg   )re   s   rf   GetMethodModer\      s=        	 	
	) 	) 	) 	) 	) 	) 	) 	)rh   rm   r8   )dtypec                      |           S r_   r]   )oinp0s    rf   <lambda>z3populate_builtin_to_tensor_fn_map.<locals>.<lambda>   s    qqww rh   c                      |           S r_   r]   rp   inp0_ints    rf   rr   z3populate_builtin_to_tensor_fn_map.<locals>.<lambda>   s    qq{{ rh   c                      |           S r_   r]   )rp   rq   inp1s    rf   rr   z3populate_builtin_to_tensor_fn_map.<locals>.<lambda>   s    qqt}} rh   c                      |           S r_   r]   )rp   ru   inp1_ints    rf   rr   z3populate_builtin_to_tensor_fn_map.<locals>.<lambda>   s    qq8,, rh   c                      | d          S Nr   r]   rt   s    rf   rr   z3populate_builtin_to_tensor_fn_map.<locals>.<lambda>   s    qq1~~ rh   c                      | d          S Nr8   r]   )rp   rw   s    rf   rr   z3populate_builtin_to_tensor_fn_map.<locals>.<lambda>  s    !!At** rh   c                      | d          S r}   r]   )rp   ry   s    rf   rr   z3populate_builtin_to_tensor_fn_map.<locals>.<lambda>      qqH~~ rh   c                      | d          S r{   r]   rt   s    rf   rr   z3populate_builtin_to_tensor_fn_map.<locals>.<lambda>	  r   rh   )lenrX   r   torchonesint32un_ops
un_int_opsbin_opsbin_int_opstensor_and_int_opsoperatormatmulimatmulgetitemrY   )rm   setups_and_oplistssetup_fnop_listoprsetups_and_oplistsrskipsrq   ru   rw   ry   re   s          @@@@@rf   !populate_builtin_to_tensor_fn_mapr      s   
#$$q(( 	
) 
) 
) 
) 
) 
) 
)- 
) 
) 
) :a==D:a==Dz!5;///Hz!5;///H	  E  E'""""J/$$$$$g.,,,,,k:%%%%'9:N
 "4 	@ 	@Hg @ @'333/?(,,@ %$$$ &%%%{3%%%%'9:O
 /8#3X5EF!4 	E 	EHg E E<<'333#'?'CCC4D-b1E	E3 E  E  E  E  E  E  E  E  E  E  E  E  E  E  E  E  E  Es   )C$FF"Fc            
       0    e Zd ZU dZ e            Zdhej        Zed             Z	e
ej        d                         Zd Ze
ej        d                         Ze
ej        deedef         eee         edef         f         f         fd	                        Ze
ej        d
                         Ze
d             Zd Zdk fdZdefdZd Z fdZdldZd Zd Zd Z d Z!e
d             Z"d Z#e
dee$         de%fd            Z&dmd Z'dmd!Z(i Z)eeedf         ede*e         eeef         gef         f         e+d"<   ddd#e*d$         d%d&dd$fd'Z,	 	 	 	 	 	 dn fd)Z-dmd*Z.e.Z/e.Z0dmd+Z1dmd,Z2dmd-Z3dmd.Z4dmd/Z5e3Z6e3Z7dod1Z8dod2Z9dod3Z:dmd4Z;dmd5Z<d6 Z=dmd7Z>dmd8Z?	 dp	 dmd9Z@d: ZAdpd;ZBdmd<ZCeBZDeBZEdmd=ZFd> ZGdmd?ZHdmd@ZIe
dmdA            ZJe
	 	 dmdB            ZKdmdCZLdmdDZMdmdEZNdmdFZOdmdGZPdmdHZQdmdIZRdmdJZSdmdKZTdmdLZUdmdMZVdmdNZWdmdOZX	 dpdddPedQefdRZYdddPedQedSefdTZZdddPedQefdUZ[dddPefdVZ\dddPefdWZ]dddPed%efdXZ^dmdYZ_dmdZZ`dmd[Zadmd\Zbdmd]Zcdmd^Zddmd_Zedmd`ZfdmdaZgdmdbZhdmdcZidmddZjdmdeZkdmdfZldmdgZmdddhediefdjZn xZoS )qBuiltinVariablea  
    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                 t    t          |                    t          j                              | ||          S Nsource)r   
make_guardr   BUILTIN_MATCH)clsvaluer   s      rf   create_with_sourcez"BuiltinVariable.create_with_source(  s6    f''(BCCDDDs5((((rh   c                  V   h t           t          t          t          t          t
          t          t          t          t          t          t          t          t          t          t          t           t"          t$          t$          j        t(          t*          t,          j         t,          j        t,          j        t,          j        t,          j        t,          j        t,          j        t,          j        t,          j        t,          j        t,          j        t,          j         t,          j!        t,          j"        t,          j#        t,          j$        t,          j%        t,          j&        t,          j'        t,          j(        t,          j)        t,          j*        t,          j+        t,          j,        t,          j-        t,          j.        t,          j/        t,          j0        t,          j1        t,          j2        t,          j3        t,          j4        t,          j5        t,          j6        t,          j7        } ddl8m9} | :                     |j;                               | :                    d tx          j=        ;                                D                        | S )Nr8   )rN   c              3   h   K   | ]-}t          |t          t          j                            )|V  .d S r_   )
isinstancetypemathsqrt.0xs     rf   	<genexpr>z;BuiltinVariable._constant_fold_functions.<locals>.<genexpr>n  s9      WW
1d49oo8V8VW1WWWWWWrh   )>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     rf   _constant_fold_functionsz(BuiltinVariable._constant_fold_functions-  s,   :
:
:
 :
 	:

 :
 :
 :
 :
 :
 :
 :
 :
 :
 :
 :
  !:
" #:
$ %:
& ':
( J):
* +:
, -:
. L/:
0 L1:
2 L3:
4 M5:
6 N7:
8 O9:
: L;:
< L=:
> O?:
@ A:
B C:
D LE:
F LG:
H LI:
J K:
L  M:
N OO:
P OQ:
R MS:
T LU:
V LW:
X MY:
Z M[:
\ ]:
^ _:
` a:
b Mc:
d Me:
f Mg:
h i:
j k:
l Mm:
n Mo:
p Lq:
r Ns:
v 	544444

2+244555

WWdm2244WWWWWW
rh   c                 8    | j         |                                 v S r_   )r   r   r`   s    rf   can_constant_fold_throughz)BuiltinVariable.can_constant_fold_throughq  s    w$779999rh   c                     h t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j	        t           j
        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j        t           j         t           j!        t           j"        t           j#        t           j$        t           j%        t           j&        t           j'        } | S 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    rf   _fx_graph_functionsz#BuiltinVariable._fx_graph_functionst  s   (
L(
L(
 L(
 M	(

 O(
 L(
 L(
 O(
 (
 (
 L(
 L(
 K(
 K(
 K(
  K!(
" K#(
$ K%(
& L'(
(  )(
* O+(
, O-(
. M/(
0 L1(
2 L3(
4 M5(
6 M7(
8 9(
: ;(
< =(
> ?(
@ MA(
B MC(
D ME(
F G(
H I(
J MK(
L MM(
N LO(
R 
rh   return.c                     t           j        g dt           j        ft           j        g dt           j        ft           j        g dt           j        ft           j        g dt           j        ft           j	        g dt           j
        ft           j        g dt           j        ft          g dt           j        ft           j        g dt           j        ft           j        g dt           j        ft           j        g d	t           j        fi
} | S )
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    rf   _binopszBuiltinVariable._binops  s     L>>>NL>>>NL>>>N???! BBB"  L>>>N555x}EL>>>NO<<<  O<<< 'U
> 
rh   c            
          ddl mm ddlm ddlm ddlm ddl	m
mm i } t                                                                          D ]e\  }\  }}g | |<   g | |<   |\  }}}||dfd
}| |                             t"          f|f           | |                             t"          f|f           |d		 dd}| |                             t"          f|f           | |                             t"          f|f           |ddd}	| |                             t$          t"          f|	f           | |                             t"          t$          f|	f           | |                             t$          t"          f|	f           | |                             t"          t$          f|	f           gdd}
dd}t&          t&          f|ft&          t(          f|ft(          t&          f|ft(          t(          f|
ft(          t*          f|
ft*          t(          fd ft,          t.          t*          t0          ffd ft.          t.          fd fg}| t2          j                                     |           dd}t,          t"          f|ft(          t(          f|
ft(          t*          f|
fg}| t2          j                                     |           dd}t,          t*          f|ft(          t*          f|ft*          t,          f|ft*          t(          f|fg}| t2          j                                     |           fd}t=          j                    D ]'}tA          |          sJ || vsJ  ||          | |<   (| S )Nr8   )BaseUserFunctionVariableUserFunctionVariableNNModuleVariable)supported_const_comparison_ops)BaseTorchVariable)UserDefinedClassVariablerT   rU   )forward_namereverse_namec                    t          |          r|                    | ||gi           S |                    | ||gi           S r_   )r   call_method)txabr  r  rU   s        rf   user_defined_handlerz=BuiltinVariable._binop_handlers.<locals>.user_defined_handler  sM    , a!455 D==\A3CCC==\A3CCCrh   )r  r  rW   c                4    |                     | ||gi           S r_   r  )r  r  r  r  s       rf   user_defined_inplace_handlerzEBuiltinVariable._binop_handlers.<locals>.user_defined_inplace_handler  s     }}RsB???rh   r   c          
      j    ddl m}  ||  | j        j        d|gt	          ||gi           R            S Nr8   wrap_fx_proxycall_function)builderr$  outputcreate_proxyr4   )r  r  r  r   r$  s        rf   dynamic_handlerz8BuiltinVariable._binop_handlers.<locals>.dynamic_handler   s_    222222$}*BI*'.?A.K.K    rh   c                 X    t          g |j        |                    |                     S r_   )rL   itemsunpack_var_sequencer  r  r  s      rf   tuple_add_handlerz:BuiltinVariable._binop_handlers.<locals>.tuple_add_handler<  s+     !G17!GQ-B-B2-F-F!GHHHrh   c                 X    t          g |j        |                    |                     S r_   )rJ   r+  r,  r-  s      rf   size_add_handlerz9BuiltinVariable._binop_handlers.<locals>.size_add_handler?  s+     F!' FA,A,A",E,E FGGGrh   c                 X    t          g |                    |           |j                  S r_   )rL   r,  r+  r-  s      rf   rr   z1BuiltinVariable._binop_handlers.<locals>.<lambda>d  s5    ..r22" " rh   c                 t    t          g |j        |                    |           t                                S Nmutation_type)rI   r+  r,  r:   r-  s      rf   rr   z1BuiltinVariable._binop_handlers.<locals>.<lambda>p  s;    :ag: 5 5b 9 9:"2"4"4" " " rh   c                 N     t          |          g |j        |j                  S r_   )r   r+  r-  s      rf   rr   z1BuiltinVariable._binop_handlers.<locals>.<lambda>w  s1    a" " rh   c                     |                                 s|                    |           sd S |                    |           }| j        j                            |           |j                            |           |S r_   )is_immutablehas_unpack_var_sequencer,  r'  side_effectsmutationr+  extend)r  r  r  seqs       rf   list_iadd_handlerz:BuiltinVariable._binop_handlers.<locals>.list_iadd_handler  ss    ~~ q'@'@'D'D t''++CI"++A...GNN3Hrh   c                 r   t          |t                    r||}}	 |                    |j        |                                z  t                                S # t          $ rT}t          t          |          | t          t          t          j        |j                                       Y d }~d S d }~ww xY w)N)r+  r5  rc   )r   r=   	__class__r+  as_python_constantr:   MemoryErrorr   r   listmapcreaterc   )r  lstconstexcs       rf   expand_list_likez9BuiltinVariable._binop_handlers.<locals>.expand_list_like  s    #/00 ("CU
}})e&>&>&@&@@"2"4"4 %       (IIc"2"938DDEE         s   <A 
B6"A	B11B6c                    
 d
 fd}t           t           f|fg} t          v rt           t           f|fg}t                     }|                    t          t
          f|j        ft
          t          f|j        fg            fd}|                    t
          t
          f|f           |S t           t           f|fg}                                 v rr j	        
                    d          rW  t                      d           
d

fd}|}|}t          t          t          t          f}|                    |t           f|ft           |f|fg           t                     }|                    t          ft          ff fdff fdff|ff|ft          t           t           ft          t           t           ff|ft          t
          f|j        ft
          t          f|j        ft          t
          f|j        ft
          t          f|j        fg	           d
 fd	}	|                    t
          t
          f|	f           |S )Nr  rW   c                    	 t           |j        |j                            S # t          $ rT}t          t	          |          | t          t          t           j        |j                                       Y d }~d S d }~ww xY w)Nr@  )	r=   r   	TypeErrorr   r   rD  rE  rF  rc   )r  r  r  rI  r   s       rf   compare_by_valuezYBuiltinVariable._binop_handlers.<locals>.create_cmp_op_handlers.<locals>.compare_by_value  s    +BBqw,@,@AAA    ,S		!#&6&=sx"H"HII         s   "& 
BA	A??Bc                 r    |                      t          j        | t                             ||gi           S r_   )inline_user_function_returnr;   buildpolyfill_fn_mappingr  r  r  r   s      rf   handlerzPBuiltinVariable._binop_handlers.<locals>.create_cmp_op_handlers.<locals>.handler  s;    99'-b2Eb2IJJQPQFTV  rh   is_c                 "    t                    S r_   r<   )r  r  r  none_results      rf   neverzNBuiltinVariable._binop_handlers.<locals>.create_cmp_op_handlers.<locals>.never  s    +K888rh   c                 J    t           |j        |j                            S r_   )r=   r   rS  s      rf   rr   zQBuiltinVariable._binop_handlers.<locals>.create_cmp_op_handlers.<locals>.<lambda>  s    -=bbqtnn-M-M rh   c                     t           | j                            |j                  | j                            |j                                      S r_   )r=   r'  get_submodule
module_keyrS  s      rf   rr   zQBuiltinVariable._binop_handlers.<locals>.create_cmp_op_handlers.<locals>.<lambda>#  sK    -= "$&I$;$;AL$I$I$&I$;$;AL$I$I!" !". . rh   c                    t          |          t          |          urt          j        j        dk              S ||u rt          j         ||                    S t	          |t
          j                  rFt	          |t
          j                  r.|j        |j        ur"t          j         ||                    S d S d S d S )NrU  )r   r=   rF  ri   r2   r   ExceptionVariableexc_type)r  leftrightr   s      rf   	handle_iszRBuiltinVariable._binop_handlers.<locals>.create_cmp_op_handlers.<locals>.handle_isL  s     Dzze44/6r{e7KLLLu}}/6rr$GGGtY%@AAH"5)*EFFH !M??/6rr$GGGH H H H @?rh   r  rW   )r=   rR  r   r<  rO   r;   _comparison_with_symnodeappendr   ri   
startswithobjectrP   rG   r@   r?   r>   _comparison_with_tensor)r   rN  resultop_varrT  rX  obj_op_nonenone_op_objtypes_that_are_never_nonerb  rW  r  r  r  r  rT   rU   r  r  s   `         @rf   create_cmp_op_handlersz?BuiltinVariable._binop_handlers.<locals>.create_cmp_op_handlers  sA        $ $%568HIJ  ((( -.>?AQRS(,, -o>";
 -o>";	      
 A7KLLL(*:;=MNOF3::<<<<AWAWB B< !b4009 9 9 9 9 9 $# ##$$',%%	-)  78HI'
 ./HI'	   ),, "6 G!5 G NMMM !1 0    78QR,
 67OP, "0@P Q!/@P Q - ,_=":
 -n=":
 -o>";
 -o>";_35 5 5nH H H H H H A9MNNNMrh   rc  )!	functionsr  r  	nn_moduler  r   r  r   r  user_definedr  rT   rU   r   r  r+  re  r;   rO   rJ   rL   r=   rI   rG   rH   r   r   r<  r   r   rN   r   r   )op_handlersr   magic_method_namesin_place_opr  r  inplace_namer  r  r)  r.  r0  list_like_addition_handlersr>  list_like_iadd_handlersrJ  list_like_expansion_handlersrn  r  r  r  r  rT   rU   r  r  s                     @@@@@@@@rf   _binop_handlerszBuiltinVariable._binop_handlers  st    	NMMMMMMM//////::::::,,,,,,	
 	
 	
 	
 	
 	
 	
 	
 	
 	
$  	 $$&&,,..P	 P	 
- KO')K$7I4L, *)D D D D D 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   	I 	I 	I 	I	H 	H 	H 	H  |, 
 }- 
 - 
 .!
  01!
 "=1  !%'79MN 	 "#34 W4
 	$z 	HL!(()DEEE	 	 	 	" /!
 .!
  01!
 	 & 	HM"))*ABBB	 	 	 	* ,-/?@-.0@A-/?@.0@A	
 	% 	HL!(()EFFF_	 _	 _	 _	 _	 _	 _	 _	 _	 _	 _	 _	B +133 	9 	9BB<<<[((((44R88KOOrh   c                     t                                                               |           }|d S g }|D ]=\  \  }}}t          ||          r%t          ||          r|                    |           >|S r_   )r   ry  get
issubclassre  )r   a_typeb_typehandlersmatchestype1type2rT  s           rf   _find_binop_handlerz#BuiltinVariable._find_binop_handlere  s    "224488<<4'/ 	( 	(#NUEG&%(( (Z-F-F (w'''rh   c                 8    | j         |                                 v S r_   )r   r   r   s    rf   can_insert_in_graphz#BuiltinVariable.can_insert_in_graphq  s    w$224444rh   Nc                 H     t                      j        di | || _        d S )Nr]   )super__init__r   )r`   r   rd   rA  s      rf   r  zBuiltinVariable.__init__t  s+    ""6"""rh   c                 R    | j         d}n| j         j        }| j        j         d| dS )NNone())r   ri   rA  )r`   names     rf   __repr__zBuiltinVariable.__repr__x  s6    7?DD7#D.)33D3333rh   c                     | j         S r_   r   r   s    rf   rB  z"BuiltinVariable.as_python_constant  s	    wrh   c                     t           t          j         t          t          j        t          t          j        i}| j        |v r|| j                 S t                                                      S r_   )	r   r   r   int64r   float64r   r  as_proxy)r`   DTYPErA  s     rf   r  zBuiltinVariable.as_proxy  sP    %*5=

 7e>!ww!!!rh   codegenrV   c                     | j         j        }| j         j        dk    sJ ||j        j        vs
J d            |                    |                    |d                     d S )Nbuiltinszshadowed globalT)r   )r   ri   rj   r  	f_globalsappend_outputcreate_load_global)r`   r  r  s      rf   reconstructzBuiltinVariable.reconstruct  sn    ww!Z////7:////1B///g8848HHIIIIIrh   c                 "    t          ||          S r_   )r&   r`   rc   rd   s      rf   constant_argszBuiltinVariable.constant_args  s    "4000rh   c                     d}|D ];}t          |t          j                  r dS |pt          |t          j                  }<|S NF)r   r   GetAttrVariablerP   )r`   rc   
any_tensorargs       rf   tensor_argszBuiltinVariable.tensor_args  sS    
 	Q 	QC#y899 uu#Pz#y7O'P'PJJrh   c                     d}|D ];}t          |t          j                  r dS |pt          |t          j                  }<|S r  )r|  r   r  rP   )r`   	arg_typesr  arg_types       rf   tensor_args_typez BuiltinVariable.tensor_args_type  sS    
! 	V 	VH(I$=>> uu#Uz(I<T'U'UJJrh   c                 .   g }g }t          j        ||                                          D ]G}t          |t          j                  r|                    |           2|                    |           Ht          d |D                       o	 | j        | S )Nc              3   P   K   | ]!}|j         t          |j                   ndV  "d S r  )r   r$   )r   ts     rf   r   zBBuiltinVariable.python_and_tensor_constant_only.<locals>.<genexpr>  sM       
 
 -.H,@qx(((e
 
 
 
 
 
rh   )		itertoolschainr   r   r   rP   re  r   r  )r`   rc   rd   r  non_tensor_argsis         rf   python_and_tensor_constant_onlyz/BuiltinVariable.python_and_tensor_constant_only  s    v}}77 	* 	*A!Y566 *""1%%%%&&q)))) 
 
 
 
 
 
 
 3 !d /2	3rh   c                 V    d | D             d |                                 D             fS )Nc                 6    g | ]}|                                 S r]   rB  r   s     rf   
<listcomp>z=BuiltinVariable.unwrap_unspec_args_kwargs.<locals>.<listcomp>  s$    5551$$&&555rh   c                 >    i | ]\  }}||                                 S r]   r  r   kvs      rf   
<dictcomp>z=BuiltinVariable.unwrap_unspec_args_kwargs.<locals>.<dictcomp>  s7     8
 8
 8
*.!QAq##%%8
 8
 8
rh   )r+  )rc   rd   s     rf   unwrap_unspec_args_kwargsz)BuiltinVariable.unwrap_unspec_args_kwargs  sA    55555 8
 8
28,,..8
 8
 8
 
 	
rh   c                 J    |                                  ot          ||          S r_   )r   r(   r  s      rf   has_constant_handlerz$BuiltinVariable.has_constant_handler  s-    --// 
4Q&5
 5
 	
rh   r  
has_kwargsc                 |   	
 ddl m t                     g t          fdD                       rfdS t	          j                   r(t           t                    s	 t          u r
	 	 d fd}|S 	                                rf t          j        u r t          d         t          j                  r8                              rj        S r                    j                   t#                    d	k    rbs`t          j         gR  

snKt#          
          dk    r
\  	                    	fd
           nd
fd}                    |           t'          d j         d           rd fd}                    |                                           r=t-          d D                       r	sd fd}nd fd}                    |            fdt#                    dk    rfdS t#                    dk    r\  dfd}ndfd}|S )Nr8   )LazyVariableTrackerc              3   8   K   | ]}t          |          V  d S r_   )r|  )r   r  r  s     rf   r   z0BuiltinVariable._make_handler.<locals>.<genexpr>  s.      EEaz!011EEEEEErh   c                 F                         | d |D             |          S )Nc                 6    g | ]}|                                 S r]   realizer   r  s     rf   r  zCBuiltinVariable._make_handler.<locals>.<lambda>.<locals>.<listcomp>  s     ///QQYY[[///rh   )r%  )r  rc   rd   objs      rf   rr   z/BuiltinVariable._make_handler.<locals>.<lambda>  s-    C,=,=//$///- - rh   r  rW   c                     t           u rEt          d |D                       s,t          dt          |          dg t          j                   t          j        |fi |S )Nc              3   ~   K   | ]8}t          |t          j                  ot          |j        t                    V  9d S r_   )r   r   r=   r   r   r   s     rf   r   zWBuiltinVariable._make_handler.<locals>.create_exception_class_object.<locals>.<genexpr>  sY       4 4  q)"<== 1"17C004 4 4 4 4 4rh   zassert with non-string messagez1Dynamo only supports asserts with string messagesgb_typecontextexplanationhints)AssertionErrorr   r   r   r   SUPPORTABLEr   r^  )r  rc   rd   r   s      rf   create_exception_class_objectzDBuiltinVariable._make_handler.<locals>.create_exception_class_object  s     '' 4 4 "4 4 4 1 1'
 % @ #D		$W> 1 =>	    !22tFFvFFFrh   r   r   c                      | g|R  S r_   r]   )r  rc   _binop_handlers      rf   rr   z/BuiltinVariable._make_handler.<locals>.<lambda>  s    MM"4Lt4L4L4L rh   c                 0    D ]} || g|R  }|r|c S d S r_   r]   )r  rc   r  r   rvbinop_handlerss        rf   call_binop_handlersz:BuiltinVariable._make_handler.<locals>.call_binop_handlers  sE    , & &R]T]]] &#%III&& &rh   call_c                    	  	| g|R i |}||S d S # t           $ r 	  t          j        	          j        | g|R i |  # t           $ rw}                    ||          }|sSt
                              d	|           t          dd	 d| d| dj         g t          j
                   Y d }~Y d S Y d }~Y d S d }~ww xY wt          $ r8}                    ||          }|s |                                 Y d }~d S d }~ww xY w)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  )rM  inspect	signaturebindr  logwarningr   ri   r   	DIFFICULTr   remove_from_stats)
r  rc   rd   ri  er  rI  r   r  self_handlers
          rf   call_self_handlerz8BuiltinVariable._make_handler.<locals>.call_self_handler  s   ,)\">t>>>v>>F)% *)    <),77<RQ$QQQ&QQQ   %   /2/G/Gf/U/U,3 KK S , !  
 -(L(Z<(Z(Z4(Z(ZRX(Z(Z,k^`^i,k,k&D(9(C&D	                  # , , ,+.+C+CD&+Q+Q(/ ))+++++++++,sE    
D	#AD	
CA$C 2D	9D	 CD	-DD	c              3   @   K   | ]}t          |t                    V  d S r_   )r|  r=   r   s     rf   r   z0BuiltinVariable._make_handler.<locals>.<genexpr>+  s-      GGJq"233GGGGGGrh   c                    	  d |D              }n# t           $ rS}t          t          |          | t          t	          t
          j        |j                                       Y d }~n@d }~wt          $ r0}t          dd d| dg t          j        |           Y d }~nd }~ww xY wt          j        | |          S )Nc                 6    g | ]}|                                 S r]   r  r   s     rf   r  zPBuiltinVariable._make_handler.<locals>.constant_fold_handler.<locals>.<listcomp>3  s$    CCCa2244CCCrh   r@  constant fold exceptionattempted to run function  with arguments 7Encountered exception when attempting to constant fold.r  r  r  r  from_exc)	Exceptionr   r   rD  rE  r=   rF  rc   r9   r   r   
DYNAMO_BUGr;   rQ  r  rc   rd   resrI  r   s        rf   constant_fold_handlerz<BuiltinVariable._make_handler.<locals>.constant_fold_handler/  s%    bCCdCCC %   0 II!%c*:*A38&L&L!M!M        
 ?   ($=$[$[$[UY$[$[(a"A$5$@"A%(         +0S999s!    
B(A	A++B(8&B##B(c                    t          ||          r	  d |D             i d |                                D             }n# t          $ r0}t          dd d| dg t          j        |           Y d }~ncd }~wt          $ rS}t          t          |          | t          t          t          j        |j                                       Y d }~nd }~ww xY wt          j        | |          S d S )	Nc                 6    g | ]}|                                 S r]   r  r   s     rf   r  zPBuiltinVariable._make_handler.<locals>.constant_fold_handler.<locals>.<listcomp>L  s$    !G!G!GQ!"6"6"8"8!G!G!Grh   c                 >    i | ]\  }}||                                 S r]   r  r  s      rf   r  zPBuiltinVariable._make_handler.<locals>.constant_fold_handler.<locals>.<dictcomp>M  s7     #" #" #"BF!QAq';';'='=#" #" #"rh   r  r  r  r  r  r@  )r(   r+  r9   r   r   r  r  r   r   rD  rE  r=   rF  rc   r;   rQ  r  s        rf   r  z<BuiltinVariable._make_handler.<locals>.constant_fold_handlerG  sp   4T6BB >"$"!G!G$!G!G!G##" #"JP,,..#" #" #"# #CC  C   ,(A(_R(_(_Y](_(_,e&E(9(D&E),          )   4 $S		 "%)#.>.Esx*P*P%Q%Q          /4R===-> >s$   .A 
C&A77CA	CCc                     d | D             }t          ddj         d d dj         d| d dd	j         d| d
j         dddg           d S )Nc                 6    g | ]}|                                 S r]   )python_type_namer   r  s     rf   r  zPBuiltinVariable._make_handler.<locals>.call_unimplemented_v2.<locals>.<listcomp>d  s$    EEEc2244EEErh   z 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  )r   ri   )rc   real_arg_typesr  r   r  s     rf   call_unimplemented_v2z<BuiltinVariable._make_handler.<locals>.call_unimplemented_v2c  s    EEEEEN:I2;IIIIZIIRSUS^ R R'5R RDNR R Rdbk d dQ_ d dTVT_d d de8     rh   c                      |          S r_   r]   )r  rc   rd   r  s      rf   rr   z/BuiltinVariable._make_handler.<locals>.<lambda>t  s    ,A,A$,G,G rh   c                 @     | ||          }|r|S  |           d S r_   r]   )r  rc   rd   r  r  rT  s       rf   builtin_dispatchz7BuiltinVariable._make_handler.<locals>.builtin_dispatchx  s:    WRv.. I%%d+++++rh   c                 N    D ]} || ||          }|r|c S  |           d S r_   r]   )r  rc   rd   r   r  r  r  s        rf   r  z7BuiltinVariable._make_handler.<locals>.builtin_dispatch  sR    " " "BBf--B "!			"%%d+++++rh   rc  )lazyr  r   r   r  isclassr|  r  GeneratorExitr  r   r   r   rP   r  _handle_insert_op_in_graphre  r   r  r   ri   r   r   )r   r  r  r  r  r  r  r  r  r  r  r  rT  r  r  r  s   ```     @@@@@@@@rf   _make_handlerzBuiltinVariable._make_handler  s   ------b!!+-EEEE9EEEEE 	     ?2 	1r9%%	1
 ]""G+G G G G G G" 10""$$ 	@("""y|Y-EFF # ##I.. @55 @ >??? y>>Qz,@PiPPPN! 5^$$))#1  L L L LMMMM& & & & & &  3444s$9BK$9$94@@ #	/, , , , , , , ,B OO-...((** 8	3GGYGGGGG5>"5>
: : : : : : :0> > > > > >4 OO1222	 	 	 	 	 	 	  x==AGGGGG]]a!JW, , , , , , , ,, , , , , , ,  rh   r  rW   c                 4   t          |          dk    r.t          dd|  d| d| j         dg t          j                   t          |          dk    sJ 	 |d                             |d	          S # t          $ r t          t          |           Y d S w xY w)
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   rM  r`   r  rc   s      rf   	call_varszBuiltinVariable.call_vars  s    t99>>K.....mRVRYmmm6)56	    4yyA~~~~	47&&r:666% 	4 	4 	4$Y333333	4s   A4 4BBc           
         ddl m}m} |r# | j        g ||                                R  sd S ddl m} ddlm}m}  ||||          r|j	        st                       t          |d         t                    sL| j        t          v rt          | j                 }	nt          | j                 }	|d         }
|d         |d<   |
|d<   nt          | j                 }	n| j        }	|                    ||	          } |||||          S | j        }	  | j        |i |r)ddlm} ddlm}  ||| ||j                  ||          S |t.          v r=t          |d         t0          j                  rt.          |         |d         |d         g}}|t4          j        u rUt          |d         t8                    r:t:          j        |d         t0          j                            d          |d         g}}t?          ||          r_tA          d	 |D                       sF |j!        j"        d
tG          |          gtI          ||          R  } |t0          j%        ||          S |t4          j&        u rYtO          |          dk    rFt          |d         t0          j                  r&|d         (                    |d|dd          |          S  |j!        j"        d
|gtI          ||          R  }tA          d |D                       r |tR          ||          S tU          ||          rt| +                    ||          \  }} ||i |}tA          d tY          j-        ||                                          D                       } |t\          ||||          S t_          d |D                       rt9          j        ||d           S |t4          j0        u r=t          |d         t0          j.                  r|d         1                                |d<    |||          S # td          $ r5 tg          dd|  d| d| d| j         dg th          j5                   Y d S w xY w)Nr8   )r$  wrap_fx_proxy_cls)SourcelessBuilder)can_dispatch_torch_functiondispatch_torch_functionr   r   )	unique_id)invoke_and_store_as_constantc              3   P   K   | ]!}t          |          t          j        k    V  "d S r_   )r   r   rP   r  s     rf   r   z=BuiltinVariable._handle_insert_op_in_graph.<locals>.<genexpr>  sI       B B:=S		Y55B B B B B Brh   r%  __eq__c              3   @   K   | ]}t          |t                    V  d S r_   r   rM   r  s     rf   r   z=BuiltinVariable._handle_insert_op_in_graph.<locals>.<genexpr>  s-      EE:c#344EEEEEErh   c              3   X   K   | ]%}t          |t          j                  |j        V  &d S r_   r   r   rQ   need_unwrapr   s     rf   r   z=BuiltinVariable._handle_insert_op_in_graph.<locals>.<genexpr>  K       " "!!Y%JKK"M" " " " " "rh   )	raw_valuer  c              3   @   K   | ]}t          |t                    V  d S r_   r   rO   r   s     rf   r   z=BuiltinVariable._handle_insert_op_in_graph.<locals>.<genexpr>  s,      BBZ?33BBBBBBrh   z,unimplemented builtin op on tensor argumentszpartial tensor op: r  r  z with tensor argumentsr  )6r&  r$  r  r  r   r  torch_functionr  r  exportr   r   rP   r   rY   rX   rF  r  bytecode_transformationr  ro  r  ri   IN_PLACE_DESUGARING_MAPr   r=   r   r   rO   r   selectr'   r   r'  r(  r3   r4   NumpyNdarrayVariabler   r   r  rM   r)   r  r  r  rQ   r   r   rB  NotImplementedErrorr   r   r  )r`   r  rc   rd   r$  r  r  r  r  ra   tmpfn_varr   r  r  proxy_args_kwargsr  r  s                       rf   r  z*BuiltinVariable._handle_insert_op_in_graph  s   ======== 	*$*CDC6==??CCC 	F 	/.....XXXXXXXX '&r488 	E 9 1333!$q'>:: =w";;;8A7@q'C"1gDG!DGG3DG<DDw&--b$77F**2vtVDDDWe	3t3TDVDD ??????CCCCCC33IIbk22D&   ,,,Q32 2, 326a$q'8JDX%%%*T!Wo*N*N%
 LQ!299!<<Q  (f55 	Tc B BAEB B B ? ? 	T /	.#*2.. 'tV44   )()GUSSS hk!!IINNtAw	(@AA # Aw**2xabb6JJJ*BI* #400  E
 EEEEEEE  0(($  
 *$77 0!%!?!?f!M!MwB111	! " "&_T6==??CC" " "   )(/' +    BBTBBBBB 	0&-b%>>> )))jGYB/ /) #1g88::DG$}R///" 	 	 	FDdDDTDDFDDqRVRYqqq6)56	      	s;   5P DP A&P  AP BP .P  AP ;QQcall_function_handler_cacherc   r;   rd   dict[str, VariableTracker]c                 h   |r6d |                                 D             }| j        gd |D             dR }n| j        gd |D             R }| j                            |          }|s=|                     | j        d |D             t          |                    x| j        |<   } ||||          S )Nc                 >    i | ]\  }}||                                 S r]   r  r  s      rf   r  z1BuiltinVariable.call_function.<locals>.<dictcomp>9  s&    @@@Aa@@@rh   c              3   4   K   | ]}t          |          V  d S r_   r   r   s     rf   r   z0BuiltinVariable.call_function.<locals>.<genexpr>:  (      44!d1gg444444rh   Tc              3   4   K   | ]}t          |          V  d S r_   r-  r   s     rf   r   z0BuiltinVariable.call_function.<locals>.<genexpr><  r.  rh   c                 ,    g | ]}t          |          S r]   r-  r   s     rf   r  z1BuiltinVariable.call_function.<locals>.<listcomp>A  s    000a$q''000rh   )r+  r   r(  r{  r  r   )r`   r  rc   rd   keyrT  s         rf   r%  zBuiltinVariable.call_function1  s      	6@@@@@F7;44t444;d;;CC7544t44455C266s;; 	>B>P>P004000$v,,? ? D,S1G wr4(((rh   list[VariableTracker]c                 2   | j         t          u r|dk    rt          |          dk    sJ t          |          dk    sJ |\  }}}|                                }t	          |t
                    rJ|j        j                            |          r+|	                                r|
                    |||          S |dk    ro| j         t          u rWt          |          dk    rDt          |          dk    sJ |j        j                            | |d         |dd                    S | j         t          u rt          |          dk    r|st          i t          t                                }t	          |d         t                    r|d         j         t          u r|S |j        j                            | |d         |dd                    S | j         t           u rt          |          dk    r|d                             |          r|st	          |d         t                    rQ|d         j         t           u r=|d                             |          }	t'          j        |	t                                S |j        j                            | |d         |dd                    S | j         t*          u r}t-          g t                                }
t	          |d         t                    r|d         j         t*          u r|
S |j        j                            | |d         |dd                    S | j         t.          u rt          |          dk    r|dv rt	          |d         t0                    r	 t3          t.          |          } ||d                                                   }t&          j                            |          S # t8          t:          f$ rS}t=          t?          |          |t+          tA          t0          j        |j!                            	           Y d }~nd }~ww xY w| j         t          u r|d
k    rt'          j        d           S | j         t          u r!|dk    rt          j"        |t          g|R i |S | j         t          u rt3          | j         |          }|tF          v rt	          |d         t&          j$                  r+|d         j%        &                    |||dd          |          S t	          |d         t&          j                  r&|d         &                    |||dd          |          S | j         tN          u rt3          | j         |          }|tP          v rt	          |d         t&          j)                  r+|d         j*        &                    |||dd          |          S t	          |d         t&          j+                  r&|d         &                    |||dd          |          S | j         tX          u rdt3          | j         |          }|tZ          v rFt	          |d         t&          j.                  r&|d         &                    |||dd          |          S | j         t^          u rrt          |          dk    r_t3          | j         |          }|t`          v rAt	          |d         t0                    r&|d         &                    |||dd          |          S | j         t.          u rvt          |          dk    rct	          |d         t0                    rHt1          j         t3          t.          |          |d                                                             S tc                      &                    ||||          S )N__setattr__   r   __new__r8   r4  r   )fromhexhexr@  r  fromkeys)2r   rg  r   r  r   rT   r'  r:  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   rD  rI   r   r=   r   rB  rF  OverflowError
ValueErrorr   r   rE  rc   call_custom_dict_fromkeysr+   rS   _dict_vtr  setr5   UserDefinedSetVariable_set_vtrF   	frozensetr-   rD   r   r6   r  )r`   r  r  rc   rd   r  name_varvaldict_vt	init_argslist_vtr   r  r  resolved_fnrA  s                  rf   r  zBuiltinVariable.call_methodE  sG    7f!6!6t99>>>>v;;!####!%C3++--C3 9::FI*@@EEF //11F
 222xEEE9w&  SYY!^^6{{a''''y-KK$q'48   w$3t99>>&>+BDTDVDVWWWd1g77 #DGJ$<N<N"N y-KKGH   5  IINNG99"== # # d1g77 DGJ%<O<O $Q A A" E EI$2!1A1C1C    y-KKGH   w$&r9I9K9KLLLd1g77 #DGJ$<N<N"Ny-KKGH   7eD		Q4;M3M3M$q'#344 
	 --B"T!W7799::C$5<<SAAA%z2   ,Q!#&6&=qv"F"FGG         7f!3!3-d3337d??tz11"<RWWWWPVWWW7d??!$'400Kl**d1gy'HII K7+77D$qrr(FSSSQ)DEE K7..r4abb6JJJ7c>>!$'400Kk))d1gy'GHH K7?66r4abb6RRRQ)>?? K7..r4abb6JJJ7i!$'400K///d1gy'BCC K7..r4abb6JJJ7c>>c$ii1nn!$'400Kk))d1g'788 K7..r4abb6JJJ7eD		Q$q'#344 '.(GE4((a)C)C)E)EFF   ww""2tT6:::s   0AO P+A	P&&P+c           	      l   t          |t          t          j        f          rt          |t          j                  r|                    |dg i           }n|}| j        t          u rt          nt          }ddl	m
}  |||j                            d||                                fi                     S d S )Nitemr   r#  r%  r  r%  )r   rO   r   rP   r  r   r   r   r   torch._dynamo.variables.builderr$  r'  r(  r  )r`   r  r  rQ  fn_r$  s         rf   _call_int_floatzBuiltinVariable._call_int_float  s     cOY-EFGG 	#y788 r62r::!W^^''CEEEEEE =i,,#]]__&	    	 	rh   c                 "   t          |t                    ryt          |j        t          j                  r|S t          |j        t          j        t          j        f          sJ t          j        ||	                                dk              S d S r{   )
r   rO   sym_numr   SymBoolr2   SymIntSymFloatrF  r  r`   r  r  s      rf   	call_boolzBuiltinVariable.call_bool  s     c?++ 	C #+u}55 

 #+en'EFFFFF")"cllnn.ABBB	C 	Crh   c                    t          |t          j                  r2t          j                            t          |j                            S t          |t          j                  rqt          |j	        d          r|j	        j
        }nNt          |j	        d          r|j	        j        }n,t          dt          |          dg t          j                   t          |j	                  j
        t           j
        u r:	 t          j                             |                      S # t"          $ r Y d S w xY wt%          |          r+t          ddt          |j	                   d	d
g           d S |j        }	 t          j        |          }n3# t(          $ r&}t*                              d|           Y d }~d S d }~ww xY w|                    ||gi           S t          |t          j        f          ret3          |j                  dk    r	|j         }n$d                    d |j        D                       }t          j                            |          S d S )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   >   K   | ]}|                                 V  d S r_   r  )r   r  s     rf   r   z+BuiltinVariable.call_str.<locals>.<genexpr>  s.      !K!KQ!"6"6"8"8!K!K!K!K!K!Krh   )r   r   r  r=   rF  r   r   rT   hasattrr   r^  r  r   r   
USER_ERRORr   rg  AttributeErrorr1   __func__r  r  r  rP  r^  r   rc   r_  join)r`   r  r  
str_methodbound_methoduser_func_variabler  r   s           rf   call_strzBuiltinVariable.call_str  sy   cI:<< 3	B-443sv;;4GGGiACC 1	Bsy),,  Y.

J// 	 Y/

 IHH W9-89	    CI&&.88$5<<::<<<PPP%   FF 1<< U N#'	?? i i i;<	       *2)2)G)U)U&&%   KK KQOOOFFFFF 556H3%QSTTTi9;<< 	B38}}!!<)		!K!K#(!K!K!KKK-4454AAA	B 	Bs*   >'D& &
D43D49F 
F>F99F>c                    t          |          dk    rL|d                             |          r1|d                             |          }|                     ||          S t          |          dk    r#|                     ||d         |d                   S t          |          dk    r|                     ||          S d S )Nr8   r   r   )r   r@  rA  _call_min_max_seq_call_min_max_binary)r`   r  rc   r+  s       rf   _call_min_maxzBuiltinVariable._call_min_max"  s    t99>>d1gCCBGG>G55b99E))"e444YY!^^,,Ra$q'BBBYY]]))"d333 ]rh   c                     t          |          dk    sJ t          |          dk    r|d         S t          j        t          j        | j        |          |          S Nr   r8   )r   	functoolsreducepartialrm  )r`   r  r+  s      rf   rl  z!BuiltinVariable._call_min_max_seq+  sQ    5zzA~~~~u::??8O	 1$2KR P PRWXXXrh   c                    ||d S |                      ||          r>t          |t          j                  s||}}t          |t          j                  sJ t          |t                    r4t          j        t          j                                      ||gi           }t          |t                    st          |t                    rHddl
m}  |t          |          | |j        j        d| j        gt!          ||gi           R            S |                                rt          |t          j                  rdd l}t          j        |j                  }nt          j        t          j                  }| j        t.          u rd|ind|i}|                    ||g|          }nt          |t          j                  r>dd l}t.          |j        t2          |j        i| j                 }	t          j        |	          }nCt.          t          j        t2          t          j        i| j                 }
t          j        |
          }|                    |||gi           }t7          d ||fD                       rt9          d	 ||fD                       rt          j                            |          S |                                r|                                }n|j        }| j        t.          u rt/          |j        |          }nt3          |j        |          }t9          d
 ||fD                       }t          j                             |||          S |S t          |t                    st          |t                    r`| j        t.          u rt          j!        nt          j"        } |j        j        d|gt!          ||gi           R  }t          j#        ||d           S t          |tH                    r^t          |tH                    rK|                     |                                |                                          }tI          |          S d S d S )Nr8   r  r%  rR  r   r   r   c              3   b   K   | ]*}t          |t          j        t          j        f          V  +d S r_   )r   r   rQ   r=   )r   r  s     rf   r   z7BuiltinVariable._call_min_max_binary.<locals>.<genexpr>g  sV       	 	  !=!2 	 	 	 	 	 	rh   c              3   @   K   | ]}t          |t                    V  d S r_   r  )r   rK  s     rf   r   z7BuiltinVariable._call_min_max_binary.<locals>.<genexpr>q  s-      KKSz#'788KKKKKKrh   c              3   X   K   | ]%}t          |t          j                  |j        V  &d S r_   r  r   s     rf   r   z7BuiltinVariable._call_min_max_binary.<locals>.<genexpr>}  r  rh   )%r  r   r   rP   rM   TorchInGraphFunctionVariabler   r   r%  rO   r&  r  r   r'  r(  r   r4   r;  r!  numpyNumpyVariableclipclampr   maximumr   minimumr   r   from_tensor_variablerB  r  rQ   sym_maxsym_minrF  r=   )r`   r  r  r  r  npr   rd   ri  np_fntorch_fnraw_braw_resr  py_fnr%  r   s                    rf   rm  z$BuiltinVariable._call_min_max_binary2  s   9	 FAq!! \	+a!9:: !1a!9::::: !-.. :5<HHVVR 
 !_-- A1O1O 666666((GG0")0' +Aq6266      ##%% :a!?@@ M&&&&"099BB"?LLB(,3%eQZ))"qc6::a!?@@ J&&&& "*c2:>twGE"077BB #U]CGPH"?IIB))"q!fb99  	 	 Q	 	 	 	 	   KKQFKKKKK S$5JJ6RRR'')) (0022EEKE7c>>!!+u55GG!!+u55G! " "V" " "  
 !<QQG[  
 ?++ 	+z!_/M/M 	+%)W^^EMME*BI*):Aq62)F)F  E #)"eT:::+,, 	+A?O1P1P 	+GG$$&&$$&& E $E***	+ 	+ 	+ 	+rh   r  c                     t          t                                        ||t          j        d          gi           }|                    |g i           S )N__abs__r   r   r%  r=   rF  )r`   r  r  
abs_methods       rf   call_abszBuiltinVariable.call_abs  Q    $W--;;&-i8892
 

 ''B333rh   c                     t          t                                        ||t          j        d          gi           }|                    |g i           S )N__pos__r  )r`   r  r  
pos_methods       rf   call_poszBuiltinVariable.call_pos  r  rh   c                     t          |t          j                  rt          dddg            t	          |          }t          j        |          }t          j                            |          S )Nzunsupported index(Tensor)r_  z;Dynamo does not support tracing builtin index() on a Tensorr  )	r   r   rP   r   r/   r   r   r=   rF  )r`   r  r  constant_values       rf   
call_indexzBuiltinVariable.call_index  so    c9344 	3Y	    3!,,)00@@@rh   c                     t          t                                        ||t          j        d          gi           }|                    |||          S )N	__round__r  )r`   r  r  rc   rd   round_methods         rf   
call_roundzBuiltinVariable.call_round  sQ    &w//==&-k::;R
 
 ))"dF;;;rh   c                     t          |i           rt          j        |          S  | j        | r-t	          d |D                       }t          j        |          S d S )Nc              3   n   K   | ]0}t           j                            t          |                    V  1d S r_   )r   r=   rF  r/   r  s     rf   r   z-BuiltinVariable.call_range.<locals>.<genexpr>  sL        IL	*11,s2C2CDD     rh   )r(   r   RangeVariable_dynamic_argsr?  r  s      rf   
call_rangezBuiltinVariable.call_range  sz    (r22 	1*4000T& 	1  PT    D *4000trh   c                     t          d |D                       p*t          d |                                D                       S )Nc              3   @   K   | ]}t          |t                    V  d S r_   r  r   s     rf   r   z0BuiltinVariable._dynamic_args.<locals>.<genexpr>  s,      @@a:a11@@@@@@rh   c              3   @   K   | ]}t          |t                    V  d S r_   r  r   s     rf   r   z0BuiltinVariable._dynamic_args.<locals>.<genexpr>  sE       H
 H
/0Jq/**H
 H
 H
 H
 H
 H
rh   )r   r   r  s      rf   r  zBuiltinVariable._dynamic_args  s]    @@4@@@@@ 
C H
 H
4:MMOOH
 H
 H
 E
 E
 	
rh   c                 *    t          j        |          S r_   )r   SliceVariabler  s      rf   
call_slicezBuiltinVariable.call_slice  s    &t,,,rh   c           
      p    ddl m}  || |j        j        d| j        gt          ||          R            S r"  )r&  r$  r'  r(  r   r4   )r`   r  rc   rd   r$  s        rf   
_dyn_proxyzBuiltinVariable._dyn_proxy  s]    ******}"BI"+<T6+J+J  
 
 	
rh   c                 X   t          |t          j                  rJ  | j        |i |r | j        |g|R i |S t          j                            | j                  }| |g t                                S |	                    |          r|j
        rYt          |j
                  sDt          |t                    r2t          |j
                            t          j                             nt#          |dd          rUt          |t$                    r@t'          |t(          t*          f          s$|j        j                            |j
                   t          |t          j                  r2t          |j
                            t          j                             nKt          |t          j                  s1t          |j
                            t          j                              |t;          |                    |                    t                                S d S )Nr4  r   F)r   r   IteratorVariabler  r  rG   cls_forr   r:   r9  r   r$   rK   r   r   r   TUPLE_ITERATOR_LENr   r@   r2   rF   rD   r'  guard_on_key_orderr   MappingProxyVariableMAPPING_KEYS_CHECKUnspecializedNNModuleVariableSEQUENCE_LENGTHrD  r,  r`   r  r  rc   rd   r   s         rf   _call_iter_tuple_listz%BuiltinVariable._call_iter_tuple_list  s>    c9#=>>>>>4t.v.. 	8"4?27777777(0099;3.00    ((,, 	z "4SZ"@"@ c#899 !
--l.MNN   
  Xu55E&s,=>>E !'s[:K,L M ME
 	488DDD!#y'EFF  &J11,2QRR    (Y-TUU  &J11,2NOO   3S,,R0011.00   7	 	rh   c                     t           j                            | j                  } |t	          |                    |                    t                                S r3  )r   rG   r  r   rD  rA  r:   r  s         rf   _call_iter_tuple_generatorz*BuiltinVariable._call_iter_tuple_generator  sU    (0099s..r2233*,,
 
 
 	
rh   c                    t          |t          j                  r]t          j                            | j                  } |t          |                    |                    t                                S t          |t          j	                  s*t          |t                    r'|                    |          r | j        ||g|R i |S  | j        ||g|R i |S r3  )r   r   r  rG   r  r   rD  rA  r:   LocalGeneratorObjectVariablerT   r@  r  r  r  s         rf   _call_tuple_listz BuiltinVariable._call_tuple_list  s    c9566 	H,44TW==C3S2226677.00    YCDD 	Hs566	H11"55	H 3422sLTLLLVLLL-4-b#GGGGGGGrh   c                    t          |t          j                  r|}nEt          |t          j                  r|                    |dg i           }n | j        ||g|R i |}|^t          j        t          j        j	                  
                    ||g|i           }t          |          rt          j        |          }|S )N__iter__)r   r   r  r  r  r  r  r   r  iter_r%  r   ObjectIteratorVariable)r`   r  r  rc   rd   rets         rf   	call_iterzBuiltinVariable.call_iter  s    c9566 	GCCY455 	G//"j"b99CC -$,RFtFFFvFFC; 0"( mBtb11  4yy <
  6s;;
rh   c           	         ddl m}m} ddlm} t          |t          j        |||f          rt          j        	                    d          S t          |t                    r1t          j        	                    t          |j                            S t          |t          t          t          t          t           t"          f          rt          j        	                    d          S d S )Nr8   )r  FunctoolsPartialVariabler  TF)ro  r  r  rp  r  r   r   r  r=   rF  rU   r   r   rO   rP   rI   rL   rH   )r`   r  r  r  r  r  s         rf   call_callablezBuiltinVariable.call_callable:  s    QQQQQQQQ//////2(( 	
 
 	< -44T:::011 	<-44Xci5H5HIII $

 

 	< -44U;;;	< 	<rh   c                 p    t          |          dk    r|d         S t          dd| d| ddg           d S )	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   )r`   r  rc   rd   s       rf   	call_castzBuiltinVariable.call_castW  sZ    t99>>7N0///v//JHI		
 	
 	
 	
 	
 	
rh   c                     t          |t          j                  r't          j        |t          |j                            S t          |t                    r't          j        |t          |j                            S d S r_   )	r   r   r  r;   rQ  dirr   r   r   r[  s      rf   call_dirzBuiltinVariable.call_dirb  si    c9=>> 	="(S^^<<<c?++ 	:"(S[[999	: 	:rh   c                 8    t          j        |t          g|R i |S r_   )r   call_custom_dictr>  r`   r  rc   rd   s       rf   	call_dictzBuiltinVariable.call_dicth  s%    /DJ4JJJ6JJJrh   c                    t          |          }t          |          dk    rt          |d         t          j                  rmt          |d         j        t          j                  rH| j        j        	                    |d         j                  s|d         
                    |           |d<   |                     t          j        | t          j                  t          j        | |          g||          S )Nr8   r   )rD  r   r   r   r  r  r  r'  r:  has_pending_mutationget_forwarded_dictrP  r;   rQ  r   construct_dict)r  user_clsrc   rd   s       rf   r  z BuiltinVariable.call_custom_dictk  s    DzzIINN47I$=>> 47;	(JKK  I*??QLL  1g0044DG--!"i&>??"2x00848
 
 	
rh   c                 "   |t           t          t          hv sJ |rQ|t          u sJ t          |          dk    rt          |          dk    rd|v sJ g ||                    d          R }t          |          dk    r,t          j        d          }t          t          | |g           t          |          dk    rg |t          j        d           R }t          |          dk    sJ |\  }}|t          urt          nt          }t          |t                     rQd |                                D             } |t                               ||          |t                                S |                    |           ra|                    |           }t#          d	 |D                       r3 |t                               ||          |t                                S t%          d
|j         d| d| d|j         dddg           d S )Nr8   r   r   z-fromkeys expected at least 1 arguments, got 0r@  r   c                 6    g | ]}t          j        |          S r]   )r=   rF  )r   r  s     rf   r  z=BuiltinVariable.call_custom_dict_fromkeys.<locals>.<listcomp>  s$    BBB!#*1--BBBrh   r4  c              3   4   K   | ]}t          |          V  d S r_   )rE   r  s     rf   r   z<BuiltinVariable.call_custom_dict_fromkeys.<locals>.<genexpr>  s(      00a;q>>000000rh   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  )r>  r   r   r   popr=   rF  r   rM  r@   rA   r   keysr9  r:   r@  rA  r   r   ri   )	r  r  rc   rd   msgr  r   DictVariableTyper  s	            rf   rD  z)BuiltinVariable.call_custom_dict_fromkeys~  so    D+{;;;;; 	0{****t99>>c&kkQ&6&67f;L;L;LL/T/6::g..//Dt99>>")? C %Y#????t99>>9T9+248899D4yyA~~~~
U!)!<!<BU 	 c4   	BBsxxzzBBBC##c5))8CSCUCU    ..r22 	0044D00400000 ''MM$.."2"4"4    	4(FFtFFfFF0(*; 0 0 0 ;/
	
 
	
 
	
 
	
 
	
 
	
rh   c           
         |rJ |st          g t                                S t          |          dk    r;t          t          |t          j        dt          |           d          g           |d         }t          |t          j                   r"|	                    t                                S |
                    |          r2|                    |          }t          |t                                S t          |t          j                  rt          |j        t                    r|                    |d          }t          |t          j                  rV|                    |||          }t          |t                     r|S t'          t(                                        ||          S t          t          |t          j        d          g           d S )	Nr4  r8   z&set() takes 1 positional argument but  were givenr@  r   r  z!failed to construct builtin set())rF   r:   r   r   rM  r=   rF  r2   r   cloner@  rA  r   rT   r   r   r  UserMethodVariablerP  r   rF  call_set)r`   r  rc   rd   r  r+  iter_fnouts           rf   r  zBuiltinVariable.call_set  s   z 	Er1A1C1CDDDDt99>>$$+WTWWW     1g#y,-- 	>99+;+=+=9>>>..r22 	>11"55Eu4D4F4FGGGGY@AA 	>jIxG
 G
 	> oob*55G'9#?@@ >44WdFKKc;// J&s++44R=== ")*MNNO	
 	
 	
 	
 	
 	
rh   c           
         |rJ |st          g           S t          |          dk    r;t          t          |t	          j        dt          |           d          g           |d         }t          |t          j                   rt          d |j        D                       S |	                    |          r$|
                    |          }t          |          S t          t          |t	          j        d          g           d S )Nr8   z,frozenset() takes 1 positional argument but r  r@  r   c                     g | ]	}|j         
S r]   )vtr   s     rf   r  z2BuiltinVariable.call_frozenset.<locals>.<listcomp>  s    %B%B%Bqad%B%B%Brh   z'failed to construct builtin frozenset())rD   r   r   rM  r=   rF  r2   r   	set_itemsr@  rA  )r`   r  rc   rd   r  r+  s         rf   call_frozensetzBuiltinVariable.call_frozenset  s'   z 	)$R(((t99>>$$+]s4yy]]]     1g#y233 	,$%B%BCM%B%B%BCCC..r22 	,11"55E$U+++ ")*STTU	
 	
 	
 	
 	
 	
rh   c                     |rt          |          dk    rd|v sJ |                    dd          }fd|D             }t          j        ||t	                                S )Nr8   strictFc                 d    g | ],}t          t                                        |gi           -S r]   )r   iterr%  )r   r  r  s     rf   r  z,BuiltinVariable.call_zip.<locals>.<listcomp>  s5    SSSs%%33BrBBSSSrh   )r  r5  )r   r  r   ZipVariabler:   )r`   r  rc   rd   r  s    `   rf   call_zipzBuiltinVariable.call_zip  s     	;v;;!##F(:(:(::He,,SSSSdSSS$/?/A/A
 
 
 	
rh   c                     	 |d                              |d|dd          |          S # t          $ r<}t          t          |          |t	          |j                             Y d }~d S d }~ww xY w)Nr   __len__r8   r@  )r  rd  r   r   rD  rc   )r`   r  rc   rd   r  s        rf   call_lenzBuiltinVariable.call_len  s    	E7&&r9d122hGGG 	E 	E 	E$T!WWbtAF||DDDDDDDDDD	Es   %( 
A.1A))A.c                 N    |d                              |d|dd          |          S )Nr   __getitem__r8   r  r  s       rf   call_getitemzBuiltinVariable.call_getitem  s(    Aw""2}d122hGGGrh   c           	      V   	                                  }n9# t          $ r, t          dd d| dd g t          j                   Y nw xY w|                                }t          t          j                  r5j	        .fd}t          j
                             ||                    S t          t          j                  rEt          j        t          j                  r&t          dd d| dd	g t          j                   t          t          j                  rKd
|j        j        v r=t          j
                            |j                            |j                            S t          t          j                  r"t          j        t          ||                    S t          |t*                    st-          t/          |d
d                     r|f}n{t0          j        dk    r"t          |t          j                  r|j        }nIt          |t8                    rt;          d |D                       r|}nt=          t>          |dg           	 tA          ||          }n# t>          $ r ||v }Y nw xY wt          j
                            |          S )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                     fdt          |          t          u rt          fd|D                       S  |          S )Nc                 <   | t           vr}                                j        j        d         }t	          |          r(| t
          j        j        j        u rt          ||           S t                                          |           S t           |          }j        |v S )Nexample_value)r7   r  nodemetar   r   nn	parameter	Parameterr   r|  python_typern   )tyexample_valdtypesr  s      rf   
check_typezOBuiltinVariable.call_isinstance.<locals>._tensor_isinstance.<locals>.check_type  s    !444&)llnn&9&>&O9+FF	E "eh&8&B B B
 $.k2#>#>>#-coo.?.?#D#DD04F9..rh   c              3   .   K   | ]} |          V  d S r_   r]   )r   r  r  s     rf   r   zNBuiltinVariable.call_isinstance.<locals>._tensor_isinstance.<locals>.<genexpr>!  s+      DD"zz"~~DDDDDDrh   )r   r?  r   )
tensor_vartensor_typer  r  s     @rf   _tensor_isinstancez;BuiltinVariable.call_isinstance.<locals>._tensor_isinstance  se    / / / / /" $$--DDDDDDDDDD%:k222rh   z<isinstance() called on user defined object with C extensionszeUser-defined object with C extensions can have torch.Tensor attributes; intentionally graph breaking.__instancecheck__)r5  
   c              3   |   K   | ]7}t          |t                    pt          t          |d d                    V  8dS )r  N)r   r   r   r   )r   tps     rf   r   z2BuiltinVariable.call_isinstance.<locals>.<genexpr>J  sZ       8
 8
 r4  THWR9Ld-S-S$T$T8
 8
 8
 8
 8
 8
rh   z?isinstance() arg 2 must be a type, a tuple of types, or a unionr@  )!r  r"  r   r   r  rB  r   r   rP   rn   r=   rF  rT   r   rb   MemberDescriptorTyper  rA  r   r  !UserDefinedExceptionClassVariabler   r   r   sysversion_info	UnionType__args__r?  r   r   rM  r|  )r`   r  r  isinstance_typer  r  isinstance_type_tuplerK  s     `     rf   call_isinstancezBuiltinVariable.call_isinstance  s>   	((HH" 	 	 	P?c??_???a\_aa5)45	     	 *<<>>c9344 	9N3 3 3 3 3. -44""388  
 c9>?? 		JIu1E
 E
 		 V?c??_???<6)56    sI?@@	#'@'III-44);;OSYWW   c9FGG 	R#*:h+P+PQQQ ot,, 	O%8$??1
 1
 	 &5$6!!((ZU_.
 .
( %4$<!!// 	C 8
 8
%8
 8
 8
 5
 5
 	 %4!!$U   
	4 X'<==CC 	4 	4 	433CCC	4)00555s!    3AA'I8 8J	J	c           	         	 |                                 }|                                 }n7# t          $ r* t          dd| d| dddgt          j                   Y nw xY wt          j        t          ||                    S )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  )rB  r"  r   r   rc  r   r=   r|  )r`   r  left_tyright_ty
left_ty_pyright_ty_pys         rf   call_issubclasszBuiltinVariable.call_issubclasse  s    	 3355J"5577KK" 		 		 		B<g<<<<<U9&1	     		 )*Z*M*MNNNs   (+ 1AAc                 ,    t          j        ||          S r_   )r   SuperVariabler`   r  r  r  s       rf   
call_superzBuiltinVariable.call_supery  s    &q!,,,rh   c                 2   |d         }	 |                     |          S # t          $ r t          |          dk    r
|d         cY S  t          $ rF}t	          |t
          j                  r&|                                 |j        d         cY d }~S  d }~ww xY w)Nr   r   r8   )	next_variabler   r   r   r   r   rG   r  r+  )r`   r  rc   r  exs        rf   	call_nextzBuiltinVariable.call_next|  s    1g
	$$R(((( 	 	 	4yyA~~Aw 	 	 	#y9:: $$$&&&y|######		s'    %B
B:B
BBBc                    |                                 rk|                                }t          |t          j                  r't          j        t          |j        |                    S |                    ||          S d S r_   )	r;  rB  r   r   r   r=   rb  r   call_obj_hasattr)r`   r  r  attrr  s        rf   call_hasattrzBuiltinVariable.call_hasattr  sz    ""$$ 	2**,,D#y899 I 1'#&$2G2GHHH''D111		2 	2rh   c                 f    fd|D             }t          j        ||t                                S )Nc                 h    g | ].}|                               r|                              n|/S r]   )r9  r,  )r   r=  r  s     rf   r  z,BuiltinVariable.call_map.<locals>.<listcomp>  sP     
 
 
 ,/+F+Fr+J+JSC##B'''PS
 
 
rh   r4  )r   MapVariabler:   )r`   r  r   seqss    `  rf   call_mapzBuiltinVariable.call_map  sL    
 
 
 

 
 
 $R=M=O=OPPPPrh   c                     |                     |          r|                    |          n|}t          j        ||t	                                S r3  )r9  r,  r   FilterVariabler:   )r`   r  r   r=  s       rf   call_filterzBuiltinVariable.call_filter  sM    -0-H-H-L-LUc%%b)))RU'C?O?Q?QRRRRrh   c                 F   | j         ot          | j         |          }| j        t          u ra	 t	          | j        |          }n%# t
          $ r t          t
          |           Y nw xY wt          |          st          j	        |||          S t          j        | ||          S r   )r   r!   r   rg  r   rd  r   r   r;   rQ  r   r  )r`   r  r  r   r   s        rf   r  zBuiltinVariable.var_getattr  s    >DK!>!>7f=..! = = =(<<<<<=E?? @&,R???(tFCCCCs   A A$#A$r  rJ  c           
         |                                 st          dd| d| d| dddg           |                                }t          |t                    r|dk    rd	}j        j                            |          rat          |t          j	                  rG|d
v rC|j
        r<j        j                            |          rt          dd| d| d| ddg            j        j                            ||          r j        j                            ||          S |E|                     ||          }|                                dv sJ |                                s|S |j        ot!          |j        |          |dv r	 |                                }t          |t"                    r}|dk    r7fdt%          |j                  D             }t          j        |          S |dk    rt+          j        |j                  S |dk    rt1          j        |j                  S n# t6          $ r Y nw xY wt          |t          j                  r|                    |          S t          |t          j        t          j        t          j        t          j        t          j         t          j!        f          r2t          |t          j!                  rStE          |j#        j$        tJ          j&                  r/tN          j(        r#|dv rt          dd| d| dd| dg           t          |t                    rr|j)        j*        j+        d         }	t          |	tX          j-                  rAt]          |	          r2j/        rtN          j0        st          dddg tb          j2                   	 |                    |          S # t6          $ r t          j3        ||          cY S w xY wt          |t          j4                  rtk          |j#        |          }
t          |
tX          j6        j7        tX          j6        j8        f          r:tX          j9        j:        ;                    |
          rt          j4        |
          S |tx          v rt          j3        ||          S d S t          |tz                    r|j>        s||j#        j?        vrtk          |j#        |          }
n|j#        j?        |         }
tN          j@        r!jA        B                    |j#        ||
           t+          j        |
          S t          |t          jD                  r+|dv r't1          j        tk          |jE        |                    S 	 |                    |          S # t6          $ r t          j3        ||          cY S w xY w) 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__r1  c           
      b    g | ]+\  }}t          j        |ot          |                    ,S r]   )r;   rQ  r"   )r   r  r  r   r  s      rf   r  z0BuiltinVariable.call_getattr.<locals>.<listcomp>  sR     & & & !%1 ,1 "Av'J-2J2J & & &rh   r   r0  r2  )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.r  zAttempted to wrap sparse Tensorr_  z-torch.compile does not support sparse Tensors)ri   rj   )Fr;  r   rB  r   rP   r'  r:  r:  r   r  is_state_mutatedr  has_pending_mutation_of_attr	load_attrr  r   r!   r   	enumerater1  rL   r;   rQ  r0  r=   rF  r2  r"  r  r  NamedTupleVariableDistributedVariabler  rT   r|  r   rA  unittestTestCaser   enable_trace_unittestr%  r  r  r   Tensorr   r  capture_sparse_computer   r  r  ry  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   )r`   r  r  rJ  defaultr  hasattr_varr   
tuple_argsfake_valmemberr   s    `         @rf   call_getattrzBuiltinVariable.call_getattr  s    **,, 	C@3@@(@@g@@@XJK	    **,, c>** 	twD9!77<< 	#yFGG   , 	.CCCHH % N D3 D D$ D D' D D D%2     9!>>sDII 	?9)33C>>>++BX>>K1133}DDDD1133 <
3:t < <999..00eT** H{**& & & & & )2%/(B(B	& & &
  )6z&QQQQz)).4RPPP{**/6uGGG&    c9566 Q	K??2t,,,(,*-23

 

 O	K 3	 CDDsy2H4EFF 0   !=A4AA ^VZ ^ ^ ^=4 = = =	    #~.. 9>.?x66
%h//
  Y
 /5.K

 % A "$S> 1 =>	   Kr4000& K K K 0d6JJJJJJKYCDD 	KSY--F4ej6KL  K-+GGOOK !=fVTTTT/// 0d6JJJJ 0/[)) 	K| 2t39+=== D11+D1+ O 55civNNN"(VV<<<C788 		KT F
 >
 >
 $*7364+@+@AAAKr4000& K K K 0d6JJJJJJKsC   A%H5 4 H5 H5 5
II=O !O76O7V& &!W
	W
rK  c                    t          t          j        t          j        t          j        t          j        t          j        f          r                    |d||gi           S |j        j	        
                              r^|                                rI|                                }t          t          j                  rddlm} |dk    r+t!          dd d| d| dd	g t"          j        
           n|dk    rj        t!          dd d| d| dddg
           n.j        |j        k    rt!          dd d| d| dddg
           fd|j        j        D             }|D ]!}|j        j                            |           "t/          |          5  t1          j                    5   || |j        j        dt0          j        j        gt;          |gi           R            }	d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d }
|j                            d|
|	                                fi             |
                                j        j         d                    |	S |dv rd}n1tC          |          r"t!          dd d| d| ddd| dg
           |j        j	        "                    ||           |S t          t          j#                  rP|j        $                                stK          d          |                                rt          |t          j                  rtM          |                                j        |          }	 '                    ||                                          }n# tP          tR          f$ r d }Y nw xY wt          |t          j                  r_tM          |                                j        |          }tU          j+        j,        d          }||u r|t0          j-        j.        j/        u r|S 0                    |           d S d S )Nr4  r8   r#  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 dtypec                 4    g | ]}|j         j         k    |S r]   r   )r   tfr  s     rf   r  z0BuiltinVariable.call_setattr.<locals>.<listcomp>	  s.     ! ! !!	SZ@W@W@W@W@Wrh   r%  c                 x    | j         }|dk    r|dz
  }t          j        j                            | f|f           | S rp  )_versionr   _C	_autograd_unsafe_set_version_counter)r   versions     rf   _lower_version_count_by_1z?BuiltinVariable.call_setattr.<locals>._lower_version_count_by_1	  s?    "#*"Q;;&-kG*FFtgZXXX rh   r  )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   NestedUserFunctionVariabler^  r  r'  r:  r:  r;  rB  rP   r&  r$  r   r   r  r   rn   tracked_fakesremovedynamo_disable_gradr   no_gradr(  rA  set_r4   r  r  r  r0   
store_attrr  is_root_tracerr   r.   r  rd  r   r  getattr_staticmodule_typer  Moduler4  convert_to_unspecialized)r`   r  r  rJ  rK  r  r$  	to_removerW  r  r^  assigning_fake_valgetattr_varexisting_fake_attrmod_setattrs     `            rf   call_setattrzBuiltinVariable.call_setattrD	  s    +,34+	
 	
 V	- ??2}xorJJJI"88==K	-++--K	- ..00D#y788 g222222 ?**$ C @3 @ @$ @ @# @ @ @%l ? 1 =>     V^^ z)($L$Ds$D$Dd$D$Dc$D$D$D)P!M#	 	 	 	 	 ci//($_$Ds$D$Dd$D$Dc$D$D$D)J!M#	 	 	 	 ! ! ! !%'Y%<! ! !I ( ; ;	/66r:::: -R00 	 	%-// 	 	+m2BI2 / % 1 "3C:r!B!B   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	! ! ! I**'1)	   .-cllnn.A.F.WXXX J... "DD066  % @ @3 @ @$ @ @# @ @ @$\Nt N N N	    I"--c4===JY788 	-9++-- ,U   **,, +Y-2 2 + &4CLLNN4G%L%L"'"%//"h6Q6Q6S6S"T"TKK&(>? ' ' '"&KKK' k9+CDD 
+)78L8L8N8N8SUW)X)X& #*"8-"X"XK*.@@@'58?+FFF**((,,,,,7	- 	-sH   $H8>H6HH	H	H	
HH H:(N# #N98N9c                 4    |                     |d|gi           S )N__delattr__r  )r`   r  r  rJ  s       rf   call_delattrzBuiltinVariable.call_delattr	  s     r=8*bAAArh   c                    	 |                                 }n<# t          $ r/}t          t          j        t          |          d          d d }~ww xY w|j        ot          |j                  }|(t          |t          j
                  r|j        r|j        }|t          j        u r=|j                            dt                    }t!          t#          |          d          }t%          j        |||          S )Nunknown_python_type)	case_namer_  rA  )r  r"  r   r   INVALID_INPUTr   r   r%   r   r   rT   
cls_sourcer   rA  r'  install_global_by_idr!   r#   r;   rQ  )r`   r  r  py_typeerrorr   r  s          rf   	call_typezBuiltinVariable.call_type	  s    	oo''GG" 	 	 	+E

/   		 6
3: 6 6N3	 CDD   ^Fel""911"e<<DT 2 2H==F$R&999s    
A*AAc                     |                     |          rCt          t          |                    |                              }t	          j        |          S d S r_   )r9  rD  reversedr,  r   rL   )r`   r  r  r+  s       rf   call_reversedzBuiltinVariable.call_reversed
  sV    &&r** 	2#"9"9""="=>>??E*5111	2 	2rh   c                    |                     |          rit          |t          j                  sQt          j        |                    |          t                                }|                    |dg |           |S d S d S )Nr4  sort)r@  r   r   rP   rI   rA  r:   r  )r`   r  r  rd   list_vars        rf   call_sortedzBuiltinVariable.call_sorted
  s     ,,R00 	):
 :
 	 !---b11.00  H   VR888O	 	 	 	rh   c                 6   t          |t                    r;t          j        |t          j        |                                          d           S t          |t                    r3|                    |d          j        r|	                    |dg i           S d S )NrW  __neg__)
r   rO   rF  r   r   r  rT   r  r   r  r`   r  r  s      rf   call_negzBuiltinVariable.call_neg
  s    a)) 	")qzz||,,    q344	8""2y117	8 ==YB777 trh   c                     |                                 }t          |          }t          j                            |||          S r_   )rB  r   r   StringFormatVariablerF  )r`   r  _format_stringrc   rd   format_strings         rf   call_formatzBuiltinVariable.call_format*
  s;    &99;;M**-44]D&QQQrh   c                    t          |          dk    rst          |d         t          j                  rS|d         }|j                            |j                  }t          j                            t          |                    S t          |          dk    rt          |d         t          j
        t          j        f          r}|d         j        r7t          |d         j                            t          j                             t          |d         j                  }t          j                            |          S t          |          dk    r8t          |d         t$                    r|d         }|                    |          S t)          |d         t          j                  r7t          j                            t          |d         j                            S t)          |d         t          j                  r7t          j                            t          |d         j                            S t)          |d         t          j                  r7t          j                            t          |d         j                            S t5          dt7          |          d| dgt8          j                   d S )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  r'  r[  r\  r=   rF  idr  rT   r   r   r   r   ID_MATCHr   rP   call_idr2   r  r   SkipFunctionVariabler  
fake_valuer   r   r   r  )r`   r  rc   nn_mod_variabler   constant_resulttensor_variables          rf   r  zBuiltinVariable.call_id/
  s=   t99q==ZQ1KLL="1gO)))/*DEEC-44RWW===YY!^^
G/1TU!
 !
^ Aw~ Pd1gn778MNNOOO a//O-44_EEEYY!^^
47N C C^"1gO"**2...DGY;<< 	-44RQ
^^DDDDGY;<< 	-44RQ5F5FGGGDGY?@@ 	-44RQ8J5K5KLLL4D		ZTXZZ8 '2		 	 	 	 	 	rh   c                 N    t          dd| dddgt          j                   d S )Nzcopy.deepcopy()zcopy.deepcopy(r  z'Dynamo does not support copy.deepcopy()zAvoid calling copy.deepcopy()r  )r   r   r  )r`   r  r   s      rf   call_deepcopyzBuiltinVariable.call_deepcopyQ
  sJ    %)Q)))A/".		
 	
 	
 	
 	
 	
rh   c                    ddl m} ddlm} | j        }|t
          j        t
          j        fv rt          |t                    o|t          |t                    ogt          t          |                                j                            t          t          |                                j                            k    }|t
          j        u rt          j        |          S t          j        |           S ||vr;t!          d|j         d| d| dd|j         d	| d| g t$          j        
           t          |t                    rt          |t                    r|j        o|j        }|j        |j        k    rm	 t+          j        |j        |j                   nL# t.          $ r? t!          d|j         d| d| dd| d| d|j         dg t$          j        
           Y nw xY wt          |t                    r|n|}|j                            d||                                |                                fi           }	 |t7          |          ||	          S )Nr8   ru  %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 .r%  )r&  r  r   r  r   r   rU  is_notr   rP   r  r,   r  r  r=   rF  r   ri   r   r  sizer   broadcast_shapesRuntimeErrorrc  r'  r(  r   )
r`   r  r`  ra  r  r  r   	is_result
tensor_clsr%  s
             rf   rh  z'BuiltinVariable._comparison_with_tensor\
  s   ......AAAAAAW(,000400 Iun55I1$--//2FGGHH01A1A1FGGHHI  X\!!'.y999'.9}===::::;99999999 9 9)-9 9169 96)56    t^,,	5.11	 )uz6	UZ''
&ty%*====    V!{==T==U===!QQU !Q !QY^ !Q !QBD+!Q !Q !Q9-89      (n==HTT5
	&&R$--//5>>3C3C!Db
 
 ! 
 
 	
s   ?F AG('G(c           
         ddl m} | j        }||vr;t          d|j         d| d| dd|j         d| d| g t
          j        	           t          |t          j	                  r*t          j
         |t                      d                     S |j                            d
||                                |                                fi           }t          j        ||d           S )Nr8   r  z!unsupported SymNode comparison opr  r`  r  r  z with SymNode arguments r  r%  r  )r   r  r   r   ri   r   r  r   r   r  r=   rg  r'  r(  r  rO   rF  )r`   r  r`  ra  r  r   r%  s          rf   rd  z(BuiltinVariable._comparison_with_symnode
  s-   AAAAAAW:::;;9999999: : :*.: :27: :6)56    eY?@@ 	B-bb4.@.@AAA	&&R$--//5>>3C3C!Db
 
 %
 
 
 	
rh   c                 |    t          |t          t          t          f          r|                    |d|gi           S d S )N__xor__r   rB   rF   rT   r  r  s       rf   call_xorzBuiltinVariable.call_xor
  A    a*K9RSTT 	9==YR888	9 	9rh   c                 |    t          |t          t          t          f          r|                    |d|gi           S d S )N__ixor__r  r  s       rf   	call_ixorzBuiltinVariable.call_ixor
  A    a*K9RSTT 	:==Z!b999	: 	:rh   c                 |    t          |t          t          t          f          r|                    |d|gi           S d S )Nr   r  r  s       rf   call_subzBuiltinVariable.call_sub
  r  rh   c                 |    t          |t          t          t          f          r|                    |d|gi           S d S )Nr   r  r  s       rf   	call_isubzBuiltinVariable.call_isub
  r  rh   c           
         t          |t                    rt          |t                    rd S t          |t          t          f          r_t          |t          t          f          rCt          j        | |j        j        dt          j        gt          ||gi           R  d           S t          |t          t          t          f          r|                    |d|gi           S d S )Nr%  r  __and__)r   r=   rO   rF  r'  r(  r   r   r4   rB   rF   rT   r  r  s       rf   	call_and_zBuiltinVariable.call_and_
  s    a)** 	z!=M/N/N 	4a/+;<== 		*!12C
 C
 		 #)&	&#X]5F1vr5R5R       a*K9RSTT 	9==YR888	9 	9rh   c           
         t          |t                    rt          |t                    rd S t          |t          t          f          r_t          |t          t          f          rCt          j        | |j        j        dt          j        gt          ||gi           R  d           S t          |t          t          t          f          r|                    |d|gi           S d S )Nr%  r  __iand__)r   r=   rO   rF  r'  r(  r   r   r4   rB   rF   rT   r  r  s       rf   	call_iandzBuiltinVariable.call_iand
  s    a)** 	z!=M/N/N 	4a/+;<== 		*!12C
 C
 		 #)&	&#X]5F1vr5R5R       a*K9RSTT 	:==Z!b999	: 	:rh   c           
         t          |t                    rt          |t                    rd S t          |t          t          f          r_t          |t          t          f          rCt          j        | |j        j        dt          j        gt          ||gi           R  d           S t          |t          t          t          t          t          t          f          r|                    |d|gi           S d S )Nr%  r  __or__)r   r=   rO   rF  r'  r(  r   r   r4   r@   rB   rR   rF   rS   rT   r  r  s       rf   call_or_zBuiltinVariable.call_or_
  s   a)** 	z!=M/N/N 	4a/+;<== 		*!12C
 C
 		 #)&	&#X\4Eq!fb4Q4Q       ! &')

 

 	8 ==XsB777 trh   c           
         t          |t                    rt          |t                    rd S t          |t          t          f          r_t          |t          t          f          rCt          j        | |j        j        dt          j        gt          ||gi           R  d           S t          |t          t          t          t          t          f          r|                    |d|gi           S d S )Nr%  r  __ior__)r   r=   rO   rF  r'  r(  r   r   r4   r@   rB   rR   rF   rT   r  r  s       rf   call_iorzBuiltinVariable.call_ior  s
   a)** 	z!=M/N/N 	4a/+;<== 		*!12C
 C
 		 #)&	&#X\4Eq!fb4Q4Q       ! &)	
 	
 
	9 ==YR888 trh   c           
      x   t          |t                    rBt          j        | |j        j        dt
          j        gt          |gi           R  d           S t          |t                    r|j	        }t          |t          t          f          r*t          j        t          |j                  dk              S d S )Nr%  r  r   )r   rO   rF  r'  r(  r   r   r4   rC   dv_dictrI   r@   r=   r   r+  r  s      rf   	call_not_zBuiltinVariable.call_not_   s    a)) 	")&	&#X]5FsB5O5O       a)** 		Aa,(9:;; 	>#*3qw<<1+<===trh   r  r  c                 4    |                     |d|gi           S )N__contains__r  r  s       rf   call_containszBuiltinVariable.call_contains2  s     }}R!b999rh   )r   N)r  rV   rc  )rc   r2  rd   r)  r   r;   )r  rW   r  r;   r_   )pri   rj   rk   rl   rg  	_SENTINELr;   _nonvar_fieldsclassmethodr   staticmethodrq  cacher   r   r   r>  r	   r?  rD  r   r  ry  r  r  r  r  rB  r  r  r  r  r  r  r  r  r   r   r  r	  r  r(  r   __annotations__r%  r  rU  call_int
call_floatr\  rj  rn  rl  rm  call_mincall_maxr  r  r  r  r  r  r  r  r  r  r  r  
call_tuple	call_listr  r  r  r  r  rD  r  r  r  r  r  r  r  r  r  r  r"  r%  r  rR  rq  rt  r}  r  r  r  r  r  r  rh  rd  r  r  r  r  r  r  r  r  r  r  __classcell__)rA  s   @rf   r   r     s	          I		'N
 ) ) [) _@ @ _ \@D: : : _* * _ \*X _#TfuT#Yf0E%EFF # # # _ \#J _X X _ \Xt 	 	 \	5 5 5     4# 4 4 4 4  " " " " "J J J J1 1 1    3 3 3 
 
 \


 
 

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

- - - -
 
 
 
 04,), , , ,\
 
 
H H H H   6 "J I< < < <:	
 	
 	
: : : :K K K K 
 
 
 \
$ .
#.
 .
 .
 \.
`"
 "
 "
 "
H
 
 
 
4
 
 
 
E E E EH H H Hd6 d6 d6 d6LO O O O(- - - -   2 2 2 2Q Q Q QS S S S
D 
D 
D 
D" ZK ZK#ZK ZK "	ZK ZK ZK ZKx]-#]- ]- "	]-
 ]- ]- ]- ]-~B#B B "	B B B B:3 :/ : : : :02 7 2o 2 2 2 2
#  "	   "   "R R R R
       D	
 	
 	
 	
3
 3
 3
 3
j
 
 
 
69 9 9 9: : : :9 9 9 9: : : :9 9 9 9$: : : :"       D   >   $:):.=:BQ: : : : : : : :rh   r   c              #      K   ddl m} |                    | d          }	 |                    |            d V  |                    |            d S # |                    |            w xY w)Nr8   )GradModeVariableF)r_  r  rF  enterexit)r  r  gmvs      rf   rc  rc  8  sq      """"""

!
!"e
,
,C		"s   A A')rl   
contextlibrq  r  r  loggingr   r   r  rb   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   rI  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   rq  rR   rS   rT   rU   torch._dynamo.codegenrV   torch._dynamo.symbolic_convertrW   	getLoggerri   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   r  _HandlerCallbackr   r?  _TrackersTyper   cmp_eqr   cmp_ner   cmp_ltr   cmp_ler   cmp_gtr   cmp_gerR  r   r   r   r   r   r   r   r   r   r   r   r   r   rX   r>  r  rY   r   r   contextmanagerrc  r]   rh   rf   <module>r     s    *                 



    0 0 0 0 0 0 0 0 8 8 8 8 8 8 8 8 8 8 6 6 6 6 6 6 6 6 6 6 6 6  $ $ $ $ $ $ $ $ 6 6 6 6 6 6 1 1 1 1 1 1 F F F F F F > > > > > > > > > > > >	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 1 0 0 0 0 0 0 0 ' ' ' ' ' '                                                    ( Y X X X X X X X X X & & & & & & 6 6 6 6 6 6 6 6                                                          E//////DDDDDDg!! M8<M8<M8<)x'M8<h&hohoM8<M8=L(,M8< " fj&*5F  d?+U43H#3M-NNOK!K!K!K!K!K!  LLOLLKKKKKKLMMMMM-4 MLLMML o
 OO  LLLM
 JL $xS18CH3EEF K K K KM 4c 2HS#X4F FG L L L8E 8E 8Ev^(: ^(: ^(: ^(: ^(:o ^(: ^(: ^(:BQ     rh   