
    9ip                         S SK r S SKJr  S SKJr  S/rS\ R                  R                  S\\ R                  S4   S\ R                  R                  4S	 jr
g)
    N)constant_fold)freezing_passeslower_pt2e_quantized_to_x86modelexample_inputs.returnc                     S nS n[         R                  R                  XSS9R                  U" 5       5      R	                  5       nU" U5        [        XA5        [        U5        U$ )zLower a PT2E-qantized model to x86 backend.

Args:
* `model` (torch.fx.GraphModule): a model quantized by PT2E quantization flow.
* `example_inputs` (tuple[torch.Tensor, ...]): example inputs for the model.

Return:
A GraphModule lowered to x86 backend.
c                      [         R                  R                  5       n [        U R	                  5       5       H5  n[         R
                  R                  R                  U5      (       a  M3  X	 M7     U $ )N)torchexportdefault_decompositionslistkeys_exportutils
_is_cia_op)decomp_tableks     c/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/torch/ao/quantization/pt2e/lowering.py_post_autograd_decomp_table@lower_pt2e_quantized_to_x86.<locals>._post_autograd_decomp_table   sV    ||::< l'')*A==&&11!44 O +     c                    [         R                  R                  nU R                  nUR                   H  nUR
                  UR                  R                  :X  d  M)  UR                  U5         UR                  S   nSS/nUR                  UR                  R                  XE4S9nUR                  U5        UR                  U5        S S S 5        M     UR                  5         U R                  5         g ! , (       d  f       M  = f)Nr      )args)r   opsatengraphnodestargettdefaultinserting_beforer   call_functionpermutereplace_all_uses_with
erase_nodelint	recompile)mr   gnodexdims	perm_nodes          r   _node_replace2lower_pt2e_quantized_to_x86.<locals>._node_replace$   s    yy~~GGGGD{{dffnn,''-		!Aq6D !0D0DA9 UI..y9LL& .-  	
	 .-s   -AC55
D	T)strict)r   r   export_for_trainingrun_decompositionsmoduler   r   )r   r   r   r0   lowered_models        r   r   r      s`    	" 	((t(L		79	:	 
 - M2- r   )r    torch._inductor.constant_foldingr   +torch._inductor.fx_passes.freezing_patternsr   __all__fxGraphModuletupleTensorr    r   r   <module>r?      s[     : G "
1881%,,+,1 XX1r   