o
    ãÊiå  ã                   @   sX   d Z ddlmZmZmZ ddlZddlmZ eG dd„ deƒƒZeG dd„ deƒƒZ	dS )	z7Protocols for some functionalities in tensor subclassesé    )ÚOptionalÚProtocolÚruntime_checkableN)ÚQuantizeTensorKwargsc                   @   s    e Zd ZU dZeej ed< dS )ÚSupportsActivationPreScalinga  Protocol for activation scale that should be multiplied with activation before quantization,
    or before we use activation in matrix multiplications, used for algorithms like AWQ

    A class that have `act_pre_scale: Optional[torch.Tensor]` attribute implements the Protocol
    Úact_pre_scaleN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚtorchÚTensorÚ__annotations__© r   r   úb/home/ubuntu/.local/lib/python3.10/site-packages/torchao/quantization/quantize_/common/protocol.pyr      s   
 r   c                   @   s.   e Zd ZU dZeej ed< defdd„Z	dS )ÚIsStaticQuantizationConfigzÖProtocol for static quantization configuration.

    A class that has `act_quant_scale: Optional[torch.Tensor]` attribute and
    `get_act_quant_kwargs() -> QuantizeTensorKwargs` method implements the Protocol
    Úact_quant_scaleÚreturnc                 C   s   d S )Nr   )Úselfr   r   r   Úget_act_quant_kwargs'   s    z/IsStaticQuantizationConfig.get_act_quant_kwargsN)
r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r      s   
 r   )
r   Útypingr   r   r   r   Ú<torchao.quantization.quantize_.common.quantize_tensor_kwargsr   r   r   r   r   r   r   Ú<module>   s   
