ó
    Eñiê  ã                   ó¶   • S SK Jr  S SKrS SKJr  S SKJr  / SQr " S S\R                  5      r " S S	\R                  5      r	 " S
 S\R                  5      r
g)é    )ÚAnyN)Únn)ÚQConfig)Ú	QuantStubÚDeQuantStubÚQuantWrapperc                   óx   ^ • \ rS rSrSrS
S\S-  4U 4S jjjrS\R                  S\R                  4S jr	S	r
U =r$ )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                 ó>   >• [         TU ]  5         U(       a  Xl        g g ©N©ÚsuperÚ__init__r   ©Úselfr   Ú	__class__s     €ÚX/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/ao/quantization/stubs.pyr   ÚQuantStub.__init__   ó   ø€ Ü‰ÑÔÞØ"�Lð ó    ÚxÚreturnc                 ó   • U$ r   © ©r   r   s     r   ÚforwardÚQuantStub.forward   ó   € Øˆr   ©r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   ÚtorchÚTensorr   Ú__static_attributes__Ú__classcell__©r   s   @r   r   r      s=   ø† ññ# ¨$¡÷ #ð #ð
˜Ÿ™ð ¨%¯,©,÷ ò r   r   c                   óx   ^ • \ rS rSrSrS
S\S-  4U 4S jjjrS\R                  S\R                  4S jr	S	r
U =r$ )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                 ó>   >• [         TU ]  5         U(       a  Xl        g g r   r   r   s     €r   r   ÚDeQuantStub.__init__&   r   r   r   r   c                 ó   • U$ r   r   r   s     r   r   ÚDeQuantStub.forward+   r   r   r    r   )r!   r"   r#   r$   r%   r   r   r&   r'   r   r(   r)   r*   s   @r   r   r      s=   ø† ññ#  d¡
÷ #ð #ð
˜Ÿ™ð ¨%¯,©,÷ ò r   r   c                   ó¶   ^ • \ rS rSr% Sr\\S'   \\S'   \R                  \S'   S\R                  4U 4S jjr
S\R                  S\R                  4S	 jrS
rU =r$ )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U ]  5         [        USS 5      nU R                  S[	        U5      5        U R                  S[        U5      5        U R                  SU5        U R                  UR                  5        g )Nr   r3   r4   r5   )r   r   ÚgetattrÚ
add_moduler   r   ÚtrainÚtraining)r   r5   r   r   s      €r   r   ÚQuantWrapper.__init__?   s`   ø€ Ü‰ÑÔÜ˜& )¨TÓ2ˆØ�‰˜¤¨7Ó!3Ô4Ø�‰˜	¤;¨wÓ#7Ô8Ø�‰˜ &Ô)Ø�
‰
�6—?‘?Õ#r   ÚXr   c                 óh   • U R                  U5      nU R                  U5      nU R                  U5      $ r   )r3   r5   r4   )r   r<   s     r   r   ÚQuantWrapper.forwardG   s*   € Ø�J‰J�q‹MˆØ�K‰K˜‹NˆØ�|‰|˜A‹Ðr   r   )r!   r"   r#   r$   r%   r   Ú__annotations__r   r   ÚModuler   r&   r'   r   r(   r)   r*   s   @r   r   r   /   sP   ø‡ ñ	ð ÓØÓØ�I‰IÓð$˜rŸy™y÷ $ð˜Ÿ™ð ¨%¯,©,÷ ò r   r   )Útypingr   r&   r   Útorch.ao.quantizationr   Ú__all__r@   r   r   r   r   r   r   Ú<module>rD      sH   ðÝ ã Ý Ý )ò 7€ô�—	‘	ô ô$�"—)‘)ô ô$�2—9‘9õ r   