o
    
jD                     @   s   G d d dZ dS )c                   @   s$   e Zd Zdd Zdd Zdd ZdS )QuantOperatorBasec                 C   s   || _ || _d S )N)	quantizernode)selfonnx_quantizer	onnx_node r   c/home/kuhnn/.local/lib/python3.10/site-packages/onnxruntime/quantization/operators/base_operator.py__init__   s   
zQuantOperatorBase.__init__c                 C   s&   | j | js	dS | j | jjd S )NF    )r   should_quantize_noder   is_float_tensorinput)r   r   r   r   should_quantize   s   z!QuantOperatorBase.should_quantizec                 C   sL   t | jjD ]\}}| j|}|dur| jj| q| jj| j dS )a  
        Given a node which does not support quantization, this method checks whether the input to
        this node is quantized and adds a DequantizeLinear node to dequantize this input back to FP32
            parameter node: Current node
            parameter new_nodes_list: List of new nodes created before processing current node
            return: List of new nodes created
        N)	enumerater   r   r   _dequantize_value	new_nodesappend)r   _
node_inputdequantize_noder   r   r   quantize   s   zQuantOperatorBase.quantizeN)__name__
__module____qualname__r	   r   r   r   r   r   r   r      s    r   N)r   r   r   r   r   <module>   s    