Ë
    g^(hÞm  ã                   ól  — d dl mZ d dlmZ d dl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 d dlmZmZmZmZ d d	lmZ d d
lmZ dgZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z d„ Z!d„ Z"d„ Z#d„ Z$d„ Z%d„ Z&d„ Z'd„ Z(d„ Z)d„ Z*d„ Z+d„ Z,d ejZ                  j*                  fd!„Z.e G d"„ d#«      «       Z/d$ed%efd&„Z0y)'é    )Ú	dataclass)Úpartial)ÚAnyÚCallableÚOptionalN)Ú	out_dtype)Úquantized_decomposed_lib)Ú_WrapperModule)Ú"_get_aten_graph_module_for_patternÚ,_replace_literals_with_existing_placeholdersÚ'_replace_literals_with_new_placeholdersÚ"remove_tensor_overload_for_qdq_ops)ÚGraphModule)Úreplace_patternÚ reference_representation_rewritec                 óØ  — t         j                  j                  j                  | ||||t         j                  «      }t         j                  j                  j                  |||||	t         j                  «      }t         j                  j
                  j                  j                  |||
«      }t         j                  j                  j                  |||||t         j                  «      }|S ©N)	ÚtorchÚopsÚquantized_decomposedÚdequantize_per_tensorÚint8ÚatenÚlinearÚdefaultÚquantize_per_tensor)Úx_i8Úx_scaleÚx_zero_pointÚx_quant_minÚx_quant_maxÚ	weight_i8Úweight_scaleÚweight_zero_pointÚweight_quant_minÚweight_quant_maxÚ	bias_fp32Ú	out_scaleÚout_zero_pointÚout_quant_minÚout_quant_maxÚx_fp32Úweight_fp32Úout_fp32Úout_i8s                      úo/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/torch/ao/quantization/pt2e/representation/rewrite.pyÚ_qdq_quantized_linearr1      s·   € ô" �Y‰Y×+Ñ+×AÑAØˆg�| [°+¼u¿z¹zó€Fô —)‘)×0Ñ0×FÑFØØØØØÜ�
‰
ó€Kô �y‰y�~‰~×$Ñ$×,Ñ,¨V°[À)ÓL€HÜ�Y‰Y×+Ñ+×?Ñ?Ø�)˜^¨]¸MÌ5Ï:É:ó€Fð €Mó    c                 ó¢  — t         j                  j                  j                  | ||«      } t         j                  j                  j                  |||	«      }| j	                  t         j
                  «      }|j	                  t         j
                  «      }t        t         j                  j                  j                  j                  t         j                  ||z
  ||z
  d «      }||z  }t        t         j                  j                  j                  j                  t         j                  |
|«      }||z   }t        t         j                  j                  j                  j                  t         j                  |||z  |z  «      |z   }t         j                  j                  j                  |||«      j	                  t         j                  «      }|S r   )r   r   r   ÚclampÚtoÚint16r   r   r   Úint32ÚdivÚTensorÚmulr   )r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   Úx_i16Ú
weight_i16Úacc_i32Ú
bias_scaleÚbias_i32r/   s                        r0   Ú_reference_quantized_linearr@   <   sW  € ô( �9‰9�>‰>×Ñ  k°;Ó?€DÜ—	‘	—‘×$Ñ$ YÐ0@ÐBRÓS€Ià�G‰G”E—K‘KÓ €EØ—‘œeŸk™kÓ*€Jô Ü�	‰	�‰×Ñ×%Ñ%Ü�‰Ø�ÑØÐ&Ñ&Øó€Gð ˜<Ñ'€JÜœŸ™Ÿ™×+Ñ+×2Ñ2´E·K±KÀÈJÓW€HØ˜Ñ €Gô 	Ü�I‰I�N‰N×Ñ×%Ñ%Ü�K‰KØØ�lÑ" YÑ.ó		
ð ñ	ð ô �Y‰Y�^‰^×!Ñ! '¨=¸-ÓH×KÑKÌEÏJÉJÓW€FØ€Mr2   c
                 óT  — t         j                  j                  j                  | |||t         j                  «      \  }
}t         j                  j                  j                  | |
|||t         j                  «      }t         j                  j                  j                  ||
|||t         j                  «      } t         j                  j                  j                  |||||t         j                  «      }t         j                  j                  j                  j                  | ||	«      }|S r   )
r   r   r   Úchoose_qparamsr   r   r   r   r   r   )r,   r    r!   Úx_epsr"   r#   r$   r%   r&   r'   r   r   r   r-   r.   s                  r0   Ú_qdq_dynamic_quantized_linearrD   q   sç   € ô "ŸI™I×:Ñ:×IÑIØ�˜[¨%´·±óÑ€Gˆ\ô �9‰9×)Ñ)×=Ñ=Ø�˜ {°KÄÇÁó€Dô �Y‰Y×+Ñ+×AÑAØˆg�| [°+¼u¿z¹zó€Fô —)‘)×0Ñ0×FÑFØØØØØÜ�
‰
ó€Kô �y‰y�~‰~×$Ñ$×,Ñ,¨V°[À)ÓL€HØ€Or2   c
                 ó’  — t         j                  j                  j                  | |||t         j                  «      \  }
}| |
z  } t        j
                  | «      } | j                  t         j                  ¬«      }||z   }t        j                  |||«      }|j                  t         j                  ¬«      }t         j                  j                  j                  |||«      }|j                  t         j                  «      }|j                  t         j                  «      }t        t         j                  j                  j                  j                  t         j                  ||z
  ||z
  d «      }|
|z  }t        t         j                  j                  j                  j                  t         j                  |	|«      }||z   }||
|z  z  }|S ©N©Údtype)r   r   r   rB   r   Úroundr5   r7   r4   r   r6   r   r   r   r8   r9   )r,   r    r!   rC   r"   r#   r$   r%   r&   r'   r   r   Úx_i32r   r;   r<   r=   r>   r?   r.   s                       r0   Ú#_reference_dynamic_quantized_linearrK   ’   sd  € ô "ŸI™I×:Ñ:×IÑIØ�˜[¨%´·±óÑ€Gˆ\ð
 �gÑ€Fô �[‰[˜Ó €FØ�I‰IœEŸK™KˆIÓ(€EØ�LÑ €Eä�K‰K˜˜{¨KÓ8€EØ�8‰8œ%Ÿ*™*ˆ8Ó%€Dä—	‘	—‘×$Ñ$ YÐ0@ÐBRÓS€Ià�G‰G”E—K‘KÓ €EØ—‘œeŸk™kÓ*€Jô Ü�	‰	�‰×Ñ×%Ñ%Ü�‰Ø�ÑØÐ&Ñ&Øó€Gð ˜<Ñ'€JÜœŸ™Ÿ™×+Ñ+×2Ñ2´E·K±KÀÈJÓW€HØ˜Ñ €GØ˜' LÑ0Ñ1€HØ€Or2   c                 ó  — ddg}ddg}ddg}d}ddg}d}t         j                  j                  j                  | ||||t         j                  «      }t         j                  j                  j                  |||||	t         j                  «      }t         j                  j
                  j                  j                  |||
||||||«	      }t         j                  j                  j                  |||||t         j                  «      }|S ©Né   r   F)	r   r   r   r   r   r   Úconvolutionr   r   )r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   ÚstrideÚpaddingÚdilationÚ
transposedÚoutput_paddingÚgroupsr,   r-   r.   r/   s                            r0   Ú_qdq_quantized_conv2drV   Á   sþ   € ð" �ˆV€FØ�!ˆf€GØ�1ˆv€HØ€JØ˜�V€NØ€FÜ�Y‰Y×+Ñ+×AÑAØˆg�| [°+¼u¿z¹zó€Fô —)‘)×0Ñ0×FÑFØØØØØÜ�
‰
ó€Kô �y‰y�~‰~×)Ñ)×1Ñ1ØØØØØØØØØó
€Hô �Y‰Y×+Ñ+×?Ñ?Ø�)˜^¨]¸MÌ5Ï:É:ó€Fð €Mr2   c                 ó  — ddg}ddg}ddg}d}ddg}d}t         j                  j                  j                  | ||«      } t         j                  j                  j                  |||	«      }| j	                  t         j
                  «      }|j	                  t         j
                  «      }t        t         j                  j                  j                  j                  t         j                  ||z
  ||z
  d ||||||«      }||z  }t        t         j                  j                  j                  j                  t         j                  |
|«      }|j                  d«      }|j                  d«      }||z   }t        t         j                  j                  j                  j                  t         j                  |||z  |z  «      |z   }t         j                  j                  j                  |||«      j	                  t         j                  «      }|S )NrN   r   Féÿÿÿÿ)r   r   r   r4   r5   r6   r   rO   r   r7   r8   r9   Ú	unsqueezer:   r   )r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   rP   rQ   rR   rS   rT   rU   r;   r<   r=   r>   r?   r/   s                              r0   Ú_reference_quantized_conv2drZ   ô   s½  € ð" �ˆV€FØ�!ˆf€GØ�1ˆv€HØ€JØ˜�V€NØ€Fô �9‰9�>‰>×Ñ  k°;Ó?€DÜ—	‘	—‘×$Ñ$ YÐ0@ÐBRÓS€Ià�G‰G”E—K‘KÓ €EØ—‘œeŸk™kÓ*€Jô Ü�	‰	�‰×"Ñ"×*Ñ*Ü�‰Ø�ÑØÐ&Ñ&ØØØØØØØó€Gð ˜<Ñ'€Jô œŸ™Ÿ™×+Ñ+×2Ñ2´E·K±KÀÈJÓW€Hð ×!Ñ! "Ó%€HØ×!Ñ! "Ó%€HØ˜Ñ €Gô 	Ü�I‰I�N‰N×Ñ×%Ñ%Ü�K‰KØØ�lÑ" YÑ.ó		
ð ñ	ð ô �Y‰Y�^‰^×!Ñ! '¨=¸-ÓH×KÑKÌEÏJÉJÓW€FØ€Mr2   c
                 óÊ  — t         j                  j                  j                  | ||||	t         j                  «      }
t         j                  j                  j                  |||||	t         j                  «      }|
|z   }t         j                  j
                  j                  |«      }t         j                  j                  j                  |||||	t         j                  «      }|S r   )r   r   r   r   r   r   Úrelur   ©r   r   r   Úy_i8Úy_scaleÚy_zero_pointr(   r)   Ú	quant_minÚ	quant_maxr,   Úy_fp32r.   r/   s                 r0   Ú_qdq_quantized_add_relurd   F  s±   € ô �Y‰Y×+Ñ+×AÑAØˆg�| Y°	¼5¿:¹:ó€Fô �Y‰Y×+Ñ+×AÑAØˆg�| Y°	¼5¿:¹:ó€Fð ˜‰€HÜ�y‰y�~‰~×"Ñ" 8Ó,€HÜ�Y‰Y×+Ñ+×?Ñ?Ø�)˜^¨Y¸	Ä5Ç:Á:ó€Fð €Mr2   c
                 óZ  — | j                  t        j                  «      }
|j                  t        j                  «      }t        t        j                  j
                  j                  j                  t        j                  |
|z
  ||z  «      }
t        t        j                  j
                  j                  j                  t        j                  ||z
  ||z  «      }|
|z   |z   }t        j                  j
                  j                  |||	«      j                  t        j                  «      }|S )z�
    See comments for `_reference_quantized_add` for more information on
    how to derive the formula for out_i8 based on x_i8 and y_i8
    )
r5   r   r7   r   r   r   r:   r9   r4   r   ©r   r   r   r^   r_   r`   r(   r)   ra   rb   rJ   Úy_i32Úout_i32r/   s                 r0   Ú_reference_quantized_add_reluri   `  sÚ   € ð  �G‰G”E—K‘KÓ €EØ�G‰G”E—K‘KÓ €EäÜ�	‰	�‰×Ñ×!Ñ!Ü�‰Ø	�Ñ	Ø	�9Ñ	ó	€Eô Ü�	‰	�‰×Ñ×!Ñ!Ü�‰Ø	�Ñ	Ø	�9Ñ	ó	€Eð �e‰m˜nÑ,€Gä�Y‰Y�^‰^×!Ñ! '¨>¸9ÓE×HÑHÌÏÉÓT€FØ€Mr2   c
                 óx  — t         j                  j                  j                  | ||||	t         j                  «      }
t         j                  j                  j                  |||||	t         j                  «      }|
|z   }t         j                  j                  j                  |||||	t         j                  «      }|S r   )r   r   r   r   r   r   r]   s                 r0   Ú_qdq_quantized_addrk   …  s™   € ô �Y‰Y×+Ñ+×AÑAØˆg�| Y°	¼5¿:¹:ó€Fô �Y‰Y×+Ñ+×AÑAØˆg�| Y°	¼5¿:¹:ó€Fð ˜‰€HÜ�Y‰Y×+Ñ+×?Ñ?Ø�)˜^¨Y¸	Ä5Ç:Á:ó€Fð €Mr2   c
                 ó  — | j                  t        j                  «      }
|j                  t        j                  «      }t        j                  ||z  |
|z
  z  «      j                  t        j                  «      }
t        j                  ||z  ||z
  z  «      j                  t        j                  «      }|
|z   |z   }d}d}	t        j                  j
                  j                  |||	«      j                  t        j                  «      }|S )a  
        # How to Derive the formula for out_i8 based on x_i8 and y_i8
        # (since quantized add takes x_i8, y_i8 and their quantization parameters, and produce an out_i8)

        # out_i8 is quantized output, we can write down the formula for it first:
    out_i8 = out_f32 / out_scale + out_zero_point           (1)

        # then out_fp32 is computed from x_f32 + y_f32, and the x_fp32 and y_fp32 are the dequantized x_i8 and y_i8
        out_f32 = x_f32 + y_f32           (2)
        x_fp32 = (x_i8 - x_zero_point) * x_scale         (3)
        y_fp32 = (y_i8 - y_zero_point) * y_scale         (4)

        # applying the above fomula to the out_i8 equation we can get the following:
        out_i8 = out_fp32 / out_scale + out_zero_point             # (1)
           = (x_f32 + y_f32) / out_scale + out_zero_point      # applying (2) to substitute out_fp32 with x_fp32 + y_fp32
           = ((x_i8 - x_zero_point) * x_scale + (y_i8 - y_zero_point) * y_scale) / out_scale + out_zero_point  # apply (3) and (4)
    é€ÿÿÿé   )r5   r   r7   rI   r   r   r4   r   rf   s                 r0   Ú_reference_quantized_addro   ž  sÈ   € ð: �G‰G”E—K‘KÓ €EØ�G‰G”E—K‘KÓ €Eä�K‰K˜ 9Ñ,°¸Ñ1EÑFÓG×JÑJÌ5Ï;É;ÓW€EÜ�K‰K˜ 9Ñ,°¸Ñ1EÑFÓG×JÑJÌ5Ï;É;ÓW€EØ�e‰m˜nÑ,€GØ€IØ€IÜ�Y‰Y�^‰^×!Ñ! '¨9°iÓ@×CÑCÄEÇJÁJÓO€FØ€Mr2   c	                 ó€  — d}	d}
d}d}d}t         j                  j                  j                  | ||||t         j                  «      }t         j                  j
                  j                  j                  ||	|
|||«      \  }}t         j                  j                  j                  |||||t         j                  «      }|S rM   )	r   r   r   r   r   r   Úmax_pool2d_with_indicesr   r   )r   r   r   r    r!   r(   r)   r*   r+   Úkernel_sizerP   rQ   rR   Ú	ceil_moder,   r.   Ú_r/   s                     r0   Ú_qdq_quantized_max_pool2dru   Ç  s­   € ð €KØ€FØ€GØ€HØ€IÜ�Y‰Y×+Ñ+×AÑAØˆg�| [°+¼u¿z¹zó€Fô —)‘)—.‘.×8Ñ8×@Ñ@Ø�˜V W¨h¸	ó�K€Hˆaô �Y‰Y×+Ñ+×?Ñ?Ø�)˜^¨]¸MÌ5Ï:É:ó€Fð €Mr2   c	                 ó„  — d}	d}
d}d}d}t        j                  | ||«      } | j                  t         j                  «      }t         j                  j
                  j                  j                  ||z
  |	|
|||«      \  }}|||z  z  |z   }t        j                  |||«      }|j                  t         j                  «      }|S rM   )	r   r4   r5   r7   r   r   rq   r   r   )r   r   r   r    r!   r(   r)   r*   r+   rr   rP   rQ   rR   rs   rJ   rh   rt   r.   r/   s                      r0   Ú_reference_quantized_max_pool2drw   ã  s´   € ð €KØ€FØ€GØ€HØ€Iä�;‰;�t˜[¨+Ó6€DØ�G‰G”E—K‘KÓ €EÜ—‘—‘×7Ñ7×?Ñ?Ø�Ñ˜k¨6°7¸HÀió�J€GˆQð ˜' IÑ-Ñ.°Ñ?€HÜ�{‰{˜8 ]°MÓB€HØ�[‰[œŸ™Ó$€FØ€Mr2   c                 ó~   — t         j                  j                  j                  | ||||t         j                  «      }|S r   )r   r   r   r   r   ©r,   ÚscaleÚ
zero_pointra   rb   Úxs         r0   Ú_quantize_per_tensor_int8r}   ÿ  s4   € Ü�	‰	×&Ñ&×:Ñ:Ø��z 9¨i¼¿¹ó	€Að €Hr2   c                 óò   — | |z  }t        j                  |«      }|j                  t         j                  ¬«      }||z   }t        j                  |||«      }|j                  t         j
                  ¬«      }|S rF   )r   rI   r5   r7   r4   r   ry   s         r0   Ú#_reference_quantize_per_tensor_int8r     sd   € ð 	�‰€Aô 	�‰�A‹€AØ	�‰”5—;‘;ˆÓ€AØ	ˆJ‰€Aä�‰�A�y )Ó,€AØ	�‰”5—:‘:ˆÓ€AØ€Hr2   c                 ó~   — t         j                  j                  j                  | ||||t         j                  «      }|S r   )r   r   r   r   r   )r   rz   r{   ra   rb   r,   s         r0   Ú_dequantize_per_tensor_int8r�     s4   € Ü�Y‰Y×+Ñ+×AÑAØˆe�Z ¨I´u·z±zó€Fð €Mr2   c                 óÞ   — t         j                  j                  j                  | ||«      } | j	                  t         j
                  «      |z
  |z  j	                  t         j
                  ¬«      S rF   )r   r   r   r4   r5   Úfloat32)r   rz   r{   ra   rb   s        r0   Ú%_reference_dequantize_per_tensor_int8r„     sQ   € ô �9‰9�>‰>×Ñ  i°Ó;€Dð �W‰W”U—]‘]Ó# jÑ0°EÑ9×=Ñ=ÄEÇMÁMÐ=ÓRÐRr2   c           	      ó€   — t         j                  j                  j                  | |||||t         j                  «      }|S r   )r   r   r   Úquantize_per_channelr   )r,   ÚscalesÚzero_pointsÚch_axisra   rb   r/   s          r0   Ú_quantize_per_channel_int8rŠ   *  s8   € ô �Y‰Y×+Ñ+×@Ñ@Ø�˜ W¨i¸ÄEÇJÁJó€Fð €Mr2   c                 ó^  — t        j                  | |d«      } t         j                  j                  j	                  t        j
                  | |z  «      j                  t         j                  «      |z   ||«      }t        j                  ||d«      }|j                  t         j                  «      S ©NrX   )	r   Ú	transposer   r   r4   rI   r5   r7   r   )r,   r‡   rˆ   r‰   ra   rb   rh   s          r0   Ú$_reference_quantize_per_channel_int8rŽ   3  s}   € ô �_‰_˜V W¨bÓ1€FÜ�i‰i�n‰n×"Ñ"Ü�‰�F˜V‘OÓ$×'Ñ'¬¯©Ó4°{ÑBÀIÈyó€Gô �o‰o˜g w°Ó3€GØ�:‰:”e—j‘jÓ!Ð!r2   c           	      ó€   — t         j                  j                  j                  | |||||t         j                  «      }|S r   )r   r   r   Údequantize_per_channelr   )r   r‡   rˆ   r‰   ra   rb   r.   s          r0   Ú_dequantize_per_channel_int8r‘   >  s8   € ô �y‰y×-Ñ-×DÑDØˆf�k 7¨I°yÄ%Ç*Á*ó€Hð €Or2   c                 ó@  — t         j                  j                  j                  | ||«      } t        j                  | |d«      } | j                  t         j                  «      }||z
  j                  t         j                  «      |z  }t        j                  ||d«      }|S rŒ   )r   r   r   r4   r�   r5   r7   Úfloat)r   r‡   rˆ   r‰   ra   rb   rJ   r.   s           r0   Ú&_reference_dequantize_per_channel_int8r”   H  sy   € ô �9‰9�>‰>×Ñ  i°Ó;€DÜ�?‰?˜4 ¨"Ó-€DØ�G‰G”E—K‘KÓ €EØ˜Ñ#×'Ñ'¬¯©Ó4°vÑ=€HÜ�‰˜x¨°"Ó5€HØ€Or2   Úgmc                 ó(   — t        | dgddddœ¬«      S )NrX   é   é   é   )rN   rm   rn   )Úexclude_literalsÚliteral_to_ph_idx)r   )r•   s    r0   Ú'_replace_ph_qdq_per_channel_replacementrœ   V  s   € Ü7Ø
˜b˜T¸À!È!Ñ5Lôð r2   c                   óz   — e Zd ZU dZeedf   ed<   eed<   eed<   dZe	ee
ge
f      ed<   dZe	ee
ge
f      ed<   y)	Ú_RewriteInfoz¸Data needed for rewrite, this includes example inputs, pattern and replacement functions
    and post transformation functions for the exported pattern and replacement GraphModule
    .Úexample_inputsÚpatternÚreplacementNÚpattern_post_transÚreplacement_post_trans)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Útupler   Ú__annotations__r   r¢   r   r   r£   © r2   r0   rž   rž   \  s[   … ñð
 ˜#˜s˜(‘OÓ#ØÓØÓàIMÐ˜ ¨;¨-¸Ð*DÑ!EÑFÓMØMQÐ˜H X¨{¨m¸[Ð.HÑ%IÑJÔQr2   rž   ÚmodelÚreturnc                 óD  — t        j                  dddt         j                  ¬«      t        j                  dt         j                  ¬«      t        j
                  dt         j                  ¬«      t        j                  dgt         j                  ¬«      t        j                  dgt         j                  ¬«      t        j                  dddt         j                  ¬«      t        j                  dt         j                  ¬«      t        j
                  dt         j                  ¬«      t        j                  dgt         j                  ¬«      t        j                  dgt         j                  ¬«      t        j                  dt         j                  ¬«      t        j                  dt         j                  ¬«      t        j
                  dt         j                  ¬«      t        j                  dgt         j                  ¬«      t        j                  dgt         j                  ¬«      f}t        j                  dt         j                  ¬«      ddt        j                  t         j                  «      j                  t        j                  dddt         j                  ¬«      t        j                  dt         j                  ¬«      t        j
                  dt         j                  ¬«      t        j                  dgt         j                  ¬«      t        j                  dgt         j                  ¬«      t        j                  dt         j                  ¬«      f
}t        j                  dddt         j                  ¬«      t        j                  dt         j                  ¬«      t        j
                  dt         j                  ¬«      t        j                  dgt         j                  ¬«      t        j                  dgt         j                  ¬«      t        j                  dddt         j                  ¬«      t        j                  dt         j                  ¬«      t        j
                  dt         j                  ¬«      t        j                  dgt         j                  ¬«      t        j                  dgt         j                  ¬«      t        j                  dt         j                  ¬«      t        j                  dt         j                  ¬«      t        j
                  dt         j                  ¬«      t        j                  dgt         j                  ¬«      t        j                  dgt         j                  ¬«      f}t        j                  dddt         j                  ¬«      t        j                  dt         j                  ¬«      t        j
                  dt         j                  ¬«      t        j                  dddt         j                  ¬«      t        j                  dt         j                  ¬«      t        j
                  dt         j                  ¬«      t        j                  dt         j                  ¬«      t        j
                  dt         j                  ¬«      t        j                  dgt         j                  ¬«      t        j                  dgt         j                  ¬«      f
}t        j                  dddt         j                  ¬«      t        j                  dt         j                  ¬«      t        j
                  dt         j                  ¬«      t        j                  dgt         j                  ¬«      t        j                  dgt         j                  ¬«      t        j                  dt         j                  ¬«      t        j
                  dt         j                  ¬«      t        j                  dgt         j                  ¬«      t        j                  dgt         j                  ¬«      f	}t        j                  dd	d	d	t         j                  ¬«      t        j                  dt         j                  ¬«      t        j
                  dt         j                  ¬«      t        j                  dgt         j                  ¬«      t        j                  dgt         j                  ¬«      f}t        j                  dddt         j                  ¬«      t        j                  dt         j                  ¬«      t        j
                  dt         j                  ¬«      t        j                  dgt         j                  ¬«      t        j                  dgt         j                  ¬«      f}t        j                  dd	d	d	t         j                  ¬«      t        j                  d	t         j                  ¬«      t        j
                  d	t         j                  ¬«      dddf}t        j                  dddt         j                  ¬«      t        j                  d	t         j                  ¬«      t        j
                  d	t         j                  ¬«      dddf}	t        |t        t        «      t        t        «      t        t         dddd
t        j                  t         j                  «      j                  d	i¬«      t        t         dddd
t        j                  t         j                  «      j                  d	i¬«      «      t        |t        t"        «      t        t$        «      t&        t&        «      t        |t        t(        «      t        t*        «      t        t&        dg¬«      t        t&        dg¬«      «      t        |t        t,        «      t        t.        «      «      t        |t        t0        «      t        t2        «      «      t        |t        t4        «      t        t6        «      t&        t&        «      t        |t        t8        «      t        t:        «      «      t        |t        t<        «      t        t>        «      «      t        |t        t@        «      t        tB        «      tD        tD        «      t        |	t        tF        «      t        tH        «      tD        tD        «      g
}
tK        | «       |
D ]­  }|jL                  }|jN                  }|jP                  }|jR                  }|jT                  }tW        ||«      }tK        |«       tW        ||«      }tK        |«       |r ||«      }|r ||«      }|jY                  «        |jY                  «        t[        | ||«       Œ¯ | S )Nrm   rn   )é   r™   rG   rN   )r™   r™   i�ÿÿÿ)rN   r—   r—   r—   r—   r®   )r›   rX   )rš   ).r   Úrandintr   Úrandnr“   ÚzerosÚintÚtensorÚfinforƒ   Úepsrž   r
   rD   rK   r   r   r1   r@   r   rV   rZ   rd   ri   rk   ro   ru   rw   r}   r   r�   r„   rŠ   rŽ   rœ   r‘   r”   r   rŸ   r    r¡   r¢   r£   r   Ú	recompiler   )r«   Ú _QUANTIZED_LINEAR_EXAMPLE_INPUTSÚ(_DYNAMIC_QUANTIZED_LINEAR_EXAMPLE_INPUTSÚ _QUANTIZED_CONV2d_EXAMPLE_INPUTSÚ)_QUANTIZED_ADD_OR_ADD_RELU_EXAMPLE_INPUTSÚ$_QUANTIZED_MAX_POOL2D_EXAMPLE_INPUTSÚ(_QUANTIZE_PER_TENSOR_INT8_EXAMPLE_INPUTSÚ*_DEQUANTIZE_PER_TENSOR_INT8_EXAMPLE_INPUTSÚ)_QUANTIZE_PER_CHANNEL_INT8_EXAMPLE_INPUTSÚ+_DEQUANTIZE_PER_CHANNEL_INT8_EXAMPLE_INPUTSÚ_REWRITE_INFO_LISTÚrewrite_inforŸ   r    r¡   r¢   r£   s                    r0   r   r   k  sŽ  € ä�‰�d˜C ¬u¯z©zÔ:Ü�‰�AœUŸ[™[Ô)Ü�‰�AœUŸY™YÔ'Ü�‰�d�V¤5§9¡9Ô-Ü�‰�c�U¤%§)¡)Ô,Ü�‰�d˜C ¬u¯z©zÔ:Ü�‰�AœUŸ[™[Ô)Ü�‰�AœUŸY™YÔ'Ü�‰�d�V¤5§9¡9Ô-Ü�‰�c�U¤%§)¡)Ô,Ü�‰�AœUŸ[™[Ô)Ü�‰�AœUŸ[™[Ô)Ü�‰�AœUŸY™YÔ'Ü�‰�d�V¤5§9¡9Ô-Ü�‰�c�U¤%§)¡)Ô,ð(Ð$ô& 	�‰�F¤%§+¡+Ô.ØØÜ�‰”E—M‘MÓ"×&Ñ&Ü�‰�d˜C ¬u¯z©zÔ:Ü�‰�AœUŸ[™[Ô)Ü�‰�AœUŸY™YÔ'Ü�‰�d�V¤5§9¡9Ô-Ü�‰�c�U¤%§)¡)Ô,Ü�‰�AœUŸ[™[Ô)ð0Ð,ô 	�‰�d˜C ´U·Z±ZÔ@Ü�‰�AœUŸ[™[Ô)Ü�‰�AœUŸY™YÔ'Ü�‰�d�V¤5§9¡9Ô-Ü�‰�c�U¤%§)¡)Ô,Ü�‰�d˜C ´U·Z±ZÔ@Ü�‰�AœUŸ[™[Ô)Ü�‰�AœUŸY™YÔ'Ü�‰�d�V¤5§9¡9Ô-Ü�‰�c�U¤%§)¡)Ô,Ü�‰�AœUŸ[™[Ô)Ü�‰�AœUŸ[™[Ô)Ü�‰�AœUŸY™YÔ'Ü�‰�d�V¤5§9¡9Ô-Ü�‰�c�U¤%§)¡)Ô,ð(Ð$ô& 	�‰�d˜C ´U·Z±ZÔ@Ü�‰�AœUŸ[™[Ô)Ü�‰�AœUŸY™YÔ'Ü�‰�d˜C ´U·Z±ZÔ@Ü�‰�AœUŸ[™[Ô)Ü�‰�AœUŸY™YÔ'Ü�‰�AœUŸ[™[Ô)Ü�‰�AœUŸY™YÔ'Ü�‰�d�V¤5§9¡9Ô-Ü�‰�c�U¤%§)¡)Ô,ð1Ð-ô 	�‰�d˜C ´U·Z±ZÔ@Ü�‰�AœUŸ[™[Ô)Ü�‰�AœUŸY™YÔ'Ü�‰�d�V¤5§9¡9Ô-Ü�‰�c�U¤%§)¡)Ô,Ü�‰�AœUŸ[™[Ô)Ü�‰�AœUŸY™YÔ'Ü�‰�d�V¤5§9¡9Ô-Ü�‰�c�U¤%§)¡)Ô,ð
,Ð(ô 	�‰�A�q˜!˜Q¤e§k¡kÔ2Ü�‰�AœUŸ[™[Ô)Ü�‰�AœUŸY™YÔ'Ü�‰�d�V¤5§9¡9Ô-Ü�‰�c�U¤%§)¡)Ô,ð0Ð,ô 	�‰�d˜C ´U·Z±ZÔ@Ü�‰�AœUŸ[™[Ô)Ü�‰�AœUŸY™YÔ'Ü�‰�d�V¤5§9¡9Ô-Ü�‰�c�U¤%§)¡)Ô,ð2Ð.ô 	�‰�A�q˜!˜Q¤e§k¡kÔ2Ü�‰�AœUŸ[™[Ô)Ü�‰�AœUŸY™YÔ'Ø	ØØð1Ð-ô 	�‰�d˜C ´U·Z±ZÔ@Ü�‰�AœUŸ[™[Ô)Ü�‰�AœUŸY™YÔ'Ø	ØØð3Ð/ô 	Ø4ÜÔ8Ó9ÜÔ>Ó?ÜÜ<Ø#'¨¨C°´E·K±KÄÇÁÓ4N×4RÑ4RÐTUÐ"Vôô Ü<Ø#'¨¨C°´E·K±KÄÇÁÓ4N×4RÑ4RÐTUÐ"Vôó	
ô 	Ø,ÜÔ0Ó1ÜÔ6Ó7Ü3Ü3ó	
ô 	Ø,ÜÔ0Ó1ÜÔ6Ó7ÜÔ;ÈrÈdÔSÜÔ;ÈrÈdÔSó	
ô 	Ø5ÜÔ2Ó3ÜÔ8Ó9ó	
ô
 	Ø5ÜÔ-Ó.ÜÔ3Ó4ó	
ô
 	Ø0ÜÔ4Ó5ÜÔ:Ó;Ü3Ü3ó	
ô 	Ø4ÜÔ4Ó5ÜÔ>Ó?ó	
ô
 	Ø6ÜÔ6Ó7ÜÔ@ÓAó	
ô
 	Ø5ÜÔ5Ó6ÜÔ?Ó@Ü3Ü3ó	
ô 	Ø7ÜÔ7Ó8ÜÔAÓBÜ3Ü3ó	
ð}EÐôN ' uÔ-à*ò 5ˆØ%×4Ñ4ˆØ×&Ñ&ˆØ"×.Ñ.ˆØ)×<Ñ<ÐØ!-×!DÑ!DÐÜ4°W¸nÓMˆÜ*¨7Ô3Ü8¸ÀnÓUˆÜ*¨;Ô7ÙÙ(¨Ó1ˆGÙ!Ù0°Ó=ˆKØ×ÑÔØ×ÑÔÜ˜˜w¨Õ4ð!5ð$ €Lr2   )1Údataclassesr   Ú	functoolsr   Útypingr   r   r   r   Ú!torch._higher_order_ops.out_dtyper   Ú$torch.ao.quantization.fx._decomposedr	   Ú'torch.ao.quantization.pt2e.export_utilsr
   Ú torch.ao.quantization.pt2e.utilsr   r   r   r   Útorch.fxr   Útorch.fx.subgraph_rewriterr   Ú__all__r1   r@   rD   rK   rV   rZ   rd   ri   rk   ro   ru   rw   r}   r   r�   r„   rŠ   rŽ   r‘   r”   Úfxrœ   rž   r   rª   r2   r0   ú<module>rÍ      sñ   ðå !Ý ß *Ñ *ã Ý 7Ý IÝ B÷ó õ !Ý 6ð 'ð€ò
 òF2òjòB,ò^0òfOòdò4"òJò2&òRò8ò8òò ò
Sòò"òòð°·±×0DÑ0Dó ð ÷Rð Ró ðRðH¨Kð H¸Kô Hr2   