Ë
    )êñiê  ã                   ó¶   — d dl mZ d dlZd dlmZ d dlmZ g d¢Z G d„ dej                  «      Z G d„ d	ej                  «      Z	 G d
„ dej                  «      Z
y)é    )ÚAnyN)Únn)ÚQConfig)Ú	QuantStubÚDeQuantStubÚQuantWrapperc                   óh   ‡ — e Zd ZdZddedz  fˆ fd„Zdej                  dej                  fd„Zˆ xZ	S )	r   a  Quantize stub module, before calibration, this is same as an observer,
    it will be swapped as `nnq.Quantize` in `convert`.

    Args:
        qconfig: quantization configuration for the tensor,
            if qconfig is not provided, we will get qconfig from parent modules
    NÚqconfigc                 ó6   •— t         ‰| �  «        |r|| _        y y ©N©ÚsuperÚ__init__r
   ©Úselfr
   Ú	__class__s     €ú]/var/www/pod-logistic/pod-ai/venv/lib/python3.12/site-packages/torch/ao/quantization/stubs.pyr   zQuantStub.__init__   ó   ø€ Ü‰ÑÔÙØ"ˆD�Lð ó    ÚxÚreturnc                 ó   — |S r   © ©r   r   s     r   ÚforwardzQuantStub.forward   ó   € Øˆr   r   )
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   ÚtorchÚTensorr   Ú__classcell__©r   s   @r   r   r      s3   ø„ ññ# ¨$¡õ #ð
˜Ÿ™ð ¨%¯,©,÷ r   r   c                   óh   ‡ — e Zd ZdZddedz  fˆ fd„Zdej                  dej                  fd„Zˆ xZ	S )	r   a  Dequantize stub module, before calibration, this is same as identity,
    this will be swapped as `nnq.DeQuantize` in `convert`.

    Args:
        qconfig: quantization configuration for the tensor,
            if qconfig is not provided, we will get qconfig from parent modules
    Nr
   c                 ó6   •— t         ‰| �  «        |r|| _        y y r   r   r   s     €r   r   zDeQuantStub.__init__&   r   r   r   r   c                 ó   — |S r   r   r   s     r   r   zDeQuantStub.forward+   r   r   r   )
r   r   r   r    r   r   r!   r"   r   r#   r$   s   @r   r   r      s3   ø„ ññ#  d¡
õ #ð
˜Ÿ™ð ¨%¯,©,÷ r   r   c                   ó¨   ‡ — e Zd ZU dZeed<   eed<   ej                  ed<   dej                  fˆ fd„Z	de
j                  de
j                  fd„Zˆ xZS )	r   aç  A wrapper class that wraps the input module, adds QuantStub and
    DeQuantStub and surround the call to module with call to quant and dequant
    modules.

    This is used by the `quantization` utility functions to add the quant and
    dequant modules, before `convert` function `QuantStub` will just be observer,
    it observes the input tensor, after `convert`, `QuantStub`
    will be swapped to `nnq.Quantize` which does actual quantization. Similarly
    for `DeQuantStub`.
    ÚquantÚdequantÚmodulec                 ó  •— t         ‰| �  «        t        |dd «      }| j                  dt	        |«      «       | j                  dt        |«      «       | j                  d|«       | j                  |j                  «       y )Nr
   r)   r*   r+   )r   r   ÚgetattrÚ
add_moduler   r   ÚtrainÚtraining)r   r+   r
   r   s      €r   r   zQuantWrapper.__init__?   s`   ø€ Ü‰ÑÔÜ˜& )¨TÓ2ˆØ�‰˜¤¨7Ó!3Ô4Ø�‰˜	¤;¨wÓ#7Ô8Ø�‰˜ &Ô)Ø�
‰
�6—?‘?Õ#r   ÚXr   c                 óh   — | j                  |«      }| j                  |«      }| j                  |«      S r   )r)   r+   r*   )r   r1   s     r   r   zQuantWrapper.forwardG   s*   € Ø�J‰J�q‹MˆØ�K‰K˜‹NˆØ�|‰|˜A‹Ðr   )r   r   r   r    r   Ú__annotations__r   r   ÚModuler   r!   r"   r   r#   r$   s   @r   r   r   /   sK   ø… ñ	ð ÓØÓØ�I‰IÓð$˜rŸy™yõ $ð˜Ÿ™ð ¨%¯,©,÷ r   r   )Útypingr   r!   r   Útorch.ao.quantizationr   Ú__all__r4   r   r   r   r   r   r   ú<module>r8      sH   ðÝ ã Ý Ý )ò 7€ô�—	‘	ô ô$�"—)‘)ô ô$�2—9‘9õ r   