o
    ¢Äiƒ  ã                   @   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(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Ú	TransposeZEmbedLayerNormalization)ÚConvÚMatMulZ	AttentionZLSTMZArgMaxr*   ZGemmr+   ÚAddZMulZReluZClipZ	LeakyReluZSigmoidZMaxPoolZGlobalAveragePoolZSplitZPadZReshapeZSqueezeZ	Unsqueeze)ÚResizeÚAveragePoolZConcatZSoftmaxÚWhereZConvTransposer)   r-   r.   ÚSlicer(   )ZGatherElementsr/   ZInstanceNormalizationZLayerNormalizationZBatchNormalizationZTopKc                 C   s
   t | |ƒS ©Nr   ©Úonnx_quantizerÚnode© r5   ú[/home/kim/smarthome/.venv/lib/python3.10/site-packages/onnxruntime/quantization/registry.pyÚCreateDefaultOpQuantizer]   s   
r7   c                 C   sD   | j tjkrtnt}|j|v r||j | |ƒ}| ¡ r|S t| |ƒS r1   )Úmoder'   Z
IntegerOpsÚIntegerOpsRegistryÚQLinearOpsRegistryÚop_typeZshould_quantizer   )r3   r4   ÚregistryZop_quantizerr5   r5   r6   ÚCreateOpQuantizera   s   

r=   c                 C   s$   |j tv rt|j  | |ƒS t| |ƒS r1   )r;   ÚQDQRegistryr   r2   r5   r5   r6   ÚCreateQDQQuantizerj   s   

r?   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.lstmr   Zoperators.matmulr   r   r   Zoperators.maxpoolr   r   Zoperators.normr   Zoperators.padr   r   Zoperators.poolingr   Zoperators.qdq_base_operatorr   Zoperators.resizer    r!   Zoperators.softmaxr"   Zoperators.splitr#   r$   Zoperators.wherer%   r&   Zquant_utilsr'   ZCommonOpsRegistryr9   Úupdater:   r>   r7   r=   r?   r5   r5   r5   r6   Ú<module>   sò    ýü
ÿþýüûúùø	÷
öõôóòñðïê
ÿþýüûúùø	÷
öõôóòñðïé	