
    %Vji                     N   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mZ ddl	m
Z
mZ ddlmZ ddlmZmZmZ ddlmZmZ dd	lmZmZ dd
lmZmZ ddlmZ ddlmZmZm Z m!Z!m"Z"m#Z#m$Z$ ddl%m&Z&m'Z' ddl(m)Z) erddl*m+Z+ ddl,m-Z- d Z.d+dZ/d Z0 G d de'          Z1 G d de'          Z2 G d de1          Z3 G d de1          Z4 G d de1          Z5 G d d e5          Z6 G d! d"e5          Z7 G d# d$e'          Z8 G d% d&e8          Z9 G d' d(e8          Z: G d) d*e8          Z;dS ),a  
Dictionary-related variable tracking classes for PyTorch Dynamo.

This module implements variable tracking for different types of dictionary-like objects:
- Regular Python dictionaries (dict)
- Ordered dictionaries (collections.OrderedDict)
- Default dictionaries (collections.defaultdict)
- Dictionary views (keys and values)
- Sets and frozensets (implemented internally using dictionaries)

These classes are responsible for tracking dictionary operations during graph compilation,
maintaining proper guards for dictionary mutations and key existence checks. They handle
dictionary creation, modification, key/value access, and view operations while ensuring
correct behavior in the compiled code through appropriate guard installation.

The implementation uses a special _HashableTracker wrapper to handle dictionary keys
while preserving proper aliasing semantics. Sets are implemented as dictionaries with
None values for efficiency and code reuse.
    N)Hashable)OptionalTYPE_CHECKING)is_fake   )graph_break_hints	polyfills	variables)create_call_functioncreate_instruction)raise_observed_exceptionunimplemented_v2)GuardBuilderinstall_guard)is_from_local_source)cmp_name_to_op_mapping
dict_items	dict_keysdict_valuesistyperaise_args_mismatchspecialize_symnode   )ValueMutationNewVariableTrackerConstantVariable)	PyCodegenInstructionTranslatorc                 R    t          |           j                            dd          S )N__instancecheck__F)type__dict__get)objs    W/root/voice-cloning/.venv/lib/python3.11/site-packages/torch/_dynamo/variables/dicts.pywas_instancecheck_overrider(   =   s"    99!!"5u===    c           
          |ddl m}  |j                    }t          t          |t          dt          |                      g           d S )Nr   r   zunhashable type: args)torch._dynamo.symbolic_convertr    
current_txr   	TypeErrorr   r#   )argtxr    s      r'   raise_unhashabler2   A   sm    	zHHHHHH-"-//2-.M$s)).M.MNNO     r)   c                    t          | t          j                  r*|                                 s|                                 rdS t          | t          j                  r3|                                 j        j        	                    d          d uS t          | t          j
                  rt          d | j        D                       S t          | t          j                  r0t          d | j                                        D                       S t          | t          j                  rnt#          | j                  sZt'          j        | j        d          t*          j        u r4t          | j        t*                    rt          | j        t.                    S t          | t          j        t          j        t          j        t          j        t          j        t          j        t          j        t          j        t          j         j!        t          j"        t          j#        t          j$        t          j%        t          j&        t          j'        t          j(        t          j)        f          S )NTexample_valuec              3   4   K   | ]}t          |          V  d S Nis_hashable.0es     r'   	<genexpr>zis_hashable.<locals>.<genexpr>]   s(      33a;q>>333333r)   c              3   4   K   | ]}t          |          V  d S r6   r7   r9   s     r'   r<   zis_hashable.<locals>.<genexpr>_   s(      ==a;q>>======r)   __hash__)*
isinstancer
   LazyVariableTrackeris_realizedr8   TensorVariableas_proxynodemetar%   TupleVariableallitemsFrozenDataClassVariablefieldsvaluesUserDefinedObjectVariabler(   valueinspectgetattr_staticintr>   py_HashableBuiltinVariableSymNodeVariabler   EnumVariableFrozensetVariableUserDefinedClassVariableUserFunctionVariableSkipFunctionVariablemiscNumpyVariableNNModuleVariableUnspecializedNNModuleVariableMethodWrapperVariableTorchInGraphFunctionVariableTypingVariableFunctoolsPartialVariableWeakRefVariable TorchHigherOrderOperatorVariable)xs    r'   r8   r8   K   s    	1i344 MMOO
 t!Y-.. &
 zz|| %))/::$FF	Ay.	/	/ !
3317333333	Ay8	9	9 
==18??+<+<======1i9::
*1733
 "17J773<GGqw$$ H !';///))*&+2..,*7/6(2):#
 
 	
r)   c                   F    e Zd Zej        Zdhej        Z G d d          Ze	fde	eef         ddf fdZ
d Zd	 Zd
 Zd Zd Zd ZdefdZdefdZdefdZd Zd Zd(dZdddefdZdddefdZdefdZdefdZd Zd Z	 	 	 	 	 	 d) fd$Zd% Z d& Z! fd'Z" xZ#S )*ConstDictVariableuser_clsc                   \    e Zd ZdZd
dZed             Zd Zed             Z	dd de
fd	ZdS )"ConstDictVariable._HashableTrackeraB  
        Auxiliary opaque internal class that wraps a VariableTracker and makes it hashable
        This should not be seen or touched by anything outside of ConstDictVariable and its children
        Note that it's also fine to put VTs into dictionaries and sets, but doing so does not take into account aliasing
        returnNc                 n    t          |          }t          |          st          |           || _        d S r6   )r   r8   r2   vt)selfrk   s     r'   __init__z+ConstDictVariable._HashableTracker.__init__   s8    #B''B r?? % $$$DGGGr)   c                 Z   t          | j        t          j                  rK| j                                        s2| j                                        r| j                                        S t          | j        t          j                  r+| j                                        j	        j
        d         }nt          | j        t          j                  r3t          j        t          fd| j        j        D                       }nt          | j        t          j                  r| j        j        S t          | j        t          j                  r| j        j        S t          | j        t          j                  r| j                                        S t          | j        t          j                  r&t          j         | j        j                  j        S t          | j        t          j                  rmt          j        fd| j        j                                        D             }t          j                            | j                                        |          S t          | j        t          j                  r| j        j        S | j                                        }|S )Nr4   c              3   8   K   | ]} |          j         V  d S r6   underlying_value)r:   r;   r   s     r'   r<   zFConstDictVariable._HashableTracker.underlying_value.<locals>.<genexpr>   s.      NN1((1++6NNNNNNr)   c                 8    i | ]\  }}| |          j         S  rp   )r:   kvr   s      r'   
<dictcomp>zGConstDictVariable._HashableTracker.underlying_value.<locals>.<dictcomp>   s7     ! ! !8<1Axx{{3! ! !r)   )r?   rk   r
   r@   rA   r8   original_valuerB   rC   rD   rE   rF   re   _HashableTrackertuplerH   r[   rM   r\   rW   get_functionra   referent_vtrq   rI   rJ   HashWrapperpython_typerL   as_python_constant)rl   rc   fields_valuesr   s      @r'   rq   z3ConstDictVariable._HashableTracker.underlying_value   sF    47I$ABB0++--0 G''))0
 w--///$'9#;<< 1G$$&&+0ADGY%<== 1,=NNNNNNNNNDGY%?@@ 1w}$DGY%LMM 1w}$DGY%CDD 1w++---DGY%>?? 1,=x 344EEDGY%FGG 1,=! ! ! !@D@T@T@V@V! ! ! !8DDG''))=   DGY%HII 1 w}$G..00Hr)   c                 *    t          | j                  S r6   )hashrq   rl   s    r'   r>   z+ConstDictVariable._HashableTracker.__hash__   s    -...r)   c                 N   t          |           t          |          k    rdS t          | t                    rUt          j        t          |           t          |          k    o(t          fdt          | |          D                       S t          |           r| |u S | |k    S )NFc              3   J   K   | ]\  }}                     ||          V  d S r6   )_eq_impl)r:   uru   r   s      r'   r<   z>ConstDictVariable._HashableTracker._eq_impl.<locals>.<genexpr>   sH       0 0041H%%a++0 0 0 0 0 0r)   )	r#   r?   ry   re   rx   lenrG   zipr   )abr   s     @r'   r   z+ConstDictVariable._HashableTracker._eq_impl   s     Aww$q''!!uAu%% ,=1vvQ' C 0 0 0 08;Aq		0 0 0 - -   AvAvr)   otherc                 &   t           j        }t          ||          s+t          j        |          sJ t          |                      t          ||          r |                    | j        |j                  S |                    | j        |          S r6   )re   rx   r?   r   
is_literalr#   r   rq   )rl   r   r   s      r'   __eq__z)ConstDictVariable._HashableTracker.__eq__   s    (9HeX.. 2B2Me2T2T  U T %** X(()>@VWWW $$T%:EBBBr)   ri   N)__name__
__module____qualname____doc__rm   propertyrq   r>   staticmethodr   boolr   rs   r)   r'   rx   rh      s        	 		 	 	 	 
%	 %	 
%	N	/ 	/ 	/ 
	 	 
			C D 		C 		C 		C 		C 		C 		C 		Cr)   rx   rH   ri   Nc                    d|v r|                     d           d|v r|                     d            t                      j        di | t          j        t          fd|                                D                       sJ fd|                     |          } |fd|                                D                       | _        t          | j	                   | _
        |                                | _        || _        d S )Noriginal_itemsshould_reconstruct_allc              3   v   K   | ]3\  }}t          |t          f          ot          |t                    V  4d S r6   )r?   r   )r:   rc   ru   r   s      r'   r<   z-ConstDictVariable.__init__.<locals>.<genexpr>   s^       
 
 1 q?H566 /1o..
 
 
 
 
 
r)   c                 >    t          |           r| n
 |           S r6   )r?   )keyr   s    r'   make_hashablez1ConstDictVariable.__init__.<locals>.make_hashable   s$    $S(33F33#Fr)   c                 .    i | ]\  }} |          |S rs   rs   )r:   rc   ru   r   s      r'   rv   z.ConstDictVariable.__init__.<locals>.<dictcomp>   s)    MMMtq!}}Q//MMMr)   rs   )popsuperrm   re   rx   rG   rH   _get_dict_cls_from_user_clsr   sourcer   copyr   rf   )rl   rH   rf   kwargsdict_clsr   r   	__class__s        @@r'   rm   zConstDictVariable.__init__   sI    v%%JJ'(((#v--JJ/000""6"""$5  
 
 
 
 
 
 
 
 
 	
 	
 
	G 	G 	G 	G 	G 33H==XMMMMu{{}}MMMNN
 +?t{*K*K&K##jjll r)   c                     t           t          j        t          j        f|v r|}n t	          fd|j        D                       }|v s
J |            |t          j        u rt           }|S )Nc              3   $   K   | ]
}|v |V  d S r6   rs   )r:   baseaccepted_dict_typess     r'   r<   z@ConstDictVariable._get_dict_cls_from_user_cls.<locals>.<genexpr>  s7        T=P5P5P5P5P5P5P r)   )dictcollectionsOrderedDictdefaultdictnext__mro__)rl   rf   r   r   s      @r'   r   z-ConstDictVariable._get_dict_cls_from_user_cls   s    #[%<k>UV ***HH     !)!1    H ....... {...Hr)   c                 H    d | j                                          D             S )Nc                 l    i | ]1\  }}|j                                         |                                2S rs   rk   rC   r:   rt   ru   s      r'   rv   z.ConstDictVariable.as_proxy.<locals>.<dictcomp>  s0    MMM$!QMMMr)   rH   r   s    r'   rC   zConstDictVariable.as_proxy  s$    MM$*:J:J:L:LMMMMr)   c                 z    dd                     d | j                                        D                       z   dz   S )N{, c              3   |   K   | ]7\  }}|j                                          d |                                 V  8dS )z: Nrk   
debug_reprr   s      r'   r<   z/ConstDictVariable.debug_repr.<locals>.<genexpr>  sY        =AQ14??$$8888     r)   })joinrH   r   s    r'   r   zConstDictVariable.debug_repr  sT    ii  EIZEUEUEWEW     		
r)   c                 H    d | j                                          D             S )Nc                 l    i | ]1\  }}|j                                         |                                2S rs   rk   r~   r   s      r'   rv   z8ConstDictVariable.as_python_constant.<locals>.<dictcomp>   sH     
 
 
1 D##%%q';';'='=
 
 
r)   r   r   s    r'   r~   z$ConstDictVariable.as_python_constant  s1    
 

((**
 
 
 	
r)   c                 p    |                                   d | j                                        D             S )Nc                 H    i | ]\  }}|j                                         | S rs   r   r   s      r'   rv   z=ConstDictVariable.keys_as_python_constant.<locals>.<dictcomp>'  s,    LLLA''))1LLLr)   )install_dict_keys_match_guardrH   r   s    r'   keys_as_python_constantz)ConstDictVariable.keys_as_python_constant%  s6    **,,,LL9I9I9K9KLLLLr)   c                     | j         S r6   )rf   r   s    r'   r}   zConstDictVariable.python_type)  s
    }r)   c                     t          |t                    sJ t          j        }t	          |          o@ ||          | j        v o.t          | j         ||                   t          j                   S r6   )r?   r   re   rx   r8   rH   r
   DeletedVariable)rl   rk   r   s      r'   __contains__zConstDictVariable.__contains__,  sn    "o.....$5OO T
*Ttz((2,,79RSSS	
r)   c                 b    t          d | j                                        D                       S )Nc              3   L   K   | ]}t          |t          j                   V   d S r6   )r?   r
   r   r:   rc   s     r'   r<   z(ConstDictVariable.len.<locals>.<genexpr>6  sC       
 
=>
1i7888
 
 
 
 
 
r)   )sumrH   rK   r   s    r'   r   zConstDictVariable.len5  s>     
 
BF*BSBSBUBU
 
 
 
 
 	
r)   c                 v      j         p1t           fd j                                        D                       S )Nc              3      K   | ]:\  }}                     j                            |j                  |          V  ;d S r6   )is_new_itemr   r%   rk   )r:   r   rM   rl   s      r'   r<   z2ConstDictVariable.has_new_items.<locals>.<genexpr>;  s^       2
 2
U T044SV<<eDD2
 2
 2
 2
 2
 2
r)   )r   anyrH   r   s   `r'   has_new_itemszConstDictVariable.has_new_items:  sS    * 
c 2
 2
 2
 2
"j..002
 2
 2
 /
 /
 	
r)   c                    |rl|                                 rX|                                 rDt          |                                          t          |                                          k    S t          |          t          |          k    S r6   )rA   idrealize)rl   rM   r   s      r'   r   zConstDictVariable.is_new_item@  sr     	>U&&(( 	>U->->-@-@ 	>emmoo&&"U]]__*=*===%yyBuII%%r)   c                 H   d}| j                                          D ]a\  }}| j                            |j                  }|                     ||          s| j        r  ||j                    ||           |dz  }b|                    t          d|                     d S )Nr   r   	BUILD_MAPr0   )rH   r   r%   rk   r   r   append_outputr   )rl   codegennum_argsr   rM   items         r'   reconstruct_kvs_into_new_dictz/ConstDictVariable.reconstruct_kvs_into_new_dictF  s    ***,, 	 	JC&**3622De,, 0K A0(KKKLLLLLr)   r   r   c                     | j         t          j        u rR                    fd           |                                                    t          dd                     d S |                                d S )Nc                                                                 t                                         d          g          S )Nr   extend_outputcreate_load_python_moduler   create_load_attrr   s   r'   <lambda>z/ConstDictVariable.reconstruct.<locals>.<lambda>V  s>    --99+FF00??  r)   r   F)rf   r   r   add_push_nullr   r   r   rl   r   s    `r'   reconstructzConstDictVariable.reconstructR  s    =K333!!      ..w777!!"6q%"@"@AAAAA..w77777r)   r1   r    r0   c                     t                               |          }|| j        vrt          t          |           | j        |         S r6   )re   rx   rH   r   KeyError)rl   r1   r0   r   s       r'   'getitem_const_raise_exception_if_absentz9ConstDictVariable.getitem_const_raise_exception_if_absentb  s@      0055dj  $Xr222z#r)   c                     t                               |          }|| j        vr3d|j         d}t	          dd|j         |dgt
          j                   | j        |         S )NzDictionary key z not found during tracingzkey not found in dictzKey z>Check if the key exists in the dictionary before accessing it.gb_typecontextexplanationhints)re   rx   rH   rM   r   r   
USER_ERROR)rl   r1   r0   r   msgs        r'   getitem_constzConstDictVariable.getitem_constj  s    0055dj  HCIHHHC/*sy**T&1	    z#r)   c                 f    t                               |          }|| j        vrd S | j        |         S r6   )re   rx   rH   )rl   r0   r   s      r'   maybe_getitem_constz%ConstDictVariable.maybe_getitem_consty  s3    0055dj  4z#r)   c                 p   || v sJ t                               |          }t          | j                                                                      |          }t          | j                                                  |         }t          |t          j	                  r|
                                 d S d S r6   )re   rx   ry   rH   keysindexr   r?   r
   r@   r   )rl   r0   r   r   original_key_vts        r'   realize_key_vtz ConstDictVariable.realize_key_vt  s    d{{{{0055djoo''((..s33 3 8 8 : :;;EBoy'DEE 	&##%%%%%	& 	&r)   c                 p    | j         r.t          |                     t          j                             d S d S r6   )r   r   
make_guardr   DICT_KEYS_MATCHr   s    r'   r   z/ConstDictVariable.install_dict_keys_match_guard  s<    ; 	I$//,*FGGHHHHH	I 	Ir)   c           	         ddl m} | j        sd S |j        j                            |           rd S |d         | v }|d         j        mt          |d         |          rWt          |                     t          j
        t          |           j        |d         j        |                                d S |d         j        r5|r|                     |d                    d S |                                  d S d S )Nr   r   r   )r   invert) r   r   outputside_effectsis_modifiedr?   r   r   	functoolspartialr#   CONTAINS_GUARDrM   r   r   )rl   r1   r,   r   containss        r'   install_dict_contains_guardz-ConstDictVariable.install_dict_contains_guard  s&    	'&&&&&{ 	F9!--d33 	F7d?7>!ja:J&K&K!%T

1 GM#+|        !W^ 	5 5##DG,,,,,2244444		5 	5r)   r,   list[VariableTracker]r   dict[str, VariableTracker]r   c                 P   ddl m}m t          j        |ot          |d                   }|dk    rv t          j        t                    j        |g|R i |}|j	        j
                            |            | j                            |j                    j        d           S |dk    r?t          |          dk    rt!          ||           |                     ||d                   S |dk    rb|s|rt!          ||           |                                  | j        r$|j	        j                            | j                   t-          |           S |dk    rmt          |          rt!          ||           |                                  | j        r$|j	        j                            | j                   t/          |           S |dk    r{|s|rt!          ||           |                                  | j        r$|j	        j                            | j                   |s|rt1          t2          |           t5          |           S |d	k    rc|                                  |s|rt!          ||           |                     | j                                        t;                      d 
          S |dk    rJ|s|rt!          ||           |                                   j        t          | j                            S |dk    r|                                 r|st?          |d                    |                                  |st          |          dk    sJ |j	        j
                            |            |d         | j         |d                   <    j        d           S |dk    r|r|                                 rs|                                  d| _         |j	        j
                            |            | j        !                     |d                               j        d           S |dk    rt          |          dvrt!          ||           |st?          |d                    |d         | vrA| "                    ||           t          |          dk    r j        d           S |d         S | #                    ||d                   S |dk    r|                                 rt          |          dvrt!          ||           |st?          |d                    |d         | vrF| "                    ||           t          |          dk    rt1          tH          |           |d         S d| _         |j	        j
                            |            | j        %                     |d                             S |dk    r|                                 rtM          | j'        t                    r>tM          | j'        tP          j)                  st          |          rt!          ||           | j        s( j        d          }t1          tH          ||g           | j'        tP          j)        u rt          |          dk    sd|v rt          |          dk    r$tU          |d                   r|d         j+        }	n?|,                    d          x}
rtU          |
          r|
j+        }	nt!          ||           | j        -                    |	          \  }}
n| j        -                                \  }}
d| _         |j	        j
                            |            t          j.        |j/        |
g          S |dk    rc|s|rt!          ||           d| _         |j	        j
                            |            | j        0                                  j        d           S |dk    rd|                                 rO|                                  t          |          dk    }t          |          dk    }|s|r|j	        j
                            |            |rtU          |d         t                    r#|d                                          |d         }n"|1                    |t          |d                   }| j                            |j                   |r;fd|                                D             }| j                            |            j        d           S te                      3                    ||||          S |dk    rft          |          st!          ||           |st?          |d                    | "                    ||           |d         | v } j        |          S |dk    r|                                 rt          |          dvrt!          ||           |st?          |d                    |                                  |rJ t          |          dk    sJ | 4                    |d                   }||S t          |          dk    r j        d           }n|d         }|j	        j
                            |            || j         |d                   <   |S |dk    r|                                  |j	        j
                            |            |d         | vrt1          tH          |           d}	t          |          dk    r#tU          |d                   r|d         j+        }	|r4d|v r0tU          |d                   r|,                    d          j+        }	 |d                   }| j        5                    ||	            j        d           S |dk    rstm          | t                    r^t          |          dk    rt!          ||           t          j7        tp          j9                  :                    || |d         gi           S |dk    r, j        | 3                    |d||          j+                   S |d k    rXt          |          dk    sJ |d         }tm          |t          t          j;        f          sOd!| <                                j=         d"|<                                j=         d#}t1          t2          ||g           | j'        |j'        h}t}          d$ |D                       rtP          j)        nt          }|                                  |                     | j                                        t;                      d |%          }|d                                          |j                            |d         j                   |S |d&k    r| 3                    |d||           | S te                      3                    ||||          S )'Nr   )rR   r   r   rm   __getitem__rH   r   rK   r   )rH   mutation_typer   __len____setitem__r   __delitem__Tr%   )r   r   r   popitemzpopitem(): dictionary is emptyr+   last)r  clearupdatec                 J    i | ]\  }}  j         |                    | S rs   )create)r:   rt   ru   r   r   s      r'   rv   z1ConstDictVariable.call_method.<locals>.<dictcomp>]  sH        Aq !!8!1!8!;!;<<a  r)   r   
setdefaultmove_to_endr   __ne____or__z$unsupported operand type(s) for |: 'z'and ''c              3   J   K   | ]}t          |t          j                  V  d S r6   )
issubclassr   r   )r:   ts     r'   r<   z0ConstDictVariable.call_method.<locals>.<genexpr>  s/      JJ!z![%<==JJJJJJr)   )rH   r  r   rf   __ior__)?r   rR   r   re   rx   r8   r
   r   	call_dictr  r  mutationrH   r  r  r   r   r   r   r   guard_on_key_orderaddDictItemsVariableDictKeysVariabler   r/   DictValuesVariablecloner   r   
is_mutabler2   r   r  r  r   r   r   r  rf   r   r   r?   rM   r%   r  rF   rk   r  call_custom_dictr   call_methodr   r  r   rW   r	   dict___eq__call_functionUserDefinedDictVariabler}   r   r   )rl   r1   namer,   r   rR   arg_hashabletemp_dict_vtr   r  ru   rt   has_arg
has_kwargsdict_vtr  rM   rc   r   r   tsrf   new_dict_vtr   r   r   s                          @@r'   r*  zConstDictVariable.call_method  s    	87777777$54DG 4 4:D94T::D  # L I"++D111Jl0111*#*4000]""4yyA~~#B---??DGLLLW__ .v .#B---..000{ >	,00===$T***V^^4yy .#B---..000{ >	,00===#D)))X .v .#B---..000{ >	,00=== 8v 8(B777%d+++V^^..000 .v .#B---::joo''7G7I7IRV     Y .v .#B---..000*#*3tz??;;;]""t'8'8" * a)))..0000#d))q...0I"++D111,0GDJxxQ(()*#*4000]""|"8I8I"..000*.D'I"++D111J""88DG#4#4555*#*4000U]]4yy&&#B--- * a)))Awd""00T:::t99>>2+24888Aw%%b$q'222U]]t00]4yy&&#B--- * a)))Awd""00T:::t99>>,Xr:::Aw*.D'I"++D111:>>((47"3"3444Y4??#4#44=$//."4=+2IJJ. II.
 $B---: C-&-.NOO(2SEBBBB} 777D		Q&F"2"2t99>>ja:J&K&K>7=DD!::f---a 2:aAQ3R3R 27DD'D111z))t)4411z))++1*.D'I"++D111*AD!9555W__ .v .#B---*.D'I"++D111J*#*4000X$//"3"3 ..000$ii1nGVqJ C* C	&//555 5!$q'+<== V Q==???"&q'"1"B"B2tTRSW"U"UJ%%gm444 .    $*LLNN  F J%%f---.'.t444ww**2tT6BBB^##t99 .#B--- * a))),,R666Aw$H*#*8444\!!doo&7&7!4yy&&#B--- * a)))..000:t99>>>>,,T!W55E t99>>/(/55AAQA	&//55501
88DG,,-]""..000I"++D111Awd""(2666D4yyA~~*T!W6F"G"G~Aw} 0f$$vf~/?@@ % zz&))/(47##CJ""3T"222*#*4000X&##
 #
 4yyA~~#B---1)2GHHVVT47OR   X*#*$$R4@@FF   Xt99>>>>GE& )9+LM  D<4;K;K;M;M;V < <!--//8< < <  )BcUCCCC -0B JJrJJJJJ''  ..000**joo''.00!	 %  K G11333$$T!W]333YR4888K77&&r4v>>>r)   c                 p    |                                   d | j                                        D             S )Nc                     g | ]	}|j         
S rs   rk   r   s     r'   
<listcomp>z9ConstDictVariable.unpack_var_sequence.<locals>.<listcomp>  s    000000r)   )r   rH   r   rl   r1   s     r'   unpack_var_sequencez%ConstDictVariable.unpack_var_sequence  s4    **,,,00djoo//0000r)   c                     | j         t          u r6|| j         j        v rt          j        d          S t          j        d          S d| j          d}t          dd| j          |dgt          j                   d S )	NTFzhasattr on z is not supportedzunsupported hasattr operationzClass z+Consider using a regular dictionary insteadr   )rf   r   r$   r   r  r   r   SUPPORTABLE)rl   r1   r.  r   s       r'   call_obj_hasattrz"ConstDictVariable.call_obj_hasattr  s     =D  t}---'.t444#*5111<DM<<<3,T],,=".		
 	
 	
 	
 	
 	
r)   c                 ^    |                                    t                      j        di |S Nrs   )r   r   r'  )rl   r   r   s     r'   r'  zConstDictVariable.clone  s1    **,,,uww}&&v&&&r)   r   r   r,   r	  r   r
  ri   r   )$r   r   r   r   DICT_CONTAINSr  r   _nonvar_fieldsrx   r   rm   r   rC   r   r~   r   r}   r   r   rP   r   r   r   r   r   r   r   r   r   r   r  r*  r;  r>  r'  __classcell__r   s   @r'   re   re      s       !/N 			'N
SC SC SC SC SC SC SC SCp !! !!O_45!!
 
!! !! !! !! !! !!F  &N N N
 
 

 
 
M M M  
$ 
 
 
 

S 
 
 
 


t 
 
 
 
& & &
M 
M 
M8 8 8 8 )0?    7 o        &/ & & & &I I I%5 %5 %5Ni? &	i?
 -i? 
i? i? i? i? i? i?V	1 1 1
 
 
&' ' ' ' ' ' ' ' 'r)   re   c                   l     e Zd Zdeddf fdZd Zd Zdd	Zd
ed         de	e
df         ddfdZ xZS )MappingProxyVariabledv_dictri   Nc                 v     t                      j        di | t          |t                    sJ || _        d S r@  )r   rm   r?   re   rI  rl   rI  r   r   s      r'   rm   zMappingProxyVariable.__init__  sB    ""6"""'#455555r)   c                     t           j        S r6   )typesMappingProxyTyper   s    r'   r}   z MappingProxyVariable.python_type  s    %%r)   c                 6    | j                             |          S r6   )rI  r;  r:  s     r'   r;  z(MappingProxyVariable.unpack_var_sequence  s    |//333r)   r   r   c                    | j         r3d| j          d}t          dd| j          |dgt          j                                       fd            | j                                       t          dd	                     d S )
Nz*Preexisting MappingProxyVariable (source: zS) cannot be reconstructed because the connection to the original dict will be lost.z%mapping proxy cannot be reconstructedSource: zCUse a mapping proxy constructed in the same `torch.compile` region.r   c                                                                 t                                         d          g          S )NrN  )r   r   rM  r   r   s   r'   r   z2MappingProxyVariable.reconstruct.<locals>.<lambda>  s?    G))55e<<,,-?@@  r)   r   F)r   r   r   r=  r   rI  r   r   )rl   r   r   s    ` r'   r   z MappingProxyVariable.reconstruct  s    ; 	LT[ L L L  ?04;00Y&2	    	   	
 	
 	
 	21e<<=====r)   r,   r   r   c                     | j         r>|j        j                                        r d}t	          dd| j          d|ddg           | j                            ||||          S )Na  A dict has been modified while we have an existing mappingproxy object. A mapping proxy object, as the name suggest, proxies a mapping object (usually a dict). If the original dict object mutates, it is reflected in the proxy object as well. For an existing proxy object, we do not know the original dict it points to. Therefore, for correctness we graph break when there is dict mutation and we are trying to access a proxy object.z-mapping proxy affected by dictionary mutationrQ  z, Dict mutation detectedzNAvoid modifying dictionaries that might be referenced by mapping proxy objectszROr avoid using the mapping proxy objects after modifying its underlying dictionaryr   )r   r  r  has_existing_dict_mutationr   rI  r*  )rl   r1   r.  r,   r   r   s         r'   r*  z MappingProxyVariable.call_method"  s     ; 	291LLNN 	7  GH4;HHHdh	    |''D$???r)   rA  )r   r   r   re   rm   r}   r;  r   listr   strr*  rE  rF  s   @r'   rH  rH    s         1       
& & &4 4 4> > > >6@ $%	@
 S++,@ 
@ @ @ @ @ @ @ @r)   rH  c                       e Zd Zd Zd ZdS )NNModuleHooksDictVariablec                     d S r6   rs   r   s    r'   r   z7NNModuleHooksDictVariable.install_dict_keys_match_guardB      r)   c                     d S r6   rs   rl   r1   r,   s      r'   r  z5NNModuleHooksDictVariable.install_dict_contains_guardE  rZ  r)   N)r   r   r   r   r  rs   r)   r'   rX  rX  @  s2              r)   rX  c                   j     e Zd Zdd fdZ fdZ fdZed             Z	 	 	 	 	 	 d fdZd Z	 xZ
S )DefaultDictVariableNri   c                 l     t                      j        ||fi | |t          j        u sJ || _        d S r6   )r   rm   r   r   default_factory)rl   rH   rf   r`  r   r   s        r'   rm   zDefaultDictVariable.__init__J  sF    33F333;22222.r)   c                     | j         t          t          t          fvr	| j        sdS t                                                      S )NF)r`  rU  ry   r   rH   r   is_python_constantrl   r   s    r'   rb  z&DefaultDictVariable.is_python_constantO  s<     eT':::4::5ww))+++r)   c                     d| j                                          dt                                                       dS )Nzdefaultdict(r   ))r`  r   r   rc  s    r'   r   zDefaultDictVariable.debug_reprV  s=    W4/::<<WW@R@R@T@TWWW	
r)   c                     t          | t          j                  r!| j        t          t
          t          t          fv S t          | t          j        j	                  S r6   )
r?   r
   rR   fnrU  ry   r   set	functionsBaseUserFunctionVariabler   s    r'   is_supported_argz$DefaultDictVariable.is_supported_arg[  sD    c9455 	Q6dE4555c9#6#OPPPr)   r,   r	  r   r
  r   c                    |dk    rt          |          dk    sJ |d         | v r|                     ||d                   S | j        t          |d                    | j                            |g i           }t                                          |d|d         |f|           |S t                                          ||||          S )Nr  r   r   r  )r   r   r`  r   r,  r   r*  )rl   r1   r.  r,   r   default_varr   s         r'   r*  zDefaultDictVariable.call_methodb  s     =  t99>>>>Aw$))"d1g666'/"d1g<000"&"6"D"DRR"P"PKGG''MDG[+A6   '&77&&r4v>>>r)   c                                          fd            | j                   |                                                    t	          dd                     d S )Nc                                                                 t                                         d          g          S )Nr   r   r   s   r'   r   z1DefaultDictVariable.reconstruct.<locals>.<lambda>}  s>    G))55kBB,,];;  r)   r   F)r   r`  r   r   r   r   s    `r'   r   zDefaultDictVariable.reconstructz  s}       	
 	
 	
 	$%%%**733321e<<=====r)   r6   r   rB  )r   r   r   rm   rb  r   r   rk  r*  r   rE  rF  s   @r'   r^  r^  I  s        / / / / / / /
, , , , ,
 
 
 
 

 Q Q \Q? &	?
 -? 
? ? ? ? ? ?0> > > > > > >r)   r^  c                        e Zd ZdZej        Zdee         ddf fdZ	d Z
ed             Zed             Zd	 Zd
 Zd ZddZd Zdee         deeef         ddf fdZdddefdZd Z fdZ xZS )SetVariablez.We model a sets as dictionary with None valuesrH   ri   Nc                     t                               |t                                                    } t	                      j        |fi | d S r6   )r   fromkeysrq  _default_valuer   rm   rl   rH   r   r   s      r'   rm   zSetVariable.__init__  sI    
 e[%?%?%A%ABB))&)))))r)   c                     | j         sdS dd                    d | j                                         D                       z   dz   S )Nzset()r   ,c              3   H   K   | ]}|j                                         V  d S r6   r   r:   rt   s     r'   r<   z)SetVariable.debug_repr.<locals>.<genexpr>  .      !O!O!$//"3"3!O!O!O!O!O!Or)   r   rH   r   r   r   s    r'   r   zSetVariable.debug_repr  sJ    z 	V7!O!OTZ__=N=N!O!O!OOOORUUUr)   c                 N    t          | j                                                  S r6   )rh  rH   r   r   s    r'   	set_itemszSetVariable.set_items  s    4:??$$%%%r)   c                  *    t          j        d           S r6   )r   r  rs   r)   r'   rt  zSetVariable._default_value  s      &t,,,r)   c                 $    d | j         D             S )Nc                 @    h | ]}|j                                         S rs   r   ry  s     r'   	<setcomp>z'SetVariable.as_proxy.<locals>.<setcomp>  s"    888A888r)   r}  r   s    r'   rC   zSetVariable.as_proxy  s    888888r)   c                     t           S r6   )rh  r   s    r'   r}   zSetVariable.python_type  s    
r)   c                 $    d | j         D             S )Nc                 @    h | ]}|j                                         S rs   r   ry  s     r'   r  z1SetVariable.as_python_constant.<locals>.<setcomp>  s&    BBBa''))BBBr)   r  r   s    r'   r~   zSetVariable.as_python_constant  s    BB4>BBBBr)   r   r   c                     |                     d | j        D                        |                    t          dt	          | j                                       d S )Nc                     g | ]	}|j         
S rs   r8  r   s     r'   r9  z+SetVariable.reconstruct.<locals>.<listcomp>      666!666r)   	BUILD_SETr   )foreachr}  r   r   r   r   s     r'   r   zSetVariable.reconstruct  sW    66t~6667770#dnBUBUVVVWWWWWr)   c                 R   	  |d | g|D             i d |                                 D             }n`# t          $ rS}t          t          |          |t	          t          t          j        |j                                       Y d }~nd }~ww xY wt          j
        ||          S )Nc                 6    g | ]}|                                 S rs   r~   r   s     r'   r9  z0SetVariable._fast_set_method.<locals>.<listcomp>  s$    @@@Q!&&((@@@r)   c                 >    i | ]\  }}||                                 S rs   r  r   s      r'   rv   z0SetVariable._fast_set_method.<locals>.<dictcomp>  s*    HHHA1a**,,HHHr)   r+   )rH   	Exceptionr   r#   rU  mapr   r  r,   r   build)rl   r1   rg  r,   r   resexcs          r'   _fast_set_methodzSetVariable._fast_set_method  s    	"@@4-$-@@@HHHHH CC  	 	 	$S		2D-=-Dch)O)O$P$P        	 $R---s   14 
BA	BBr,   r   r   c                    ddl m} |dv ra |||          rU|                                 t          u r:|                                 }|                     |t          ||          ||          S |dk    r t          j        t                    j        |g||R  }|j	        j
                            |            | j                                         | j                            |j                   t          j        d           S |dk    rL|rJ t#          |          dk    rt%          ||           d}|d         t&                                          f}n|d	k    r|rJ |rJ 	 | j                                        j        }nX# t0          $ rK}	t3          t0          |t5          t7          t          j        |	j                            
           Y d }	~	nd }	~	ww xY wt;                                          |||f|           |S |dk    rbt#          |          dk    rt%          ||           |rJ t          j        t@          j!                  "                    || |d         gi           S |dk    r:|rJ t          j        t@          j#                  "                    || g|i           S |dk    r:|rJ t          j        t@          j$                  "                    || g|i           S |dk    r:|rJ t          j        t@          j%                  "                    || g|i           S |dk    r:|rJ t          j        t@          j&                  "                    || g|i           S |dk    r:|rJ t          j        t@          j'                  "                    || g|i           S |dk    r]t#          |          dk    rt%          ||           |rJ t          j        t@          j(                  "                    || g|i           S |dk    r]t#          |          dk    rt%          ||           |rJ t          j        t@          j)                  "                    || g|i           S |dk    rN| *                                r:|rJ t          j        t@          j+                  "                    || g|i           S |dk    r^|rJ t#          |          dk    sJ |d         | vrt3          t0          ||
           t;                                          |d	||          S |dk    r\|rJ t#          |          dk    sJ |d         | v r$t;                                          |d	||          S t          j        d           S |dv rt#          |          dk    rt%          ||           tX          j-        tX          j.        d}
|d         /                                }ta          |t&                    s/t          j        t                    "                    ||gi           }t          j        |
1                    |                    "                    || |gi           S |dv rddddd1                    |          }te          |d         t&          t          j3        f          s`t          j        d| d| 4                                 d|d         4                                 d          }t3          tj          ||g
           |                     ||||          S |dv rte          |d         t&          t          j3        f          s`t          j        d| d| 4                                 d|d         4                                 d          }t3          tj          ||g
           ddddd1                    |          }|                     ||||           | S |dk    r}te          |d         t&          t          j3        f          st          j        d          S |                     |d||          }t          j        t#          |j                  dk              S |tl          v rxte          |d         t&          t          j3        f          st          j        tn                    S t          j        tm          |         | j        |d         j                            S t;                                          ||||          S ) Nr   )check_constant_args)
isdisjointunionintersection
differencesymmetric_differencerm   r#  r   r  r   r   r+   r  r  intersection_updater  r  difference_updater  symmetric_difference_updater  removediscard)rM   )issubset
issuperset)__and__r  __xor____sub__z unsupported operand type(s) for z: 'z' and 'r  )__iand__r  __ixor____isub__r   F)8utilsr  r}   rh  r  getattrr
   rR   call_setr  r  r!  rH   r  r  r   r  r   r   rq  rt  r}  r   rk   r   r   rU  r  r,   r   r*  rW   r	   set_isdisjointr,  set_intersectionset_intersection_update	set_unionset_differenceset_difference_updateset_symmetric_differenceset_symmetric_difference_updater(  
set_updateoperatorleger   r   r%   r?   UserDefinedSetVariablepython_type_namer/   r   NotImplemented)rl   r1   r.  r,   r   r  py_typetemp_set_vtresultr;   opr   mr   rr   s                  r'   r*  zSetVariable.call_method  s	    	0/////   $#D&11   ""c))&&((G((WWd-C-CT6RRR:A)3C88A"UtUfUUUKI"++D111JJk/000#*4000U]]:4yyA~~#B--- DG[7799:DDU]]:OO8++--0   (btC0@0G,P,P'Q'Q         GGD6)V<<<M\!!4yyA~~#B---:1( mBtAw445 ^##:1* mBr223 ***:11 mBr223 W__:1)2EFFTTTMDM2   \!!:1( mBr223 (((:1/ mBr223 +++4yyA~~#B---:12 mBr223 2224yyA~~#B---:19 mBr223 X$//"3"3:1)2FGGUUTMDM2   X:t99>>>>Awd""(2DAAAA77&&r5$???Y:t99>>>>Aw$ww**2udFCCC'.T::::///4yyA~~#B--- %K&k B GOO%%E%-- V!1#66DDR%RTUU,RVVD\\::HHT5M2   @@@)!1'	 
 c$ii  d1gY5U'VWW D&-}t}}@U@U@W@W}}`def`g`x`x`z`z}}}  )BcUCCCC##B4888DDDd1gY5U'VWW D&-}t}}@U@U@W@W}}`def`g`x`x`z`z}}}  )BcUCCCC1#9/	 
 c$ii  RD&111KXd1gY5U'VWW 6'.u555  %;T6JJA#*3q{+;+;q+@AAA+++d1gY5U'VWW ?'.~>>>#*&t,T^T!W=NOO   ww""2tT6:::s   &F 
GAGGr1   r    r0   c                      t          d          )NzIllegal to getitem on a set)RuntimeError)rl   r1   r0   s      r'   r   zSetVariable.getitem_consth  s    8999r)   c                     d S r6   rs   r   s    r'   r   z)SetVariable.install_dict_keys_match_guardk      r)   c                 L    t                                          ||           d S r6   )r   r  )rl   r1   r,   r   s      r'   r  z'SetVariable.install_dict_contains_guardo  s#    ++B55555r)   rA  )r   r   r   r   r   SET_CONTAINSr  rU  r   rm   r   r   r}  r   rt  rC   r}   r~   r   r  r   rV  r*  r   r   r  rE  rF  s   @r'   rq  rq    s       88!.N*O$* 
	* * * * * *V V V & & X& - - \-9 9 9  C C CX X X X
. 
. 
.e; ?#	e;
 S/)*e; 
e; e; e; e; e; e;N: 7 :o : : : :  6 6 6 6 6 6 6 6 6r)   rq  c                        e Zd Zdee         ddf fdZd Zed             Zd Z	d Z
ddZdee         deeef         ddf fdZ xZS )rU   rH   ri   Nc                 <     t                      j        |fi | d S r6   r   rm   ru  s      r'   rm   zFrozensetVariable.__init__t  *    
 	))&)))))r)   c                     | j         sdS dd                    d | j                                         D                       z   dz   S )Nzfrozenset()r   rw  c              3   H   K   | ]}|j                                         V  d S r6   r   ry  s     r'   r<   z/FrozensetVariable.debug_repr.<locals>.<genexpr>  rz  r)   r   r{  r   s    r'   r   zFrozensetVariable.debug_repr{  sJ    z 	V =!O!OTZ__=N=N!O!O!OOOORUUUr)   c                 4    | j                                         S r6   )rH   r   r   s    r'   r}  zFrozensetVariable.set_items  s    z   r)   c                     t           S r6   )	frozensetr   s    r'   r}   zFrozensetVariable.python_type      r)   c                 >    t          d | j        D                       S )Nc                 @    h | ]}|j                                         S rs   r   ry  s     r'   r  z7FrozensetVariable.as_python_constant.<locals>.<setcomp>  s&    LLL!$1133LLLr)   )r  r}  r   s    r'   r~   z$FrozensetVariable.as_python_constant  s!    LLT^LLLMMMr)   r   r   c                                          d | j        D                                            fd                               t	          dd                     d S )Nc                     g | ]	}|j         
S rs   r8  r   s     r'   r9  z1FrozensetVariable.reconstruct.<locals>.<listcomp>  r  r)   c                  V                                               d          g          S )Nr  )r   create_load_globalr   s   r'   r   z/FrozensetVariable.reconstruct.<locals>.<lambda>  s-    G))..{;;  r)   r   F)r  r}  r   r   r   r   s    `r'   r   zFrozensetVariable.reconstruct  sy    66t~666777   	
 	
 	
 	21e<<=====r)   r,   r   r   c                 &   |dv rt          d| d          |dk    rt          j        d           S |dv r8t                                          ||||          }t          |j                  S t                                          ||||          S )Nr#  r   r  r  r  r  Illegal call_method z on a frozensetrm   )r   r  r  r  )r  r   r  r   r*  rU   rH   )rl   r1   r.  r,   r   r  r   s         r'   r*  zFrozensetVariable.call_method  s     IIIKdKKKLLLZ $*4000 
 
 
 ##BdF;;A$QW---ww""2tT6:::r)   rA  )r   r   r   rU  r   rm   r   r   r}  r}   r~   r   r   rV  r*  rE  rF  s   @r'   rU   rU   s  s       *O$* 
	* * * * * *V V V ! ! X!  N N N	> 	> 	> 	>; ?#	;
 S/)*; 
; ; ; ; ; ; ; ; ; ;r)   rU   c                        e Zd Zdee         ddf fdZd Zd Zd Ze	d             Z
d	 Zd
 Zdee         deeef         ddf fdZ xZS )DictKeySetVariablerH   ri   Nc                 <     t                      j        |fi | d S r6   r  ru  s      r'   rm   zDictKeySetVariable.__init__  r  r)   c                     | j         sdS dd                    d | j                                         D                       z   dz   S )Nzdict_keys([])zdict_keys([rw  c              3   H   K   | ]}|j                                         V  d S r6   r   ry  s     r'   r<   z0DictKeySetVariable.debug_repr.<locals>.<genexpr>  s.      HH14??,,HHHHHHr)   z])r{  r   s    r'   r   zDictKeySetVariable.debug_repr  sS    z 	"? ((HHdjoo6G6GHHHHHIr)   c                     d S r6   rs   r   s    r'   r   z0DictKeySetVariable.install_dict_keys_match_guard  r  r)   c                     d S r6   rs   r\  s      r'   r  z.DictKeySetVariable.install_dict_contains_guard  r  r)   c                     | j         S r6   r   r   s    r'   r}  zDictKeySetVariable.set_items  s
    zr)   c                     t           S r6   r   r   s    r'   r}   zDictKeySetVariable.python_type  r  r)   c                 z    t                               d | j        D             d                                           S )Nc                 @    h | ]}|j                                         S rs   r   ry  s     r'   r  z8DictKeySetVariable.as_python_constant.<locals>.<setcomp>  s&    ???1QT$$&&???r)   )r   rs  r}  r   r   s    r'   r~   z%DictKeySetVariable.as_python_constant  s6    }}?????
 

$&&	r)   r,   r   r   c                 z    |dv rt          d| d          t                                          ||||          S )Nr  r  z on a dict_keys)r  r   r*  rl   r1   r.  r,   r   r   s        r'   r*  zDictKeySetVariable.call_method  sI     IIIKdKKKLLLww""2tT6:::r)   )r   r   r   rU  r   rm   r   r   r  r   r}  r}   r~   r   rV  r*  rE  rF  s   @r'   r  r    s       *O$* 
	* * * * * *         X    
	; ?#		;
 S/)*	; 
	; 	; 	; 	; 	; 	; 	; 	; 	; 	;r)   r  c                        e Zd ZU dZdZee         ed<   deddf fdZ	e
d             Ze
d             Zd	 ZddZd Zded         deedf         ddf fdZ xZS )DictViewVariablezu
    Models _PyDictViewObject

    This is an "abstract" class. Subclasses will override kv and the items method
    NkvrI  ri   c                      t                      j        di | | j        dv sJ t          |t                    sJ || _        d S )N)r   rK   rH   rs   )r   rm   r  r?   re   rI  rK  s      r'   rm   zDictViewVariable.__init__  sV    ""6"""w55555'#455555r)   c                 P     t          | j        j        | j                              S r6   )r  rI  rH   r  r   s    r'   
view_itemszDictViewVariable.view_items  s!    3wt|)4733555r)   c                     t           r6   )NotImplementedErrorr   s    r'   view_items_vtzDictViewVariable.view_items_vt  s
     "!r)   c                     | j         S r6   )r  r:  s     r'   r;  z$DictViewVariable.unpack_var_sequence  s    !!r)   r   r   c                      || j                    |                    | j                   |                    d           d S )Nr   )rI  load_methodr  r*  r   s     r'   r   zDictViewVariable.reconstruct  sD    DG$$$Ar)   c                     ||                                  j        v rt          j        d          S t          j        d          S )NTF)r}   r$   r   r  )rl   r1   r.  s      r'   r>  z!DictViewVariable.call_obj_hasattr  s>    4##%%...#*4000&u---r)   r,   r   r   c                     |dk    r| j                             ||||          S t                                          ||||          S )Nr  )rI  r*  r   r  s        r'   r*  zDictViewVariable.call_method  sJ     9<++BdFCCCww""2tT6:::r)   rA  )r   r   r   r   r  r   rV  __annotations__re   rm   r   r  r  r;  r   r>  rU  r   r*  rE  rF  s   @r'   r  r    s#          B 1        6 6 X6 " " X"
" " "   
. . .
	; $%		;
 S++,	; 
	; 	; 	; 	; 	; 	; 	; 	; 	; 	;r)   r  c                   ~     e Zd ZdZed             Zed             Zd Zded         de	e
df         ddf fd	Z xZS )
r%  r   c                 *    t          | j                  S r6   )rh  r  r   s    r'   r}  zDictKeysVariable.set_items  s    4?###r)   c                 $    d | j         D             S )Nc                     g | ]	}|j         
S rs   r8  r   s     r'   r9  z2DictKeysVariable.view_items_vt.<locals>.<listcomp>!  s    ......r)   r  r   s    r'   r  zDictKeysVariable.view_items_vt  s     /.do....r)   c                     t           S r6   r  r   s    r'   r}   zDictKeysVariable.python_type#  r  r)   r,   r   r   ri   c                    |dk    r| j                             ||||          S |dv r:t          | j        |          } ||d         j                  }t	          |          S |t
          v rst          |d         t          t          f          st          j	        t                    S t          j	        t          |         | j        |d         j                            S t                                          ||||          S )Nr   )r  r  r  r  r  r  r  r  r   )rI  r*  r  r}  rq  r   r?   r%  r   r  r  r   )rl   r1   r.  r,   r   r  r  r   s          r'   r*  zDictKeysVariable.call_method&  s     >!!<++BdFCCC 	
 	
 	
 --A$q'#$$Aq>>!)))d1g5E'FGG ?'.~>>>#*&t,T^T!W=NOO   ww""2tT6:::r)   )r   r   r   r  r   r}  r  r}   rU  r   rV  r*  rE  rF  s   @r'   r%  r%    s        	B$ $ X$ / / X/  ; $%	;
 S++,; 
; ; ; ; ; ; ; ; ; ;r)   r%  c                   .    e Zd ZdZed             Zd ZdS )r&  rK   c                 *    t          | j                  S r6   )rU  r  r   s    r'   r  z DictValuesVariable.view_items_vtJ  s    DO$$$r)   c                     t           S r6   )r   r   s    r'   r}   zDictValuesVariable.python_typeN  s    r)   Nr   r   r   r  r   r  r}   rs   r)   r'   r&  r&  F  sA        	B% % X%    r)   r&  c                   .    e Zd ZdZed             Zd ZdS )r$  rH   c                 $    d | j         D             S )Nc                 J    g | ] \  }}t          j        |j        |g          !S rs   )r
   rF   rk   r   s      r'   r9  z3DictItemsVariable.view_items_vt.<locals>.<listcomp>X  s-    OOOtq!	'q	22OOOr)   r  r   s    r'   r  zDictItemsVariable.view_items_vtU  s     POtOOOOr)   c                     t           S r6   )r   r   s    r'   r}   zDictItemsVariable.python_typeZ  s    r)   Nr  rs   r)   r'   r$  r$  R  sD        	BP P XP    r)   r$  r6   )<r   r   r  rN   r  rM  collections.abcr   rQ   typingr   r   torch._subclasses.fake_tensorr   r   r   r	   r
   bytecode_transformationr   r   r  r   r   guardsr   r   r   r   r  r   r   r   r   r   r   r   r   r   r   constantr   torch._dynamo.codegenr   r-   r    r(   r2   r8   re   rH  rX  r^  rq  rU   r  r  r%  r&  r$  rs   r)   r'   <module>r     s   (            3 3 3 3 3 3 * * * * * * * * 1 1 1 1 1 1 6 6 6 6 6 6 6 6 6 6 N N N N N N N N < < < < < < < < 0 0 0 0 0 0 0 0 ) ) ) ) ) )                  4 3 3 3 3 3 3 3 & & & & & &  E//////DDDDDD> > >   2
 2
 2
jw	' w	' w	' w	' w	' w	' w	' w	'tC@ C@ C@ C@ C@? C@ C@ C@L     1   => => => => =>+ => => =>Fd6 d6 d6 d6 d6# d6 d6 d6N=; =; =; =; =; =; =; =;@/; /; /; /; /; /; /; /;d/; /; /; /; /; /; /; /;d,; ,; ,; ,; ,;' ,; ,; ,;^	 	 	 	 	) 	 	 		 	 	 	 	( 	 	 	 	 	r)   