U
    “±Ëhï  ã                   @   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! 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/m0Z0m1Z1 d dl2m3Z3m4Z4 d dl5m6Z6m7Z7 d dl8m9Z9m:Z: d dl;m<Z< eeedœZ=ee#ee!dœZ>e> ?e=¡ eeee%e
e
eeeee(ee7e*eeee1e,ee4e:dœZ@e@ ?e=¡ eeeeeeeeee0e'ee$e6ee3e9edœZAdd„ ZBdd „ ZCd!d"„ ZDd#S )$é   )ÚQDQRemovableActivationÚQLinearActivation)ÚQArgMax)ÚAttentionQuant©ÚQuantOperatorBase)ÚQLinearBinaryOp)ÚQLinearConcat)ÚConvIntegerÚQDQConvÚQLinearConv)ÚDirect8BitOpÚQDQDirect8BitOp)ÚEmbedLayerNormalizationQuant)ÚGatherQuantÚ	QDQGather)ÚQGlobalAveragePool)ÚQDQGemmÚQLinearGemm)ÚQDQInstanceNormalization)Ú	LSTMQuant)ÚMatMulIntegerÚ	QDQMatMulÚQLinearMatMul)Ú
QDQMaxPoolÚQMaxPool)ÚQPad)ÚQLinearPool)ÚQDQOperatorBase)Ú	QDQResizeÚQResize)Ú
QDQSoftmaxÚQLinearSoftmax)ÚQDQSplitÚQSplit)ÚQDQWhereÚQLinearWhere)ÚQuantizationMode)ÚGatherÚ	TransposeZEmbedLayerNormalization)ÚConvÚMatMulZ	AttentionZLSTM)ZArgMaxr*   ÚGemmr+   ZAddZMulÚReluÚClipZ	LeakyReluZSigmoidÚMaxPoolZGlobalAveragePoolÚSplitZPadÚReshapeÚSqueezeÚ	UnsqueezeÚResizeÚAveragePoolZConcatÚSoftmaxÚWhere)r*   ZConvTransposer,   r.   r-   r1   r)   r2   r3   r4   r/   r5   r+   r0   r(   r6   r7   ZInstanceNormalizationc                 C   s
   t | |ƒS ©Nr   ©Úonnx_quantizerÚnode© r<   úE/tmp/pip-unpacked-wheel-socb9apf/onnxruntime/quantization/registry.pyÚCreateDefaultOpQuantizerX   s    r>   c                 C   sD   | j tjkrtnt}|j|kr:||j | |ƒ}| ¡ r:|S t| |ƒS r8   )Úmoder'   Z
IntegerOpsÚIntegerOpsRegistryÚQLinearOpsRegistryÚop_typeZshould_quantizer   )r:   r;   ÚregistryZop_quantizerr<   r<   r=   ÚCreateOpQuantizer\   s    
rD   c                 C   s$   |j tkrt|j  | |ƒS t| |ƒS r8   )rB   ÚQDQRegistryr   r9   r<   r<   r=   ÚCreateQDQQuantizere   s    
rF   N)EZoperators.activationr   r   Zoperators.argmaxr   Zoperators.attentionr   Zoperators.base_operatorr   Zoperators.binary_opr   Zoperators.concatr	   Zoperators.convr
   r   r   Zoperators.direct_q8r   r   Zoperators.embed_layernormr   Zoperators.gatherr   r   Zoperators.gavgpoolr   Zoperators.gemmr   r   Zoperators.instnormr   Zoperators.lstmr   Zoperators.matmulr   r   r   Zoperators.maxpoolr   r   Zoperators.padr   Zoperators.poolingr   Zoperators.qdq_base_operatorr   Zoperators.resizer   r    Zoperators.softmaxr!   r"   Zoperators.splitr#   r$   Zoperators.wherer%   r&   Zquant_utilsr'   ZCommonOpsRegistryr@   ÚupdaterA   rE   r>   rD   rF   r<   r<   r<   r=   Ú<module>   sž   ýü
ê
î	