o
    \hf  ã                   @   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*m+Z+ d dl,m-Z- d dl.m/Z/ d dl0m1Z1m2Z2 d dl3m4Z4 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=¡ 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'e7“d(e+“d)e“d*e“d+e“e2e-ee4e:d,œ¥Z@e@ ?e=¡ i de“d-e“de“d"e“d!e“d)e“d.e“d*e“d+e“d/e1“d%e%“d0e“d1e“d(e*“de"“d'e6“d2e“ee9e(e(e(d3œ¥ZAd4d5„ ZBd6d7„ ZCd8d9„ ZDd:S );é   )ÚQDQRemovableActivationÚQLinearActivation)ÚQArgMax)ÚAttentionQuant©ÚQuantOperatorBase)ÚQLinearBinaryOp)ÚQLinearConcat)ÚConvIntegerÚQDQConvÚQLinearConv)ÚDirect8BitOpÚQDQDirect8BitOp)ÚEmbedLayerNormalizationQuant)ÚGatherQuantÚ	QDQGather)ÚQGlobalAveragePool)ÚQDQGemmÚQLinearGemm)Ú	LSTMQuant)ÚMatMulIntegerÚ	QDQMatMulÚQLinearMatMul)Ú
QDQMaxPoolÚQMaxPool)ÚQDQNormalization)ÚQDQPadÚQPad)ÚQLinearPool)ÚQDQOperatorBase)Ú	QDQResizeÚQResize)ÚQLinearSoftmax)ÚQDQSplitÚQSplit)ÚQDQWhereÚQLinearWhere)Ú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ÚWhereÚConvTransposer)   r>   r?   ÚSlicer(   )ÚGatherElementsrB   ÚInstanceNormalizationÚLayerNormalizationÚBatchNormalizationc                 C   s
   t | |ƒS ©Nr   ©Úonnx_quantizerÚnode© rM   úd/home/air/segue/gemini/backup/venv/lib/python3.10/site-packages/onnxruntime/quantization/registry.pyÚCreateDefaultOpQuantizer\   s   
rO   c                 C   sD   | j tjkrtnt}|j|v r||j | |ƒ}| ¡ r|S t| |ƒS rI   )Úmoder'   Ú
IntegerOpsÚIntegerOpsRegistryÚQLinearOpsRegistryÚop_typeÚshould_quantizer   )rK   rL   ÚregistryÚop_quantizerrM   rM   rN   ÚCreateOpQuantizer`   s   

rX   c                 C   s$   |j tv rt|j  | |ƒS t| |ƒS rI   )rT   ÚQDQRegistryr   rJ   rM   rM   rN   ÚCreateQDQQuantizeri   s   

rZ   N)EÚ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.normr   Úoperators.padr   r   Úoperators.poolingr   Úoperators.qdq_base_operatorr   Úoperators.resizer    r!   Úoperators.softmaxr"   Úoperators.splitr#   r$   Úoperators.wherer%   r&   Úquant_utilsr'   ÚCommonOpsRegistryrR   ÚupdaterS   rY   rO   rX   rZ   rM   rM   rM   rN   Ú<module>   sð    ýü
ÿþýüûúùø	÷
öõôóòñðïê
ÿþýüûúùø	÷
öõôóòñðïê	