
    PhxX                        d dl Z d dlZd dlmZmZmZmZ d dlZd dl	m
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 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" e jF                   G d d             Z$ G d de      Z% G d de%      Z& G d de%      Z' G d de%      Z( G d de%      Z) G d de%      Z* G d de%      Z+ G d de%      Z, G d  d!e%      Z- G d" d#e%      Z. G d$ d%e      Z/ G d& d'e      Z0 G d( d)e      Z1y)*    N)CallableDictListOptional)Guard   )	variables)create_call_functioncreate_instruction)get_interface_for_device)unimplementedUnsupported)GuardBuilderinstall_guard)
AttrSourceGlobalStateSource   )VariableTracker)NestedUserFunctionVariableUserFunctionVariableUserMethodVariableWrappedUserFunctionVariableWrappedUserMethodVariablec                   n    e Zd ZU dZdZee   ed<   dZee	j                  j                     ed<   d Zd Zy)ContextMangerStatez
    Mutating `self` in VariableTracker is not allowed because we copy
    them.  This is a mutable container pointed to by context managers
    that won't get copied, so it is safe to mutate.
    N
cleanup_fnproxyc                 L    | j                   | j                          d | _         y y N)r   selfs    nC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\torch/_dynamo/variables/ctx_manager.pycleanupzContextMangerState.cleanup#   s"    ??&OO"DO '    c                 J    | j                   sJ d       | j                          y )Nzmultiple exits?)r   r#   r    s    r"   cleanup_assertz!ContextMangerState.cleanup_assert(   s    1 11r$   )__name__
__module____qualname____doc__r   r   r   __annotations__r   torchfxProxyr#   r&    r$   r"   r   r      s9     &*J")&*E8EHHNN#*#
r$   r   c                        e Zd Zddddhej                  Zddd fdZd Zdd	Zd
 Zd Z	d Z
d Z	 	 	 	 	 	 ddZ xZS )ContextWrappingVariablecm_objtarget_valuesinitial_valuesstateN)r5   c                r    t        |   di | || _        || _        |t	               | _        y || _        y Nr/   )super__init__r3   r4   r   r5   )r!   r3   r4   r5   kwargs	__class__s        r"   r9   z ContextWrappingVariable.__init__6   s8    "6"*,-2]')

r$   c                     | j                  || j                         | j                  |       t        j                  j                  d       S r   )
_call_funcr3   set_cleanup_hookr	   ConstantVariablecreater!   txs     r"   enterzContextWrappingVariable.enter<   s;    D../b!))0066r$   c                      | fd}| j                   _        j                  j                   j                   j                         y )Nc                  >     j                   j                         y r   )r=   r4   rA   s   r"   fnz4ContextWrappingVariable.set_cleanup_hook.<locals>.fnD   s    D$7$78r$   )r5   r   outputadd_cleanup_hookr#   )r!   rB   rF   s   `` r"   r>   z(ContextWrappingVariable.set_cleanup_hookA   s7    :9 !#


		""4::#5#56r$   c                 t    | j                   j                          t        j                  j	                  d       S r   )r5   r&   r	   r?   r@   r!   rB   argss      r"   exitzContextWrappingVariable.exitJ   s)    

!!#))0066r$   c                     t        |j                  j                  | j                               | j	                               }|j                  |      S r   )r   rB   import_sourcemodule_namefn_namereconstruct)r!   codegenattr_sources      r"   rQ   z#ContextWrappingVariable.reconstructN   sB     JJ$$T%5%5%78$,,.
 &&w//r$   c                     t        d      )Nzmodule_name called on baseNotImplementedErrorr    s    r"   rO   z#ContextWrappingVariable.module_nameT   s    !">??r$   c                     t        d      )Nzfn_name called on baserU   r    s    r"   rP   zContextWrappingVariable.fn_nameW   s    !":;;r$   c                 F   t        |      dk(  sJ t        |d   t              rt        |d   j	                               |d<   t        |d   t
        t        f      sJ t        |d   t
              rt        |d   |       S t        |d   t              rt        |d   |       S y Nr   r   )len
isinstancer   r   get_functionr   r   r   r!   rB   rK   r:   s       r"   call_functionz%ContextWrappingVariable.call_functionZ   s     4yA~~d1g9:*47+?+?+ABDG$q'$68L#MNNNd1g12,T!Wd;;d1g34.tAw== 5r$   r   rK   List[VariableTracker]r:   Dict[str, VariableTracker]returnr   )r'   r(   r)   r   _nonvar_fieldsr9   rC   r>   rL   rQ   rO   rP   r^   __classcell__r;   s   @r"   r1   r1   -   sp    	
 
	'	'NFD F7
770@<>/>9U>	>r$   r1   c                   2     e Zd Zddd fdZd Zd Z xZS )GenericContextWrappingVariableN)r2   c                @    |J t        |   d||d| || _        y Nr3   r4   r/   )r8   r9   r2   )r!   r3   r4   r2   r:   r;   s        r"   r9   z'GenericContextWrappingVariable.__init__j   s7    !!! 	
'	
JP	
 r$   c                 j   | j                   d nt        | j                   d      }	 t        j                  | j                  j
                  j                  t        j                  | j                        |      j                  |g i       S # t        $ r}t        d| j                   d      |d }~ww xY w)N	__enter__sourceUnsupported context manager z's __enter__ function)rn   r   r	   r   r2   rl   __func__UserDefinedObjectVariabler^   r   r   )r!   rB   rn   es       r"   rC   z$GenericContextWrappingVariable.enterq   s    ,*T[[+2V		//%%..33DKK@ mBB'	(
  	.t{{m;PQ	s   A#B
 
	B2B--B2c                 L   | j                   d nt        | j                   d      }	 t        j                  | j                  j
                  j                  t        j                  | j                        |      j                  |t        j                  j                  d       t        j                  j                  d       t        j                  j                  d       gi       }|xj                  dz  c_        |S # t        $ r}t        d| j                   d      |d }~ww xY w)N__exit__rm   ro   z's __exit__ functionr   )rn   r   r	   r   r2   rt   rp   rq   r^   r?   r@   r   r   generic_context_manager_depth)r!   rB   rK   rn   xrr   s         r"   rL   z#GenericContextWrappingVariable.exit~   s    ,*T[[*2U	,,$$--33DKK@ m..55d;..55d;..55d;
 	 $ 	((A-(  	.t{{m;OP	s   B>C; ;	D#DD#r   )r'   r(   r)   r9   rC   rL   rd   re   s   @r"   rg   rg   i   s    T r$   rg   c                        e Zd ZdZ e e       ej                        Ze	d
d       Z
d fd	Zd Zd Z	 	 	 	 d fdZd Zd Zd	 Z xZS )GradModeVariablez6represents torch.{no_grad,enable_grad,set_grad_mode}()c                     t        d|gt        j                         gd|}|r|j                  | |j                         |S ri   )rx   r,   is_grad_enabledr=   r3   )rB   target_valueinitializedr:   vars        r"   r@   zGradModeVariable.create   sM     
'.!1134
 

 NN2s001
r$   c                 T    t        |   d||d| t        | j                         y ri   r8   r9   r   _guards_singleton)r!   r3   r4   r|   r:   r;   s        r"   r9   zGradModeVariable.__init__   2     	
'	
JP	
 	d,,-r$   c                 x    | j                  || j                         t        j                  j	                  d       S r   )r=   r3   r	   r?   r@   rA   s     r"   rC   zGradModeVariable.enter   s-    D../))0066r$   c                 x    | j                  || j                         t        j                  j	                  d       S r   )r=   r4   r	   r?   r@   rJ   s      r"   rL   zGradModeVariable.exit   s-    D//0))0066r$   c                 ^    | j                  || j                         t        |   |||      S r   )r=   r4   r8   r^   )r!   rB   rK   r:   r;   s       r"   r^   zGradModeVariable.call_function   s-     	D//0w$Rv66r$   c                 
   t        |      dk(  sJ |d   }t        j                         |k7  rW|j                  j	                  dt        j
                  j                  |fi        t        j
                  j                  |       y y Nr   r   r^   )rZ   r,   rz   rG   create_node_C_set_grad_enabledr!   rB   valuesvalues       r"   r=   zGradModeVariable._call_func   sn    6{aq	  "e+II!!!;!;eXr HH&&u-	 ,r$   c                      yNr,   r/   r    s    r"   rO   zGradModeVariable.module_name       r$   c                      y)Nset_grad_enabledr/   r    s    r"   rP   zGradModeVariable.fn_name   s    !r$   )F)NT)rK   r`   r:   ra   )r'   r(   r)   r*   r   r   r   	GRAD_MODEr   staticmethodr@   r9   rC   rL   r^   r=   rO   rP   rd   re   s   @r"   rx   rx      sb    @/1<3I3IJ .777/79U7."r$   rx   c                   J     e Zd Zed        Z	 d fd	Zd Zd Zd Zd Z	 xZ
S )InferenceModeVariablec                 F    t        |fdt        j                         i|}|S )Nr4   )r   r,   is_inference_mode_enabled)rB   r3   r:   r}   s       r"   r@   zInferenceModeVariable.create   s/    #
*/*I*I*K
OU
 
r$   c                 d    |t        j                         }t        |   d||d| || _        y ri   )r,   r   r8   r9   r3   r!   r3   r4   r:   r;   s       r"   r9   zInferenceModeVariable.__init__   sB     !"<<>N 	
'	
JP	
 +r$   c                     | j                   j                          |j                  j                  dt        j
                  j                  j                  | j                   j                  fi        y Nr^   )	r5   r&   rG   r   r,   autograd	grad_mode_exit_inference_moder   rJ   s      r"   rL   zInferenceModeVariable.exit   sM    

!!#
		NN$$99ZZ		
r$   c                 J   t         j                  j                  j                  | j                        | j                  |fd       |j                  j                  dt         j                  j                  j                  | j                  fi       | j                  _	        y )Nc                  V    t         j                  j                  j                         S r   )r,   r   r   r   ctxs   r"   <lambda>z-InferenceModeVariable.enter.<locals>.<lambda>   s    00EEcJr$   r^   )
r,   r   r   _enter_inference_moder3   r>   rG   r   r5   r   r!   rB   r   s     @r"   rC   zInferenceModeVariable.enter   sy    nn&&<<T=O=OPJ	
 9900NN$$::!	


r$   c                      y)Nztorch.inference_moder/   r    s    r"   rO   z!InferenceModeVariable.module_name       %r$   c                      y)Ninference_moder/   r    s    r"   rP   zInferenceModeVariable.fn_name   s    r$   r   r'   r(   r)   r   r@   r9   rL   rC   rO   rP   rd   re   s   @r"   r   r      s3      +


& r$   r   c                   p     e Zd ZdZ e e       ej                        Ze	d        Z
d fd	Zd Zd Z xZS )TorchFunctionDisableVariablez>represents whether torch function overrides are enabled or notc                     t        ddg| j                  j                  gd|}|j                  | dg       |j	                  |        |S )NFrj   r/   )r   rG   torch_function_enabledr=   r>   )rB   r:   r}   s      r"   r@   z#TorchFunctionDisableVariable.create  sU    * 
 'II<<=
 
 	rE7#R 
r$   c                 T    t        |   d||d| t        | j                         y ri   r   r   s       r"   r9   z%TorchFunctionDisableVariable.__init__  r   r$   c                 @    t         j                  j                  d       S r   r	   r?   r@   rA   s     r"   rC   z"TorchFunctionDisableVariable.enter      ))0066r$   c                 `    t        |      dk(  sJ |j                  j                  |d          y rY   )rZ   rG   set_torch_function_state)r!   rB   r   s      r"   r=   z'TorchFunctionDisableVariable._call_func  s*    6{a
		**6!95r$   r   )r'   r(   r)   r*   r   r   r   TORCH_FUNCTION_STATEr   r   r@   r9   rC   r=   rd   re   s   @r"   r   r      s>    H/1<3T3TU	 	.76r$   r   c                   |     e Zd ZdZ e e       ej                        Ze	d        Z
d fd	Zd Zd Zd Zd Z xZS )	DeterministicAlgorithmsVariablezVrepresents torch.{are_deterministic_algorithms_enabled,use_deterministic_algorithms}()c                     t        d|gt        j                         gd|}|j                  | |g       |j	                  |        |S ri   )r   r,   $are_deterministic_algorithms_enabledr=   r>   rB   r{   r:   r}   s       r"   r@   z&DeterministicAlgorithmsVariable.create$  sT    - 
'.!FFHI
 

 	rL>*R 
r$   c                 T    t        |   d||d| t        | j                         y ri   r   r   s       r"   r9   z(DeterministicAlgorithmsVariable.__init__/  r   r$   c                 @    t         j                  j                  d       S r   r   rA   s     r"   rC   z%DeterministicAlgorithmsVariable.enter5  r   r$   c                     t        |      dk(  sJ |d   }|j                  j                  dt        j                  j
                  |fi       f t        j                  j                  |       y r   )rZ   rG   r   r,   r   _set_deterministic_algorithmsr   s       r"   r=   z*DeterministicAlgorithmsVariable._call_func8  s]    6{aq	
		UXXCCeXr	
 	 	..u5r$   c                      yr   r/   r    s    r"   rO   z+DeterministicAlgorithmsVariable.module_name@  r   r$   c                      y)Nuse_deterministic_algorithmsr/   r    s    r"   rP   z'DeterministicAlgorithmsVariable.fn_nameC  s    -r$   r   )r'   r(   r)   r*   r   r   r   DETERMINISTIC_ALGORITHMSr   r   r@   r9   rC   r=   rO   rP   rd   re   s   @r"   r   r     sL    `\BB  .76.r$   r   c                   L     e Zd ZdZed        Zd fd	Zd Zd Zd Z	d Z
 xZS )	!DisabledSavedTensorsHooksVariablez;represents torch.autograd.graph.disable_saved_tensors_hook.c                     t        d|gt        j                  j                  j	                         gd|}|j                  | |g       |j                  |        |S ri   )r   r,   r   	_autograd/_saved_tensors_hooks_get_disabled_error_messager=   r>   r   s       r"   r@   z(DisabledSavedTensorsHooksVariable.createJ  s`    / 
'.""RRT

 
 	rL>*R 
r$   c                 *    t        |   d||d| y ri   r8   r9   r   s       r"   r9   z*DisabledSavedTensorsHooksVariable.__init__W  s"     	
'	
JP	
r$   c                 @    t         j                  j                  d       S r   r   rA   s     r"   rC   z'DisabledSavedTensorsHooksVariable.enter\  r   r$   c                    t        |      dk(  sJ |d   }|k|j                  j                  dt        j                  j
                  j                  |fi        t        j                  j
                  j                  |       y |j                  j                  dt        j                  j
                  j                  di        t        j                  j
                  j                          y )Nr   r   r^   r/   )rZ   rG   r   r,   r   r   _saved_tensors_hooks_disable_saved_tensors_hooks_enabler   s       r"   r=   z,DisabledSavedTensorsHooksVariable._call_func_  s    6{aq	 II!!""??	 HH;;EB II!!!3!3!O!OQSUW HH::<r$   c                      y)Nztorch.autograd.graphr/   r    s    r"   rO   z-DisabledSavedTensorsHooksVariable.module_namet  r   r$   c                      y)Ndisable_saved_tensors_hooksr/   r    s    r"   rP   z)DisabledSavedTensorsHooksVariable.fn_namew  s    ,r$   r   )r'   r(   r)   r*   r   r@   r9   rC   r=   rO   rP   rd   re   s   @r"   r   r   G  s1    E
 


7=*&-r$   r   c                   H     e Zd Zed        Zd fd	Zd Zd Zd Zd Z	 xZ
S )AutocastModeVariablec                 0   | t         j                  j                  j                  t         j                  j                  j                  t         j
                  j                  j                  fv sJ  t        j                  |       j                  |i |}|j                          g }|j                          dD ]  }|dk(  ru| t         j                  j                  j                  t         j
                  j                  j                  fv r+| t         j                  j                  j                  u rdnd}n|j                  |   }t        |t              r |j                  |j                                |j                  |        t!        |fdd i|}|S )N)device_typedtypeenabledcache_enabledr   cudacpur4   )r,   ampautocast_modeautocastr   r   inspect	signaturebindapply_defaultsclear	argumentsr[   r   appendas_python_constantr   )funcrK   r:   
bound_argsr3   keyargr}   s           r"   r@   zAutocastModeVariable.create|  sE   II##,,JJNN##IIMM""
 
 	
 
 2W&&t,114B6B
!!#GCm#

''		&&1 ) !%

(?(? ?fU **3/#/$$S%;%;%=>$$S) H #=PPP
r$   c                 8    t        |   d||d| || _        y ri   )r8   r9   r3   r   s       r"   r9   zAutocastModeVariable.__init__  s,     	
'	
JP	
 +r$   c                     | j                   j                          |j                  j                  dt        j
                  j                  | j                   j                  fi        y r   )r5   r&   rG   r   r,   r   _exit_autocastr   rJ   s      r"   rL   zAutocastModeVariable.exit  sD    

!!#
		UYY55

8H8H7JB	
r$   c                     t        j                  j                  | j                   | j	                  |fd       |j
                  j                  dt         j                  j                  g | j                  i       | j                  _        y )Nc                  B    t         j                  j                         S r   )r,   r   r   r   s   r"   r   z,AutocastModeVariable.enter.<locals>.<lambda>  s    %))*B*B3*Gr$   r^   )	r,   r   _enter_autocastr3   r>   rG   r   r5   r   r   s     @r"   rC   zAutocastModeVariable.enter  si    ii''););<b"GH9900UYY668N$:L:L8NPR


r$   c                      y)Nztorch.amp.autocast_moder/   r    s    r"   rO   z AutocastModeVariable.module_name  s    (r$   c                      y)Nr   r/   r    s    r"   rP   zAutocastModeVariable.fn_name  s    r$   r   r   re   s   @r"   r   r   {  s.     >+

)r$   r   c                   <     e Zd ZdZd fd	Zd Zd Zd Zd Z xZ	S )NullContextVariablez
    This class represents Python contextlib.nullcontext.
    It's used as a placeholder for other context managers that Dynamo doesn't
    support yet, e.g, torch.autograd.profiler.record_function.
    c                 (    t        |   dd|i| y )Nr3   r/   r   )r!   r3   r:   r;   s      r"   r9   zNullContextVariable.__init__  s    ?}??r$   c                 @    t         j                  j                  d       S r   r   rA   s     r"   rC   zNullContextVariable.enter  r   r$   c                 @    t         j                  j                  d       S r   r   rJ   s      r"   rL   zNullContextVariable.exit  r   r$   c                      y)N
contextlibr/   r    s    r"   rO   zNullContextVariable.module_name  s    r$   c                      y)Nnullcontextr/   r    s    r"   rP   zNullContextVariable.fn_name  s    r$   r   )
r'   r(   r)   r*   r9   rC   rL   rO   rP   rd   re   s   @r"   r   r     s"    @77r$   r   c                   H     e Zd Zed        Zd fd	Zd Zd Zd Zd Z	 xZ
S )StreamContextVariablec           
          ddl m} t        |j                        j                  } |t
        | | j                  j                  d|di             }t        d|g|g|j                  d|S )Nr   wrap_fx_proxy_clsr^   r   )r3   r4   devicer/   )	builderr   r   r   current_streamStreamVariablerG   create_proxyr   )rB   r{   r:   r   current_stream_methodr  s         r"   r@   zStreamContextVariable.create  s    . 8!

. 	 +II""%		
 % 
'.*+&&
 	
 	
r$   c                     t        |   d||d| || _        t        | j                        j                  | _        t        | j                        j
                  | _        y ri   )r8   r9   r   r   
set_stream_set_stream_by_idset_stream_id)r!   r3   r   r4   r:   r;   s        r"   r9   zStreamContextVariable.__init__  sX     	
'	
JP	
 24;;?JJ5dkkBTTr$   c                      j                   d   j                         E|j                  j                  d j                   j                   d   j                         fi        nb j                   d   j
                  }|j                  j                  d j                  |j                  |j                  |j                  fi         j	                   j                   d   j
                          j                  | fd       y )Nr   r^   c                  T     j                   j                  d   j                        S )Nr   )r  r4   r   r    s   r"   r   z-StreamContextVariable.enter.<locals>.<lambda>  s    $//$:M:Ma:P:V:V*Wr$   )r3   as_proxyrG   r  r  r   r  	stream_iddevice_indexr   r>   )r!   rB   streams   `  r"   rC   zStreamContextVariable.enter  s    a ))+7II""##A&//13	 ''*00FII""""!!6#6#68J8JK	 	**1-334b"WXr$   c                     |j                   j                  d| j                  | j                  d   j	                         fi        | j
                  j                          y )Nr^   r   )rG   r  r  r4   r  r5   r&   rJ   s      r"   rL   zStreamContextVariable.exit  sM    
		OO  #,,.0		
 	

!!#r$   c                 2    dt        | j                        z   S )Nztorch.)strr   r    s    r"   rO   z!StreamContextVariable.module_name  s    #dkk***r$   c                      y)Nr  r/   r    s    r"   rP   zStreamContextVariable.fn_name  s    r$   r   )r'   r(   r)   r   r@   r9   rC   rL   rO   rP   rd   re   s   @r"   r   r     s0    
 
.UY*$+r$   r   c                   8     e Zd Z fdZ	 	 	 	 	 	 ddZd Z xZS )r  c                     |6d|j                   j                  v r|j                   j                  d   |k(  sJ |j                  j                  |k(  sJ d       t	        |   di | || _        || _        || _        y )Nexample_valuez.stream value is not equal to the passed devicer/   )nodemetar   typer8   r9   r   r   )r!   r   r   r   r:   r;   s        r"   r9   zStreamVariable.__init__  sz    EJJOO!C::???3u<<<LL'	<;	<'"6"

r$   c                 8   t        | j                  |      s
J d|        |dv s
J d|        ddlm} ddlm} |dv r> |j                  j                  d	|g || g|z   |        t        j                  d       S |d
k(  r@ |t        j                  | |j                  j                  d	|g || g|z   |             S |dk(  r6 |t        | |j                  j                  d	|g || g|z   |             S t        | j                  dz   |z   dz          y )Nzno stream method found named )wait_streamsynchronizequeryrecord_event
wait_eventz unsupported stream method r   proxy_args_kwargsr   r   )r  r  r  call_methodr  
target_clsrB   r   r  z stream method  unsupported)hasattrr   utilsr   r   r   rG   r  r	   r?   EventVariabler   r   r!   rB   namerK   r:   r   r   s          r"   r!  zStreamVariable.call_method  sV    tzz4(P,I$*PP( 
 
 	0 )/	0 
 	..??"BII""t&7v&N --d33W_$$55,bii,,!4*;TFTM6*R  ^#$(,bii,,!4*;TFTM6*R  $++(99D@>QRr$   c                     | j                   S r   r   r    s    r"   r  zStreamVariable.as_proxyJ      zzr$   r_   r'   r(   r)   r9   r!  r  rd   re   s   @r"   r  r    s5    	)S &	)S
 -)S 
)SVr$   r  c                   8     e Zd Z fdZ	 	 	 	 	 	 ddZd Z xZS )r'  c                     |6d|j                   j                  v r|j                   j                  d   |k(  sJ t        |   di | || _        || _        y )Nr  r/   )r  r  r8   r9   r   r   )r!   r   r   r:   r;   s       r"   r9   zEventVariable.__init__O  sQ    EJJOO!C::???3u<<<"6"

r$   c                 H   ddl m} ddlm} |dv r> |j                  j
                  d|g || g|z   |        t        j                  d       S |dk(  r@ |t        j                  | |j                  j
                  d|g || g|z   |             S t        d	| d
       y )Nr   r  r   r   )waitrecordr  r!  r  r"  zevent method r$  )	r&  r   r   r   rG   r  r	   r?   r   r(  s          r"   r!  zEventVariable.call_methodV  s     	..44"BII""t&7v&N --d33W_$$55,bii,,!4*;TFTM6*R  M$|<=r$   c                     | j                   S r   r+  r    s    r"   r  zEventVariable.as_proxyp  r,  r$   r_   r-  re   s   @r"   r'  r'  N  s0    > &	>
 -> 
>4r$   r'  c                   >     e Zd Zdef fdZ	 	 	 	 	 	 ddZd Z xZS )WithExitFunctionVariabler   c                 d    t        |   di | t        |t              sJ || _        || _        y r7   )r8   r9   r[   r1   r   target)r!   r   r7  r:   r;   s       r"   r9   z!WithExitFunctionVariable.__init__u  s2    "6"#6777r$   c                 D    |rJ  | j                   j                  |g| S r   )r   rL   r]   s       r"   r^   z&WithExitFunctionVariable.call_function{  s&     ztxx}}R'$''r$   c                 .   t        |j                  j                  | j                  j	                               | j                  j                               j                  |      }|j                  j                  j                  r| j                  j                  D cg c]  }|j                  |       }}|j                  |       |j                  g t        t        |      d      t        d| j                        t        d             |S c c}w )NT
SETUP_WITH)r7  POP_TOP)r   rB   rN   r   rO   rP   rQ   rG   partial_convertr3   create_load_constextendr
   rZ   r   r7  )r!   rR   rG   valloadss        r"   rQ   z$WithExitFunctionVariable.reconstruct  s     JJ$$TXX%9%9%;<dhh>N>N>P

+g
 	 ::,,?Cxx?U?UV?UW..s3?UEVMM% MM)#e*d;&|DKKH 'y1  Ws   Dr_   )r'   r(   r)   r1   r9   r^   rQ   rd   re   s   @r"   r5  r5  t  s2    3 (/(9U(	(r$   r5  )2dataclassesr   typingr   r   r   r   torch._Cr,   torch._guardsr    r	   bytecode_transformationr
   r   device_interfacer   excr   r   guardsr   r   rn   r   r   baser   	functionsr   r   r   r   r   	dataclassr   r1   rg   rx   r   r   r   r   r   r   r   r  r'  r5  r/   r$   r"   <module>rM     s     1 1    N 7 , 0 2 !    (9>o 9>x+%< +\2". 2"j/ 3 / d6#: 6>'.&= '.T1-(? 1-h82 8v1 .C3 CL8_ 8v#O #L r$   