o
    ;Î®cß  ã                   @   s  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 d dlmZmZ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 d dlmZmZ d dlmZ d dl m!Z!m"Z"m#Z# d dl$m%Z%m&Z& d dl'm(Z( d dl)m*Z* d dl+m,Z, d dl-m.Z.m/Z/ d dl0m1Z1m2Z2 d dl3m4Z4m5Z5 d dl6m7Z7 eeedœZ8ee!eedœZ9e9 :e8¡ i de“de“de“de#“de
“de
“de“d e“d!e“d"e“d#e&“d$e“d%e5“d&e(“d'e“d(e“d)e“e/e*ee2d*œ¥Z;e; :e8¡ eeeeeeeee.e%ee"e4ee1d+œZ<d,d-„ Z=d.d/„ Z>d0d1„ Z?d2S )3é   )ÚQDQRemovableActivationÚQLinearActivation)ÚQArgMax)ÚAttentionQuant©ÚQuantOperatorBase)ÚQLinearBinaryOp)ÚQLinearConcat)ÚConvIntegerÚQDQConvÚQLinearConv)ÚDirect8BitOpÚQDQDirect8BitOp)ÚEmbedLayerNormalizationQuant)ÚGatherQuantÚ	QDQGather)ÚQGlobalAveragePool)ÚQDQGemmÚQLinearGemm)Ú	LSTMQuant)ÚMatMulIntegerÚ	QDQMatMulÚQLinearMatMul)Ú
QDQMaxPoolÚQMaxPool)ÚQPad)ÚQLinearPool)ÚQDQOperatorBase)Ú	QDQResizeÚQResize)Ú
QDQSoftmaxÚQLinearSoftmax)ÚQDQSplitÚQSplit)ÚQuantizationMode)ÚGatherÚ	TransposeÚEmbedLayerNormalization)ÚConvÚMatMulÚ	AttentionÚLSTMÚArgMaxr(   ÚGemmr)   ÚAddÚMulÚReluÚClipÚ	LeakyReluÚSigmoidÚMaxPoolÚGlobalAveragePoolÚSplitÚPadÚReshapeÚSqueezeÚ	Unsqueeze)ÚResizeÚAveragePoolÚConcatÚSoftmax)r(   r-   r1   r0   r8   r&   r9   r:   r;   r4   r<   r)   r6   r%   r>   c                 C   s
   t | |ƒS ©Nr   ©Úonnx_quantizerÚnode© rC   úH/tmp/pip-target-vg8gfxp4/lib/python/onnxruntime/quantization/registry.pyÚCreateDefaultOpQuantizerR   s   
rE   c                 C   sH   | j tjkrtnt}|j| ¡ v r||j | |ƒ}| ¡ r|S t| |ƒS r?   )	Úmoder$   Ú
IntegerOpsÚIntegerOpsRegistryÚQLinearOpsRegistryÚop_typeÚkeysÚshould_quantizer   )rA   rB   ÚregistryÚop_quantizerrC   rC   rD   ÚCreateOpQuantizerV   s   
rO   c                 C   s(   |j t ¡ v rt|j  | |ƒS t| |ƒS r?   )rJ   ÚQDQRegistryrK   r   r@   rC   rC   rD   ÚCreateQDQQuantizer_   s   
rQ   N)@Úoperators.activationr   r   Úoperators.argmaxr   Úoperators.attentionr   Úoperators.base_operatorr   Úoperators.binary_opr   Úoperators.concatr	   Úoperators.convr
   r   r   Úoperators.direct_q8r   r   Úoperators.embed_layernormr   Úoperators.gatherr   r   Úoperators.gavgpoolr   Úoperators.gemmr   r   Úoperators.lstmr   Úoperators.matmulr   r   r   Úoperators.maxpoolr   r   Úoperators.padr   Úoperators.poolingr   Úoperators.qdq_base_operatorr   Úoperators.resizer   r   Úoperators.softmaxr    r!   Úoperators.splitr"   r#   Úquant_utilsr$   ÚCommonOpsRegistryrH   ÚupdaterI   rP   rE   rO   rQ   rC   rC   rC   rD   Ú<module>   s¸    ýü
ÿþýüûúùø	÷
öõôóòñðïë
ñ	