
    i                     l   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 d dlm	Z	 d dl
Z
d dlZd dlmc mZ d dlmZmZm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$ d dl%m&Z& ddl'm(Z( ddl)m*Z* ddl+m,Z,m-Z-m.Z.m/Z/ dej`                  dej`                  de1fdZ2dej`                  de3fdZ4de3e5   fdZ6de3e5   fdZ7de3e5   de3ejp                     fdZ9ejt                  jv                  d        Z<d Z=d ej|                  j~                  d!ee5dz     de@eAe5ej|                  j                  f   eAe5ej|                  j                  f   f   fd"ZCd ej|                  j~                  d#ee5dz     d$eAe5ej|                  j                  f   d%eAe5ej|                  j                  f   ddf
d&ZD	 dDdej`                  d'ej`                  dz  d(e3e5   dz  defd)ZE	 dDd ej|                  j~                  d!ee5dz     d#ee5dz     dej`                  d'ej`                  dz  d(e3e5   dz  fd*ZFd+ej|                  j~                  d,e-d-eAe5e	f   d.eAe5e	f   ddf
d/ZG G d0 d1eH      ZI G d2 d3ej|                  j~                  eI4      ZJd5ej|                  j~                  d6e,deJfd7ZKd8 ZLd9e5d:e3e	   fd;ZMd<e3ej|                  j                     d=eAe
j                  e&f   d>e3ejp                     fd?ZOd@ ZP	 dEd6e,dej|                  j~                  fdAZQ G dB dCej                  j                        ZTy)F    N)Sequence)chain)Any),_enter_enable_graph_inputs_of_type_nn_module+_exit_enable_graph_inputs_of_type_nn_module#_get_graph_inputs_of_type_nn_module)_convert_range_to_int)"_check_input_constraints_for_graph)_assign_attr	_AttrKind)!_pytree_subclasses_that_lose_info)_PyTreeCodeGen_PyTreeInfo)
NodeSourceNodeSourceAction)	try_solve)ValueRanges   )_remove_effect_tokens)reorder_kwargs)ExportedProgramExportGraphSignature	InputKind
OutputKindselfotherreturnc                 *    d fd | |      S )z
    Refinement of TreeSpec.__eq__ where, e.g., torch.Size(...) matches tuple(...).
    See _pytree_subclasses_that_lose_info in proxy_tensor.py for more details.
    c                 @    t        t        j                  | |             S N)strr   get)ts    N/var/www/html/engine/venv/lib/python3.12/site-packages/torch/export/_unlift.py_normalize_typez eq_spec.<locals>._normalize_type.   s    488A>??    c                    | |u ry | j                          |j                         k7  ry| j                   t        u r>|j                   t        u r,t        | j                        t        |j                        k7  ry| j                  |j                  k7  ry| j                  |j                  k7  ryt        fdt        | j                         |j                               D              S )NTFc              3   6   K   | ]  \  }} ||        y wr     ).0ab_match_normalized_structures      r$   	<genexpr>z?eq_spec.<locals>._match_normalized_structure.<locals>.<genexpr>>   s$      
1 (1-
s   )typedictsetcontextnum_childrenallzipchildren)r+   r,   r-   r%   s     r$   r-   z,eq_spec.<locals>._match_normalized_structure1   s    6166"oaff&==66T>affn199~QYY/YY!))#>>Q^^+ 
AJJL!**,7
 
 	
r&   r)   )r   r   r-   r%   s     @@r$   eq_specr7   (   s    @
$ 'tU33r&   in_specc                     t        ||      }t        j                  | |f      \  }}t        ||      st	        d| d| d      |S )Nz>Trying to flatten user inputs with exported input tree spec: 
z-
but actually got inputs with tree spec of: 
zr.
Please check that the inputs have the same number and type of args and kwargs as the ones you used when tracing.)r   pytreetree_flatten_with_pathr7   
ValueError)argskwargsr8   reordered_kwargsflat_args_with_pathreceived_specs         r$   _check_inputs_matchrB   F   sm    %fg6)/)F)F	 *& ='*Mi <o AA
 	
 r&   ep_guards_codec                     i }t        |      D ]$  \  }}dt        j                  |       |d| d<   & g }| D ]=  }|j                         D ]  \  }}|j	                  ||      } |j                  |       ? |S )NLL['flat_args'][])	enumerater:   keystritemsreplaceappend)	rC   input_pathsname_mappingidxpathnew_guards_codeguardold_namenew_names	            r$   _force_ep_signature_matchrU   Y   s     L{+ K	T34V]]45H4I1Jse1-.K O &"."4"4"6 	6HhMM(H5E	6u%&
 r&   c                 t   ddl }t               }| D ]#  }|j                  |j                  d|             % t               }|j                  D ]#  }|j                  |j                  d|             % | }|D ]9  }||v s|\  }	}
|D cg c]"  }|j                  d|	 d|
 dd|	 d|
 d	      $ }}; |S c c}w )
aP  
    The signature of the originally exported module may not match
    the signature of the unlifted graph module extracted from the
    exported program. The guards code extracted from the exported
    program is based on the former, but the generated guards fn is
    based on the latter; thus we need to reconcile any such diff.
    r   NzL\[\'([^\']+)\'\]\[([0-9]+)\]z(.+)_([0-9]+)zL['z'][rG   _z'])rer1   updatefindall
parametersrK   )rC   	signaturerX   orig_arg_namesgsig_arg_namesnrQ   matchbaserO   s              r$   _force_gm_signature_matchrc   p   s      UN Objj)I1MNO EM!! >RZZ(8!<=>
 %O M!ID# ) 		CvSQ/3tfAcU"1EFO  s   'B5guards_codepaths_of_placeholdersc                    ddl }ddlm} g }g }| D ]  }||}}t        |      D ]  \  }	}
|j	                  dt        j                  |
      z   d|	 d      }|j	                  dt        j                  |
      z   |
d   j                  t        j                  |
dd       z         } |j                  |       |j                  |j	                  dd	              d
}t        ||      D ]3  \  }}|j                  |j                  |d            }|d| d| dz  }5 |dz  }i |}t        ||       t               }t        j                  j!                  |d         |_        d|_        |S )ah  
    Generates Python code given guards code and paths of placeholders.
    We assume that, based on source information,
    - the tracer generates the guards code
    - the input spec generates the paths of placeholders.

    Example:

    Suppose we are given the guards code "L['z']['k'].size()[1] == 3"
    and we are given that ['z']['k'] is the path of placeholder #2.
    Then we will generate:
    ```
    torch._assert(
        args[2].size()[0] == 3,
        "Guard failed: z['k'].size()[0] == 3",
    )
    ```

    FAQ: Why do we generate code based on (flattened) args instead of
    the original (unflattened) inputs? Because this would require
    inserting an additional pytree.unflatten call in our graph.

    FAQ: Why do we not emit RuntimeError on guard failure as we used to?
    Because it is inconvenient :/, get used to AssertionError instead.
    r   N)SYMPY_INTERPrE   zargs[rG   r   
 z
def _(*args):
eval)modez  torch._assert(z, "Guard failed: z")
z	  return
rW   T)ast%torch.fx.experimental.symbolic_shapesrg   rH   rK   r:   rI   keyrL   r5   unparseparseexecGuardsFntorch_dynamodont_skip_tracingforward
_is_impure)rd   re   rl   rg   actual_guards_codeshadow_guards_codecr+   srO   rP   code_stractualshadow_shadow	namespace	guards_fns                    r$   _convert_guards_code_to_fnr      s   < B 7!1"#89 	IC		#d 33uSE^DA		fmmD))QfmmDH55A		 	!!!$!!!))D""567 #H02DE N ++ciiVi<=&vh.?yMMN H !< I9 
I77	#GIIr&   c                     t        ||| j                        }t        | j                  j	                  d      || j
                         y )Nplaceholderop)rB   _in_specr
   graph
find_nodesrange_constraints)r   r=   r>   r@   s       r$   #_check_input_constraints_for_moduler      s>    -dFDMMJ&

/r&   c                     | j                   sy t        | d      rt        ||| j                         y t        j
                  j                         st        | ||       y y )N
_guards_fn)validate_inputshasattrrB   r   rs   compileris_dynamo_compilingr   )r   r=   r>   s      r$   !_check_input_constraints_pre_hookr      sP    
 t\"D&$--8
 >>--/+D$? 0r&   gmlifted_inputsc                    i }i }| j                   j                  D cg c]  }|j                  dk(  s| }}t        |      t        |      k(  sJ t	        ||      D ]  \  }}||||j
                  <   | j                   j                  |      5  t        j                         5  t        j                  d       | j                   j                  |      }ddd       |j                         |j                  }	| j                   j                  |       |	|_        t        |dt        j                   t        j"                  g      g|j                  d<   |||<   ddd       	 ||fS c c}w # 1 sw Y   xY w# 1 sw Y   )xY w)z_
    Unlift inputs referring to params/buffers/constants as getattr nodes in the
    graph
    r   Nignore!ExportedProgram.module().unlift()	from_node)r   nodesr   lenr5   nameinserting_afterwarningscatch_warningssimplefilterget_attrreplace_all_uses_withmeta
erase_noder   r   CREATEREPLACE)
r   r   unlifted_name_to_nodeinput_name_to_nodenodeplaceholder_nodes
input_nodelifted_nodegetattr_nodemetadatas
             r$   _unlift_inputs_as_getattrr      s    *,((..U$DGG}<TUU}%6!7777#&'8-#H B
K2<z/ ))*5 B ,,. B))(3#%88#4#4[#ALB 00>%??##J/$,!";)002B2J2JK2!!+. 6B%k2%B BB2 !"4447 VB B	B Bs/   E+E+E<&1E0BE<0E95E<<F	mutated_outputsr   r   c                 B   | j                   j                         }t        j                  |j                        d   }t        |      t        |      k(  sJ g }i t        ||      D ]  \  }}||j                  |       ||v r||   }	n||v r||   }	nt        d| d      | j                   j                  |      5  | j                   j                  t        j                  j                  j                  j                  |	|f      }
|
|<   ddd        t!        fd|D              }| j                   j                  |      5  | j                   j#                  |      }|j%                  |       | j                   j'                  |       |j(                  |_        |j*                  j-                  |j*                         t/        |dt0        j2                  t0        j4                  g      g|j*                  d<   ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)zt
    Find the all the buffers and inputs that were mutated and insert copy_
    operators to reflect mutations.
    r   NzCould not find z  in either buffer or input nodesc              3   B   K   | ]  }j                  ||        y wr    )r"   )r*   r   return_nodes_to_copys     r$   r.   z-_insert_copy_for_mutations.<locals>.<genexpr>H  s$      15  t,s   r   r   )r   output_noder:   tree_flattenr=   r   r5   rL   RuntimeErrorinserting_beforecall_functionrs   opsatencopy_defaulttupleoutputr   r   r   r   rY   r   r   r   r   )r   r   r   r   r   outputsuser_output_nodesreturn_nodemutated_node_namemutated_node	copy_nodeoutput_args
new_outputr   s                @r$   _insert_copy_for_mutationsr   $  s
    ((&&(K!!+"2"23A6Gw<3////*-g*G :&&$$$[1 5501BCL"44-.?@L!"3!44TU  XX&&{3 	:..		$$,,|[.II 1: -		: 	::(  9J K 
	"	";	/ 
XX__[1
))*5
K(%**
{//03!((*:*B*BC(

$
 
	: 	:
 
s   ?AHB7HH	Hout_specforward_arg_namesc                    |r|}n| j                   t        u r| j                  dk(  r| j                  d      j                   t        u r| j                  d      j                   t        u r_t        | j                  d      j                        D cg c]  }d| 	 }}|j                  | j                  d      j                         n%t        | j                        D cg c]  }d| 	 }}t        t        || |            S c c}w c c}w )zK
    Create the codegen for the graph module based on the in/out specs
       r   r   arg_)
r/   r   r3   childr0   rangeextendr2   r   r   )r8   r   r   namesis        r$   _get_codegenr   [  s     !  A%MM!!!U*MM!!!T) &+7==+;+H+H%IJ4sJJW]]1%--.%*7+?+?%@A4sAA	
  K Bs   DDc                     t        | |      \  }}t        | |||       t        |||      | j                  _        | j                  j                          | j                          | S )a  
    Args:
        lifted_inputs: A list matching the graph module's input nodes. For
        an input node that is referring to a lifted parameter/buffer, this
        list will contain the fqn the corresponding attribute. Otherwise, this
        list will contain None. This is used to unlift the lifted parameters as
        get_attr nodes.

        mutated_outputs: A list matching the graph module's output nodes. For
        an output node that is referring to a mutated buffer or user input, this
        list will contain the name of the corresponding buffer or user input
        that needs to be mutated. Otherwise, this list will contain None. This
        is used to re-insert an inplace copy_ operator to copy the mutated
        values back to the original node.
    )r   r   r   r   _codegenlint	recompile)r   r   r   r8   r   r   r   r   s           r$   _unliftr   {  sc    . 1J
M1-- 
O24F %Wh8IJBHHHHMMOLLNIr&   new_gmgraph_signature
state_dict	constantsc                    t        |j                        }|j                  D ]3  }||v rd}||   }nd}||   }t        || |t        j
                  |       5 |j                  D ]$  }||   }t        || |t        j                         & t        |j                  |j                        D ]$  }||   }t        || |t        j                         & y )NFT	attr_kind
persistentr   )r1   non_persistent_buffersbuffersr   r   BUFFERr[   	PARAMETERr   lifted_custom_objslifted_tensor_constantsCONSTANT)r   r   r   r   r   r   r   values           r$   _register_attrs_to_new_gmr     s     !!G!GH'' 	
))JdOEJt$E649+;+;
	
	
  ** 
4 ))		

 **O,S,S 	
 $((		
		
r&   c                   *     e Zd ZdZd Zd fd	Z xZS )_StatefulGraphModuleFactoryzO
    Metaclass that ensures a private constructor for _StatefulGraphModule
    c                 L    t        | j                   d| j                   d      )N.z has no public constructor. )	TypeError
__module____qualname__)clsr=   r>   s      r$   __call__z$_StatefulGraphModuleFactory.__call__  s,    ~~a 0 011MN
 	
r&   c                 (    t         |   |||      S )Nr   )superr   )r   rootr   r   	__class__s       r$   _createz#_StatefulGraphModuleFactory._create  s#    w/   
 	
r&   r    )__name__r   r   __doc__r   r   __classcell__r   s   @r$   r   r     s    


 
r&   r   c                         e Zd Zd fd	Z xZS )_StatefulGraphModulec                 J    t         |   ||       |xs g | _        d| _        y )NT)r   __init__r   r   )r   r   r   r   r   s       r$   r   z_StatefulGraphModule.__init__  s'    u%!2!8b#r&   r    )r   r   r   r   r   r   s   @r$   r   r     s    $ $r&   r   )	metaclassplain_graph_moduleepc                    t         j                  | | j                  |      }t        |j                        |j                  fd       |j                  t        d       |j                  fdd       i }|j                  j                  D ]  }|j                  |      }|j                  r2t        j                  d| dd	
       |j                         }|||<   |}|j                  d      ^ }}	t         j"                  j$                  j'                  ||      }
t)        |
|	       t+        |||t,        j.                          |j0                  j3                         D ]  \  }}t         j"                  j$                  j5                  ||      r1t7        |t         j8                        rH|j                  r<t        j                  d| dd	
       ||v r||   }n|j                         }|||<   |}t+        |||t,        j.                          |j                  j:                  D ]/  }t+        | j                  |      ||t,        j<                  d       1 |S )Nr   c                      t              S r    )r   r=   r>   module_typess     r$   <lambda>z/_create_stateful_graph_module.<locals>.<lambda>  s     L!
 r&   T)with_kwargsc                      t              S r    )r   r  s     r$   r  z/_create_stateful_graph_module.<locals>.<lambda>  s     K!
 r&   )always_callzA model attribute `z` requires gradient. but it's not properly registered as a parameter. torch.export will detach it and treat it as a constant tensor but please register it as parameter instead.r   )
stacklevelr   r   z` requires gradient but it's not properly registered as a parameter. torch.export will detach it and treat it as a constant tensor but please register it as parameter instead.Fr   )r   r   r   r   example_inputsregister_forward_pre_hookr   register_forward_hookr   r   
get_bufferrequires_gradr   warndetachrsplitrs   fxgraph_module_get_attr_via_attr_listdelattrr   r   r   r   rJ   	_has_attr
isinstanceTensorr   r   )r  r   r  stateful_gm"original_tensor_to_detached_tensorconstant_fqnbufferdetached_bufferprefixfieldsubmod
const_namer   detached_valuer  s                 @r$   _create_stateful_graph_moduler%    sf   
 '..  + / K 7r7H7HIL))	

 )))t *  %%	
 	 &  *,& **BB V ''5MM%l^ 4? @  %mmoO9H.v6$F%,,S1&&>>{FSV[,)BTBTU+V0  \\//1 
Exx$$..{JG%.&&MM-j\ :G H $%  BB B5 I).DR:5A .#,,	#6 $$;; 
))&1&&	

 r&   c                     | \  }} |j                   |i |}|j                          |j                  }t        j                  |      }|D cg c]  \  }}|	 c}}S c c}}w )z
    Generate paths of placeholders, needed for generating the guards function.

    NOTE: Here we make use of the example inputs used for export as well as
    the signature of the unlifted graph module (not preserved by export).
    )bindapply_defaults	argumentsr:   tree_leaves_with_path)	r  r\   r=   r>   bindedctxflat_example_inputs_with_pathsrP   rW   s	            r$   _get_input_pathsr.  H  sb     "LD&Y^^T,V,F



C%+%A%A#%F" >?WT1D???s   A
result_strflat_input_pathsc                     i }t        |      D ]$  \  }}dt        j                  |       |d| d<   & | }|j                         D ]  \  }}|j	                  ||      } |S )zz
    Given user specified input paths, maybe fix up the guard string
    to reflect user path instead of tracer path.
    rE   rF   rG   )rH   r:   rI   rJ   rK   )r/  r0  rN   rO   rP   rK   rn   vals           r$   _replace_sourcesr3  X  s    
 L/0 K	T34V]]45H4I1Jse1-.K G &&( ,S//#s+,Nr&   placeholdersr   paths_for_placeholdersc                 n   g g i fd}t        | |      D ]  \  }}dt        j                  |      z   }|j                  d   }t	        |t
              rj                  | d|        t	        |t              rh|t        j                  k(  rj                  | d       |t        j                   k(  rj                  | d       j                  | d|        t	        |t              rj                  | d| d       t	        |t        j                        r7|j                  j                  v r ||j                  j                  |       Et	        |t        j                        sat!        |j"                        D ]  \  }}	dt        j                  |      z   d	| d
z   }t	        |	t
              rj                  | d|	        Lt	        |	t        j                        sg|	j                  j                  v s ||	j                  j                  |         i }
t        j$                  j&                  j(                  j+                         }D ]  \  }}t-        t/        |j0                              }|v r)||
v rY|j3                  |
      }j                  |j5                  t7        j8                  |t7        j:                  |                         t=        t7        j8                  |t7        j:                  |            |      }||d   }||
|<    S )aX  
    Guards generated by the tracer include conditions observed in code, but
    but do not include some additional checks we typically do in export.
    For example, when dynamic shapes get specialized, are specified to be
    within a range, or are specified to be in some equational relation,
    corresponding input invalidation is done within a pre_hook, specifically,
    `_check_input_constraints_for_graph`.

    Here we generate guards corresponding to the checks that happen in
    `_check_input_constraints_for_graph`, and add them to the guards already
    generated by the tracer. In the future, it may be worthwhile to separate
    them so that we can allow clients to turn off one but not the other.
    (Looking at you, AOTI.)

    NOTE: We should eventually reconcile this logic with `build_guards` that
    is used by AOT Precompile.
    c                 R   t        | j                        dk(  rj                  || f       | v r|    }j                  | d|        y || <   t        |          \  }}|dkD  rj                  | d|        |t        j
                  k  rj                  | d|        y y )Nr    == r   z >= z <= )r   free_symbolsrL   r	   mathinf)	exprsrcorig_srcmin_valmax_valdeferred_expressionsrQ   r   sourcess	        r$   handle_symintz2_get_input_guards_for_graph.<locals>.handle_symint  s    t  !Q& !''d47? t}H""cU$xj#9:GDM45Ft5LMGW{&&#d7)'<=!&&#d7)'<= "r&   rE   r2  r8  z == math.infz == -math.infz == ''z.size()[rG   r   )r5   r:   rI   r   r  intrL   floatr:  r;  r!   rs   SymIntr   r<  r  rH   shapeutils_sympyprintersPythonPrinternextiterr9  subsdoprintsympyEqSymbolr   )r4  r   r5  rC  r   rP   r=  r   r   dimunification_map
py_printerr<  symbolsubstitutionsolution
definitionrA  rQ   rB  s    `               @@@r$   _get_input_guards_for_graphr[  g  s   . O%'G>* !/EF 6TFMM$''&dC ""cU$tf#56dE"txx&&#l';<$(("&&#m'<=&&#d4&'9:c"""cU%vQ#78ell+		BS0S$))..#.ell+#DJJ/ 	63FMM$//HQCq/Ac3'#**cU$se+<=sELL1chhmmGX6X "#((--5	6'6< 79O##,,::<J * 5	Td4,,-.W  _$  99_5L""""588L%,,s:K#LM !$S0A!BFKH#%a[
*4'154 r&   c                      g d} t        j                         $t        fd| D              ryj                  $y)N)
executorchmodaion_device_aitorchaoc              3   N   K   | ]  }|j                   j                  v   y wr    )f_codeco_filename)r*   rP   frames     r$   r.   z,_ok_to_generate_guards_fn.<locals>.<genexpr>  s      EDtu||///Es   "%FT)inspectcurrentframeanyf_back)patternsrd  s    @r$   _ok_to_generate_guards_fnrj    sG    H   "E

EHEE 

 r&   c                 |
   |xr
 t               }| j                  j                  D ci c]  }|j                  dk7  s|j                  |! }}| j                  j                  D ci c]  }|j                  dk(  s|j
                  |! }}t        j                  j                  | j                  t        j                  | j                              }|j                  j                  | j                  j                         t        j                  |       } || _        | j                  d   j                   dk7  rt#        |       } t%        || j&                  | j(                  | j*                         | j,                  d   j.                  x}r|j0                  nd }| j&                  j2                  D cg c]Z  }|j4                  t6        j8                  t6        j:                  t6        j<                  t6        j>                  fv r|j
                  nd \ }	}| j&                  j@                  D 
cg c]K  }
|
j4                  tB        jD                  tB        jF                  tB        jH                  fv r|
j
                  nd M }}
|j                  j                  D ]  }d }|j                  dk(  r|jK                  |j
                        }n)|j                  |v r|jK                  |j                        }tM        |dtN        jP                        g|j                  d<    | jR                  jT                  J tW        ||	|| jR                  jT                  | jR                  jX                  |      }t[        || j\                  |       }|j                  j                  | j                  j                         |j                  }|j_                  d      }|rN|rK| j`                  r>tc        j.                  |jd                        }tg        | j`                  |      }g }| jh                  D ]  }|jk                  tm        ||              to        || j\                  |      }tq        | jh                  |      }ts        ||      }|ju                  |       tw        ||      |_<        t        j                  jz                  j}                  |      }|j                  |d         5  |j                  d	t        |            }||j                  d
<   d d d        |j                          |S c c}w c c}w c c}w c c}
w # 1 sw Y   /xY w)Nr   r   TRAININGzExportedProgram.module()r   )r   r   r   nn_module_stack)Crj  r   r   r   r   targetrs   r  GraphModuler  copydeepcopyr   rY   _graph_module	verifiersdialectr   r   r   r   r   module_call_graphr\   r   input_specskindr   r   CONSTANT_TENSORr   
CUSTOM_OBJoutput_specsr   BUFFER_MUTATIONUSER_INPUT_MUTATIONPARAMETER_MUTATIONr"   r   r   r   	call_specr8   r   r   r%  r   r   r  re  rv   r.  _guards_coderL   r3  r[  rU   rc   r   r   r   _utils#first_call_function_nn_module_stackr   call_moduler   r   )r  check_guardsr   source_node_dictplaceholder_source_node_dictr   sigr   r8   r   r   r   source_node	unlift_gmr   r4  rM   	ep_guardsrR   rd   rC   root_nn_module_stacks                         r$   &_unlift_exported_program_lifted_statesr    s     ?$=$?L %'HHNN dgg6N		4 
 ')hhnn$"=8PT$  $ XX!!"//4==3JKF
KKr++,	2BB 
||A*,"2&fb&8&8"--V)+)=)=a)@)J)J"J#"JQU  ))55'  ||  ))##$$	 NN 'M '4 **77)  }}**..-- OO )O ) "" 
77m#6::4;;GKyy,,.22499=* ''"
		+
 <<+++

+F .fb6J6JBOINN"//../ OOE##}#5L):):	 1 12&
 	__ 	CE-e[AB	C 2"..
 32??KP2>3G>*9+{S	$xxRR 
 ""<#34 	@$$\53FGD+?DII'(	@ 	m$"')X	@ 	@s0   TT%T#:T#1AT(*AT-+T22T;c                       e Zd ZdZd Zy)rr   z+
    Module class for guard functions.
    c                      y r    r)   )r   r=   s     r$   rv   zGuardsFn.forwardm  s    r&   N)r   r   r   r   rv   r)   r&   r$   rr   rr   h  s    r&   rr   r    )T)Urq  re  r:  r   collections.abcr   	itertoolsr   typingr   rQ  rs   torch.utils._pytreerI  _pytreer:   torch._export.non_strict_utilsr   r   r   @torch._export.passes.add_runtime_assertions_for_constraints_passr	   torch._export.utilsr
   torch.export.unflattenr   r   "torch.fx.experimental.proxy_tensorr   torch.fx.graphr   r   torch.fx.tracebackr   r   torch.utils._sympy.solver   torch.utils._sympy.value_rangesr   _remove_effect_tokens_passr   _tree_utilsr   exported_programr   r   r   r   TreeSpecboolr7   listrB   r!   rU   rc   KeyPathr   rt   disabler   r   r  rp  r   r0   Noder   r   r   r   r   r/   r   r   r%  r.  r3  rS  r[  rj  r  nnModulerr   r)   r&   r$   <module>r     s       $     $ $ 
 C : P 6 ; . 7 = ' 4&// 4&// 4d 4<v 4 &d3i . d3i  FHcH/HV  @&&5&5C$J'&5 4UXX]]"#T#uxx}}*<%==>&5R4
4
cDj)4
  UXX]] 234
 S%((--/0	4

 
4
t +/__oo$ Cy4' 	L +/  C$J'  cDj)  __	 
 oo$  Cy4' F&
HH  &
)&
 S#X&
 CH~	&

 
&
R
$ 
$$588//;V $d,,d 	d 	dN@  S	 luxx}}%lELL+56l !0l^* '+{{
XX{|uxx r&   