+
    –°³jø¬  ã                   ó  € ^ RI t ^ RIt^ RIHt ^ RIHtHt ^ RIHtH	t	 ]	! RR4      t
]P                  ]P                  ]P                  ]P                  ]P                  .t]P"                  ]P$                  .t] U u/ uF9  q ]P)                  V 4      P*                  ]P)                  V 4      P,                  3bK;  	  up t]P1                  ] U u/ uFE  q ]! ]P5                  V 4      P*                  4      ]! ]P5                  V 4      P,                  4      3bKG  	  up 4       R t]
P9                  R4       ]! ]
R	R
4      R R l4       t]! ]
R	R4      R R l4       t]
P9                  R4       ]! ]
RR
4      R R l4       t]! ]
RR4      R R l4       t ]
P9                  R4       ]! ]
RR
4      R R l4       t!]! ]
RR4      R R l4       t"]
P9                  R4       ]! ]
RR
4      RR/R R  ll4       t#]! ]
RR4      RR/R! R" ll4       t$]
P9                  R#4       ]! ]
R$R
4      RR/R% R& ll4       t%]! ]
R$R4      RR/R' R( ll4       t&]
P9                  R)4       ]! ]
R*R
4      RR/R+ R, ll4       t']! ]
R*R4      RR/R- R. ll4       t(]
P9                  R/4       ]! ]
R0R
4      R1 R2 l4       t)]
P9                  R34       ]! ]
R4R
4      R5 R6 l4       t*]! ]
R0R4      R7 R8 l4       t+]! ]
R4R4      R9 R: l4       t,R; t-]
P9                  R<4       ]! ]
R=R
4      R> R? l4       t.]! ]
R=R4      R@ RA l4       t/]
P9                  RB4       ]! ]
RCR
4      RR/RD RE ll4       t0]! ]
RCR4      RR/RF RG ll4       t1]
P9                  RH4       ]! ]
RIR
4      RJ RK l4       t2]! ]
RIR4      RL RM l4       t3]
P9                  RN4       ]! ]
RORP4      RQ RR l4       t4]
P9                  RS4       ]! ]
RTR
4      RU RV l4       t5]! ]
RTR4      RW RX l4       t6RY t7]
P9                  RZ4       ]! ]
R[R
4      R\ R] l4       t8]! ]
R[R4      R^ R_ l4       t9]
P9                  R`4       ]! ]
RaR
4      ]Pt                  3Rb Rc ll4       t;]! ]
RaR4      ]Pt                  3Rd Re ll4       t<]
P9                  Rf4       ]! ]
RgR
4      RRh Ri ll4       t=]! ]
RgR4      RRj Rk ll4       t>]
P9                  Rl4       ]! ]
RmR
4      ^€]Pt                  3Rn Ro ll4       t?]
P9                  Rp4        ! Rq Rr]P€                  P‚                  4      tB]! ]
RsRt4      Ru Rv l4       tC]! ]
RsR4      Rw Rx l4       tD]
P9                  Ry4       ]! ]
RzR
4      R{ R| l4       tE]! ]
RzR4      R} R~ l4       tFR# u up i u up i )€é    N)Ú_unsqueeze_multiple)Údetermine_qparamsÚvalidate_qmin_qmax)ÚimplÚLibraryÚquantized_decomposedÚDEFc                 ó²   € V\         9  d   \        R V 24      h\         V,          w  r4W8  d   \        RV RV  24      hW8”  d   \        RV RV 24      hR# )zUnsupported dtype: z:quant_min out of bounds for dtype, quant_min_lower_bound: z quant_min: z:quant_max out of bounds for dtype, quant_max_upper_bound: z quant_max: N)Ú_DTYPE_TO_QVALUE_BOUNDSÚ
ValueErrorÚAssertionError)Ú	quant_minÚ	quant_maxÚdtypeÚquant_min_lower_boundÚquant_max_upper_bounds   &&&  Úe/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/ao/quantization/fx/_decomposed.pyÚ_quant_min_max_bounds_checkr      s‡   € ØÔ+Ô+ÜÐ.¨u¨gÐ6Ó7Ð7Ü3JÈ5Õ3QÑ0ÐàÔ(Üð&Ø&;Ð%<¸LÈÈðUó
ð 	
ð
 Ô(Üð&Ø&;Ð%<¸LÈÈðUó
ð 	
ñ )ó    zxquantize_per_tensor(Tensor input, float scale, int zero_point, int quant_min, int quant_max, ScalarType dtype) -> TensorÚquantize_per_tensorÚCompositeExplicitAutogradc                ó¨   € V ^8„  d   QhR\         P                  R\        R\        R\        R\        R\         P                  R\         P                  /# ©é   ÚinputÚscaleÚ
zero_pointr   r   r   Úreturn©ÚtorchÚTensorÚfloatÚintr   )Úformats   "r   Ú__annotate__r%   3   sZ   € ÷ "ñ "Ü�<‰<ð"äð"ô ð"ô ð	"ô
 ð"ô �;‰;ð"ô ‡\�\ñ"r   c                óÄ  € V P                   \        P                  \        P                  39   d    V P	                  \        P
                  4      p V P                   \        P
                  8w  d   \        RV P                    24      h\        W4V4       RV,          p\        P                  ! \        P                  ! W,          4      V,           W44      P	                  V4      # )a¼  Affine quantization for the Tensor using the same quantization parameters to map
from floating point to quantized values

Args:
   input (torch.Tensor): original float32 or bfloat16 Tensor
   scale (float): quantization parameter for affine quantization
   zero_point (int): quantization parameter for affine quantization
   quant_min (int): minimum quantized value for output Tensor
   quant_max (int): maximum quantized value for output Tensor
   dtype (torch.dtype): requested dtype (e.g. torch.uint8) for output Tensor

Returns:
   Tensor with requested dtype (e.g. torch.uint8), note the quantization parameters
   are not stored in the Tensor, we are storing them in function arguments instead
ú<Expecting input to have dtype torch.float32, but got dtype: ç      ð?)
r   r    Úfloat16Úbfloat16ÚtoÚfloat32r   r   ÚclampÚround)r   r   r   r   r   r   Ú	inv_scales   &&&&&& r   r   r   2   sŸ   € ð0 ‡{�{”u—}‘}¤e§n¡nÐ5Ô5Ø—‘œŸ™Ó'ˆØ‡{�{”e—m‘mÔ#ÜØJÈ5Ï;É;È-ÐXó
ð 	
ô   	°eÔ<à�e•€IÜ�;Š;Ü�Š�EÕ%Ó&¨Õ3°Yóç�bˆƒiðr   ÚMetac                ó¨   € V ^8„  d   QhR\         P                  R\        R\        R\        R\        R\         P                  R\         P                  /# r   r   )r$   s   "r   r%   r%   Y   sZ   € ÷ 0ñ 0Ü�<‰<ð0äð0ô ð0ô ð	0ô
 ð0ô �;‰;ð0ô ‡\�\ñ0r   c                 ó:  € V P                   \        P                  \        P                  39   d    V P	                  \        P
                  4      p V P                   \        P
                  8w  d   \        R V P                    24      h\        P                  ! WR7      # )r'   ©r   )r   r    r)   r*   r+   r,   r   Ú
empty_like©r   r   r   r   r   r   s   &&&&&&r   Úquantize_per_tensor_metar6   X   sm   € ð ‡{�{”u—}‘}¤e§n¡nÐ5Ô5Ø—‘œŸ™Ó'ˆØ‡{�{”e—m‘mÔ#ÜØJÈ5Ï;É;È-ÐXó
ð 	
ô ×Ò˜EÔ/Ð/r   zƒquantize_per_tensor.tensor(Tensor input, Tensor scale, Tensor zero_point, int quant_min, int quant_max, ScalarType dtype) -> Tensorzquantize_per_tensor.tensorc                óÐ   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\        R\        R\         P                  R\         P                  /# r   ©r    r!   r#   r   )r$   s   "r   r%   r%   s   sb   € ÷ ñ Ü�<‰<ðä�<‰<ðô —‘ðô ð	ô
 ðô �;‰;ðô ‡\�\ñr   c                ó  € VP                  4       ^8w  d   \        RVP                  4        24      hVP                  4       ^8w  d   \        RVP                  4        24      h\        V VP                  4       VP                  4       VVV4      # ©zÛAffine quantization for the Tensor using the same quantization parameters to map
from floating point to quantized values
Same as `quantize_per_tensor` but scale and zero_point are Scalar Tensor instead of
scalar values
ú>Expecting zero_point tensor to be one element, but received : ú9Expecting scale tensor to be one element, but received : ©Únumelr   r   Úitemr5   s   &&&&&&r   Úquantize_per_tensor_tensorr@   p   s‘   € ð  ×ÑÓ˜QÔÜØLÈZ×M]ÑM]ÓM_ÐL`Ðaó
ð 	
ð ‡{�{ƒ}˜ÔÜØGÈÏÉËÀÐWó
ð 	
ô ØØ�
‰
‹Ø�‰ÓØØØóð r   c                óÐ   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\        R\        R\         P                  R\         P                  /# r   r8   )r$   s   "r   r%   r%   “   sb   € ÷ 0ñ 0Ü�<‰<ð0ä�<‰<ð0ô —‘ð0ô ð	0ô
 ð0ô �;‰;ð0ô ‡\�\ñ0r   c                 óþ  € V P                   \        P                  \        P                  39   d    V P	                  \        P
                  4      p VP                  4       ^8w  d   \        RVP                  4        24      hVP                  4       ^8w  d   \        RVP                  4        24      hV P                   \        P
                  8w  d   \        RV P                    24      h\        P                  ! WR7      # )é   r;   r<   r'   r3   )	r   r    r)   r*   r+   r,   r>   r   r4   r5   s   &&&&&&r   Úquantize_per_tensor_tensor_metarD   ’   sÎ   € ð ‡{�{”u—}‘}¤e§n¡nÐ5Ô5Ø—‘œŸ™Ó'ˆØ×ÑÓ˜QÔÜØLÈZ×M]ÑM]ÓM_ÐL`Ðaó
ð 	
ð ‡{�{ƒ}˜ÔÜØGÈÏÉËÀÐWó
ð 	
ð ‡{�{”e—m‘mÔ#ÜØJÈ5Ï;É;È-ÐXó
ð 	
ô ×Ò˜EÔ/Ð/r   zŠquantize_per_tensor.tensor2(Tensor input, Tensor scale, Tensor zero_point, Tensor quant_min, Tensor quant_max, ScalarType dtype) -> Tensorzquantize_per_tensor.tensor2c                óø   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\         P                  R\         P                  R\         P                  R\         P                  /# r   ©r    r!   r   )r$   s   "r   r%   r%   ¶   sj   € ÷ ñ Ü�<‰<ðä�<‰<ðô —‘ðô �|‰|ð	ô
 �|‰|ðô �;‰;ðô ‡\�\ñr   c                óV  € VP                  4       ^8w  d   \        RVP                  4        24      hVP                  4       ^8w  d   \        RVP                  4        24      h\        V VP                  4       VP                  4       VP                  4       VP                  4       V4      # r:   r=   r5   s   &&&&&&r   Úquantize_per_tensor_tensor2rH   ³   sŸ   € ð  ×ÑÓ˜QÔÜØLÈZ×M]ÑM]ÓM_ÐL`Ðaó
ð 	
ð ‡{�{ƒ}˜ÔÜØGÈÏÉËÀÐWó
ð 	
ô ØØ�
‰
‹Ø�‰ÓØ�‰ÓØ�‰ÓØóð r   c                óø   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\         P                  R\         P                  R\         P                  R\         P                  /# r   rF   )r$   s   "r   r%   r%   Ö   sj   € ÷ ñ Ü�<‰<ðä�<‰<ðô —‘ðô �|‰|ð	ô
 �|‰|ðô �;‰;ðô ‡\�\ñr   c                 ó"   € \        V VVVVV4      # ©N)rD   r5   s   &&&&&&r   Ú quantize_per_tensor_tensor2_metarL   Õ   s#   € ô +ØØØØØØóð r   z™dequantize_per_tensor(Tensor input, float scale, int zero_point, int quant_min, int quant_max, ScalarType dtype, *, ScalarType? out_dtype=None) -> TensorÚdequantize_per_tensorÚ	out_dtypec                óÖ   € V ^8„  d   QhR\         P                  R\        R\        R\        R\        R\         P                  R\         P                  R,          R	\         P                  /# ©
r   r   r   r   r   r   r   rN   Nr   r   )r$   s   "r   r%   r%   ó   sw   € ÷ 0Qñ 0QÜ�<‰<ð0Qäð0Qô ð0Qô ð	0Qô
 ð0Qô �;‰;ð0Qô �{‰{˜TÕ!ð0Qô ‡\�\ñ0Qr   c               óò   € V P                   V8w  d   \        RV RV P                    24      hVf   \        P                  pV\        9   d    V P                  V4      V,
          V,          # \        RV 24      h)aº  Affine dequantization for the Tensor using the same quantization parameters to map
from quantized values to floating point values

Args:
   input (torch.Tensor): Tensor with dtype matching `dtype` argument,
   e.g. (`torch.uint8`), it is a per tensor quantized Tensor if combined with
   quantization parameters in the argument of this function (scale/zero_point)

   scale (float): quantization parameter for affine quantization

   zero_point (int): quantization parameter for affine quantization

   quant_min (int): minimum quantized value for input Tensor (not used in computation,
   reserved for pattern matching)

   quant_max (int): maximum quantized value for input Tensor (not used in computation,
   reserved for pattern matching)

   dtype (torch.dtype): dtype for input Tensor (not used in computation,
   reserved for pattern matching)

   out_dtype (torch.dtype?): optional dtype for output Tensor

Returns:
   dequantized float32 Tensor
úExpecting input to have dtype: ú
, but got ú,Unsupported dtype in dequantize_per_tensor: )r   r   r    r,   r   r+   r   ©r   r   r   r   r   r   rN   s   &&&&&&$r   rM   rM   ò   sz   € ðJ ‡{�{�eÔÜØ-¨e¨W°J¸u¿{¹{¸mÐLó
ð 	
ð ÒÜ—M‘Mˆ	ØÔ'Ô'ð —‘˜Ó# jÕ0°EÕ9Ð9äÐGÈÀwÐOÓPÐPr   c                óþ   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\        R\        R\         P                  R\         P                  R,          R	\         P                  /# rP   r8   )r$   s   "r   r%   r%   '  su   € ÷ 4ñ 4Ü�<‰<ð4ä�<‰<ð4ô —‘ð4ô ð	4ô
 ð4ô �;‰;ð4ô �{‰{˜TÕ!ð4ô ‡\�\ñ4r   c                óX   € Vf   \         P                  p\         P                  ! WR7      # )Nr3   )r    r,   r4   rU   s   &&&&&&$r   Údequantize_per_tensor_metarX   &  s$   € ð ÒÜ—M‘Mˆ	Ü×Ò˜EÔ3Ð3r   z¤dequantize_per_tensor.tensor(Tensor input, Tensor scale, Tensor zero_point, int quant_min, int quant_max, ScalarType dtype, *, ScalarType? out_dtype=None) -> Tensorzdequantize_per_tensor.tensorc                óþ   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\        R\        R\         P                  R\         P                  R,          R	\         P                  /# rP   r8   )r$   s   "r   r%   r%   A  su   € ÷ ñ Ü�<‰<ðä�<‰<ðô —‘ðô ð	ô
 ðô �;‰;ðô �{‰{˜TÕ!ðô ‡\�\ñr   c          
     ó"  € VP                  4       ^8w  d   \        RVP                  4        24      hVP                  4       ^8w  d   \        RVP                  4        24      h\        V VP                  4       VP                  4       VVVVR7      # ©zæAffine dequantization for the Tensor using the same quantization parameters to map
from quantized values to floating point values
Same as `dequantize_per_tensor` but scale and zero_point are Scalar Tensor instead of
scalar values
r;   r<   ©rN   ©r>   r   rM   r?   rU   s   &&&&&&$r   Údequantize_per_tensor_tensorr^   <  s”   € ð( ×ÑÓ˜QÔÜØLÈZ×M]ÑM]ÓM_ÐL`Ðaó
ð 	
ð ‡{�{ƒ}˜ÔÜØGÈÏÉËÀÐWó
ð 	
ô !ØØ�
‰
‹Ø�‰ÓØØØØôð r   c                óþ   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\        R\        R\         P                  R\         P                  R,          R	\         P                  /# rP   r8   )r$   s   "r   r%   r%   d  s   € ÷ Qñ QÜ�<‰<ðQä�<‰<ðQô —‘ðQô ð	Qô
 ðQô �;‰;ðQô �{‰{˜TÕ!ðQô ‡\�\ñQr   c                ó¦  € Vf   \         P                  pVP                  4       ^8w  d   \        RVP                  4        24      hVP                  4       ^8w  d   \        RVP                  4        24      hV P                  V8w  d   \        RV RV P                   24      hV\
        9   d   \         P                  ! WR7      # \        RV 24      h)Nr;   r<   rR   rS   r3   rT   )r    r,   r>   r   r   r   r4   r   rU   s   &&&&&&$r   Ú!dequantize_per_tensor_tensor_metara   c  sÐ   € ð ÒÜ—M‘Mˆ	Ø×ÑÓ˜QÔÜØLÈZ×M]ÑM]ÓM_ÐL`Ðaó
ð 	
ð ‡{�{ƒ}˜ÔÜØGÈÏÉËÀÐWó
ð 	
ð ‡{�{�eÔÜØ-¨e¨W°J¸u¿{¹{¸mÐLó
ð 	
ð Ô'Ô'Ü×Ò Ô7Ð7äÐGÈÀwÐOÓPÐPr   z«dequantize_per_tensor.tensor2(Tensor input, Tensor scale, Tensor zero_point, Tensor quant_min, Tensor quant_max, ScalarType dtype, *, ScalarType? out_dtype=None) -> Tensorzdequantize_per_tensor.tensor2c                ó&  € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\         P                  R\         P                  R\         P                  R\         P                  R,          R	\         P                  /# rP   rF   )r$   s   "r   r%   r%   Ž  s}   € ÷ ñ Ü�<‰<ðä�<‰<ðô —‘ðô �|‰|ð	ô
 �|‰|ðô �;‰;ðô �{‰{˜TÕ!ðô ‡\�\ñr   c          
     óZ  € VP                  4       ^8w  d   \        RVP                  4        24      hVP                  4       ^8w  d   \        RVP                  4        24      h\        V VP                  4       VP                  4       VP                  4       VP                  4       VVR7      # r[   r]   rU   s   &&&&&&$r   Údequantize_per_tensor_tensor2rd   ‰  s¢   € ð( ×ÑÓ˜QÔÜØLÈZ×M]ÑM]ÓM_ÐL`Ðaó
ð 	
ð ‡{�{ƒ}˜ÔÜØGÈÏÉËÀÐWó
ð 	
ô !ØØ�
‰
‹Ø�‰ÓØ�‰ÓØ�‰ÓØØôð r   c                óf   € V ^8„  d   QhR\         P                  R,          R\         P                  /# )r   rN   Nr   )r    r   r!   )r$   s   "r   r%   r%   ±  s-   € ÷ ñ ô �{‰{˜TÕ!ðô ‡\�\ñr   c          
      ó    € \        WW#WEVR 7      # )r\   )ra   rU   s   &&&&&&$r   Ú"dequantize_per_tensor_tensor2_metarg   °  s   € ô -Ø�j¨YÈôð r   zrchoose_qparams.tensor(Tensor input, int quant_min, int quant_max, float eps, ScalarType dtype) -> (Tensor, Tensor)zchoose_qparams.tensorc                óÒ   € V ^8„  d   QhR\         P                  R\        R\        R\        R\         P                  R\
        \         P                  \         P                  3,          /# ©r   r   ÚqminÚqmaxÚepsr   r   ©r    r!   r#   r"   r   Útuple)r$   s   "r   r%   r%   Ç  óV   € ÷ (ñ (Ü�<‰<ð(Ü"ð(Ü*-ð(Ü49ð(ÜBGÇ+Á+ð(ä
Œ5�<‰<œŸ™Ð%Õ&ñ(r   c           
     óž  € V P                   \        P                  \        P                  \        P                  39  d   \        RV P                    24      hV\        9  d$   \        R\        P                  4        RV 24      h\        W4       \        P                  ! V 4      w  rV\        VVVVV\        P                  ! V.4      RR7      # )á3  Given an input Tensor, derive the per tensor affine quantization parameter
(scale and zero_point) for target quantized Tensor from the Tensor

Args:
   input (torch.Tensor): floating point input Tensor
   quant_min (int): minimum quantized value for target quantized Tensor
   quant_max (int): maximum quantized value for target quantized Tensor
   dtype (torch.dtype): dtype for target quantized Tensor

Returns:
   scale (float): quantization parameter for the target quantized Tensor
   zero_point (int): quantization parameter for the target quantized Tensor
úCExpecting input to have dtype torch.float32/16/b16, but got dtype: ú$Expecting target dtype to be one of ú, but got: F)Úhas_customized_qrange)r   r    r,   r)   r*   r   r   Úkeysr   Úaminmaxr   r!   ©r   rj   rk   rl   r   Úmin_valÚmax_vals   &&&&&  r   Úchoose_qparams_tensorr{   Æ  sÉ   € ð" ‡{�{Ü�‰Ü�‰Ü�‰ðô ô
 ØQÐRW×R]ÑR]ÐQ^Ð_ó
ð 	
ð Ô+Ô+ÜØ2Ô3J×3OÑ3OÓ3QÐ2RÐR]Ð^cÐ]dÐeó
ð 	
ô �tÔ"ä—}’} UÓ+Ñ€GäØØØØØÜ�Š�c�UÓØ#ôð r   z|choose_qparams_symmetric.tensor(Tensor input, int quant_min, int quant_max, float eps, ScalarType dtype) -> (Tensor, Tensor)zchoose_qparams_symmetric.tensorc                óÒ   € V ^8„  d   QhR\         P                  R\        R\        R\        R\         P                  R\
        \         P                  \         P                  3,          /# ri   rm   )r$   s   "r   r%   r%   ý  ro   r   c                ó¼  € V P                   \        P                  \        P                  \        P                  39  d   \        RV P                    24      hV\        9  d$   \        R\        P                  4        RV 24      h\        W4       \        P                  ! V 4      w  rV\        VVVVV\        P                  ! V.4      R\        P                  R7      # )rq   rr   rs   rt   F)ru   Úqscheme)r   r    r,   r)   r*   r   r   rv   r   rw   r   r!   Úper_tensor_symmetricrx   s   &&&&&  r   Úchoose_qparams_symmetric_tensorr€   ø  sÒ   € ð* ‡{�{Ü�‰Ü�‰Ü�‰ðô ô
 ØQÐRW×R]ÑR]ÐQ^Ð_ó
ð 	
ð Ô+Ô+ÜØ2Ô3J×3OÑ3OÓ3QÐ2RÐR]Ð^cÐ]dÐeó
ð 	
ô �tÔ"ä—}’} UÓ+Ñ€GÜØØØØØÜ�Š�c�UÓØ#Ü×*Ñ*ô	ð 	r   c                óÒ   € V ^8„  d   QhR\         P                  R\        R\        R\        R\         P                  R\
        \         P                  \         P                  3,          /# ©r   r   r   r   rl   r   r   rm   )r$   s   "r   r%   r%   )  sV   € ÷ ñ Ü�<‰<ðÜ$'ðÜ47ðÜ>CðÜLQÏKÉKðä
Œ5�<‰<œŸ™Ð%Õ&ñr   c                 ó   € V P                   \        P                  \        P                  \        P                  39  d   \        R V P                    24      hW8¼  d   \        RV RV 24      h\        P                  ! ^\        P                  V P                  R7      \        P                  ! ^\        P                  V P                  R7      3# )rr   zCExpecting quant_min to be smaller than quant_max but received min: z max: ©r   Údevice)
r   r    r,   r)   r*   r   ÚemptyÚdoubler…   Úint64©r   r   r   rl   r   s   &&&&&r   Úchoose_qparams_tensor_metarŠ   (  s´   € ð ‡{�{Ü�‰Ü�‰Ü�‰ðô ô
 ØQÐRW×R]ÑR]ÐQ^Ð_ó
ð 	
ð ÔÜØQÐR[ÐQ\Ð\bÐclÐbmÐnó
ð 	
ô �;Š;�q¤§¡°U·\±\ÔBÄEÇKÂKØ	”—‘ U§\¡\ôEð ð r   c                óÒ   € V ^8„  d   QhR\         P                  R\        R\        R\        R\         P                  R\
        \         P                  \         P                  3,          /# r‚   rm   )r$   s   "r   r%   r%   >  sV   € ÷ ñ Ü�<‰<ðÜ$'ðÜ47ðÜ>CðÜLQÏKÉKðä
Œ5�<‰<œŸ™Ð%Õ&ñr   c                 óÆ   € \         P                  ! ^\         P                  V P                  R7      \         P                  ! ^\         P                  V P                  R7      3# )rC   r„   )r    r†   r‡   r…   rˆ   r‰   s   &&&&&r   Ú$choose_qparams_symmetric_tensor_metar�   =  sA   € ô �;Š;�q¤§¡°U·\±\ÔBÄEÇKÂKØ	”—‘ U§\¡\ôEð ð r   c                 ó�   € \        \        V P                  4       4      4      p^ W!&   W^ &   V P                  \	        V4      4      pW23# )r   )ÚlistÚrangeÚdimÚpermutern   )ÚxÚaxisÚnew_axis_listÚys   &&  r   Ú_permute_to_axis_zeror—   G  sB   € Üœ˜qŸu™u›w›Ó(€MØ€MÑØ�!ÑØ	�	‰	”%˜Ó&Ó'€AØÐÐr   z‰quantize_per_channel(Tensor input, Tensor scales, Tensor zero_points, int axis, int quant_min, int quant_max, ScalarType dtype) -> TensorÚquantize_per_channelc                óÜ   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\        R\        R\        R\         P                  R\         P                  /# ©	r   r   ÚscalesÚzero_pointsr”   r   r   r   r   r8   )r$   s   "r   r%   r%   V  sl   € ÷ .ñ .Ü�<‰<ð.ä�L‰Lð.ô —‘ð.ô ð	.ô
 ð.ô ð.ô �;‰;ð.ô ‡\�\ñ.r   c                ó  € V P                   \        P                  \        P                  39   d    V P	                  \        P
                  4      p V P                   \        P
                  8w  d   \        RV P                    24      hW0P                  4       8¼  d   \        RV P                  4        24      h\        WEV4       \        W4      w  r^.V P                  4       ,          pVP                  ^ ,          V^ &   VP                  V4      pVP                  V4      p\        P                  ! \        P                  ! V RV,          ,          4      V,           WE4      p	V	P                  \        V4      4      p
V
P	                  V4      # )a<  Affine per channel quantization for the Tensor using the same quantization
parameters for each channel/axis to map from floating point to quantized values

Args:
   input (torch.Tensor): original float32 or bfloat16 Tensor
   scales (torch.Tensor): a list of scale quantization parameter for
   affine quantization, one per channel
   zero_point (torch.Tensor): a list of zero_point quantization parameter for
   affine quantization, one per channel
   quant_min (int): minimum quantized value for output Tensor
   quant_max (int): maximum quantized value for output Tensor
   dtype (torch.dtype): requested dtype (e.g. torch.uint8) for output Tensor

Returns:
   Tensor with requested dtype (e.g. torch.uint8), note the quantization parameters
   are not stored in the Tensor, we are storing them in function arguments instead
r'   úExpecting axis to be < r(   )r   r    r)   r*   r+   r,   r   r‘   r   r—   ÚshapeÚviewr-   r.   r’   rn   )r   r›   rœ   r”   r   r   r   Úpermute_axis_listÚ	new_shapeÚresÚouts   &&&&&&&    r   r˜   r˜   U  s'  € ð6 ‡{�{”u—}‘}¤e§n¡nÐ5Ô5Ø—‘œŸ™Ó'ˆØ‡{�{”e—m‘mÔ#ÜØJÈ5Ï;É;È-ÐXó
ð 	
ð �y‰y‹{ÔÜÐ6°u·y±y³{°mÐDÓEÐEÜ 	°eÔ<Ü4°UÓAÑ€Eà��e—i‘i“kÕ!€IØ—<‘< •?€Iˆa�LØ�[‰[˜Ó#€FØ×"Ñ" 9Ó-€Kä
�+Š+Ü�Š�E˜S 6�\Õ*Ó+¨kÕ9¸9ó€Cð �+‰+”eÐ-Ó.Ó
/€CØ�6‰6�%‹=Ðr   c                óÜ   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\        R\        R\        R\         P                  R\         P                  /# rš   r8   )r$   s   "r   r%   r%   ˆ  sl   € ÷ 0ñ 0Ü�<‰<ð0ä�L‰Lð0ô —‘ð0ô ð	0ô
 ð0ô ð0ô �;‰;ð0ô ‡\�\ñ0r   c                 ó²  € V P                   \        P                  \        P                  39   d    V P	                  \        P
                  4      p V P                   \        P
                  8w  d   \        R V P                    24      hW0P                  4       8¼  d   \        RV P                  4        24      h\        WEV4       \        P                  ! WR7      # )r'   rž   r3   )
r   r    r)   r*   r+   r,   r   r‘   r   r4   )r   r›   rœ   r”   r   r   r   s   &&&&&&&r   Úquantize_per_channel_metar§   ‡  sœ   € ð ‡{�{”u—}‘}¤e§n¡nÐ5Ô5Ø—‘œŸ™Ó'ˆØ‡{�{”e—m‘mÔ#ÜØJÈ5Ï;É;È-ÐXó
ð 	
ð �y‰y‹{ÔÜÐ6°u·y±y³{°mÐDÓEÐEÜ 	°eÔ<Ü×Ò˜EÔ/Ð/r   z«dequantize_per_channel(Tensor input, Tensor scales, Tensor? zero_points, int axis, int quant_min, int quant_max, ScalarType dtype, *, ScalarType? out_dtype=None) -> TensorÚdequantize_per_channelc                ó  € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R,          R\        R\        R\        R\         P                  R	\         P                  R,          R
\         P                  /	# ©r   r   r›   rœ   Nr”   r   r   r   rN   r   r8   )r$   s   "r   r%   r%   ¨  s„   € ÷ =ñ =Ü�<‰<ð=ä�L‰Lð=ô —‘ Õ$ð=ô ð	=ô
 ð=ô ð=ô �;‰;ð=ô �{‰{˜TÕ!ð=ô ‡\�\ñ=r   c               óB  € V P                   V8w  d   \        RV RV P                    24      hVf   \        P                  pW0P	                  4       8¼  d   \        RV P	                  4        24      h\        WEV4       \        W4      w  r^.V P	                  4       ,          p	VP                  ^ ,          V	^ &   VP                  V	4      pVe    WP                  V	4      ,
          V,          p
MW,          p
V
P                  V4      p
V
P                  \        V4      4      pV# )aO  Affine per channel dequantization for the Tensor using the same quantization
parameters for each channel/axis to map from quantized values to floating point values

Args:
   input (torch.Tensor): Tensor with dtype matching `dtype` argument,
   e.g. (`torch.uint8`), it is a per channel quantized Tensor if combined with
   quantization parameter in the argument of this function (scales/zero_points/axis)

   scales (torch.Tensor): a list of scale quantization parameter for
   affine quantization, one per channel

   zero_points (torch.Tensor): a list of zero_point quantization parameter for
   affine quantization, one per channel

   quant_min (int): minimum quantized value for output Tensor (not used in computation,
   reserved for pattern matching)

   quant_max (int): maximum quantized value for output Tensor (not used in computation,
   reserved for pattern matching)

   dtype (torch.dtype): requested dtype for output Tensor (not used in computation,
   reserved for pattern matching)

   out_dtype (torch.dtype?): optional dtype for output Tensor

Returns:
   dequantized float32 Tensor
rR   ú, but got dtype: rž   )r   r   r    r,   r‘   r   r—   rŸ   r    r+   r’   rn   )r   r›   rœ   r”   r   r   r   rN   r¡   r¢   r£   r¤   s   &&&&&&&$    r   r¨   r¨   §  sý   € ðP ‡{�{�eÔÜØ-¨e¨WÐ4EÀeÇkÁkÀ]ÐSó
ð 	
ð ÒÜ—M‘Mˆ	Ø�y‰y‹{ÔÜÐ6°u·y±y³{°mÐDÓEÐEÜ 	°eÔ<Ü4°UÓAÑ€Eà��e—i‘i“kÕ!€IØ—<‘< •?€Iˆa�LØ�[‰[˜Ó#€FØÒØ×'Ñ'¨	Ó2Õ2°fÕ<‰à�nˆà
�&‰&�Ó
€Cà
�+‰+”eÐ-Ó.Ó
/€CØ€Jr   c                ó  € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R,          R\        R\        R\        R\         P                  R	\         P                  R,          R
\         P                  /	# rª   r8   )r$   s   "r   r%   r%   é  s„   € ÷ 4ñ 4Ü�<‰<ð4ä�L‰Lð4ô —‘ Õ$ð4ô ð	4ô
 ð4ô ð4ô �;‰;ð4ô �{‰{˜TÕ!ð4ô ‡\�\ñ4r   c                ó(  € V P                   V8w  d   \        R V RV P                    24      hVf   \        P                  pW0P	                  4       8¼  d   \        RV P	                  4        24      h\        WEV4       \        P                  ! WR7      # )zExpecting input to have dtype r¬   rž   r3   )r   r   r    r,   r‘   r   r4   )r   r›   rœ   r”   r   r   r   rN   s   &&&&&&&$r   Údequantize_per_channel_metar¯   è  sƒ   € ð ‡{�{�eÔÜØ,¨U¨GÐ3DÀUÇ[Á[ÀMÐRó
ð 	
ð ÒÜ—M‘Mˆ	Ø�y‰y‹{ÔÜÐ6°u·y±y³{°mÐDÓEÐEÜ 	°eÔ<Ü×Ò˜EÔ3Ð3r   zLchoose_qparams_per_token(Tensor input, ScalarType dtype) -> (Tensor, Tensor)Úchoose_qparams_per_tokenc                ó®   € V ^8„  d   QhR\         P                  R\         P                  R\        \         P                  \         P                  3,          /# ©r   r   r   r   ©r    r!   r   rn   )r$   s   "r   r%   r%   
  s@   € ÷  ñ  Ü�<‰<ð ä�;‰;ð ô Œ5�<‰<œŸ™Ð%Õ&ñ r   c                ó�  € V P                  4       P                  RRR7      pVP                  \        P                  8X  d   VP                  4       pV\        P                  8X  d   ^p^V^,
          ,          ^,
          pM\        RV 24      hVP                  RR7      P                  V4      p\        P                  ! V4      pW%3# )áè  Choose quantization parameters for per token quantization. This means for a N dimension Tensor
(M1, M2, ...Mn, N), we calculate scales/zero_points for each N elements and quantize
every N elements with the same quantization parameter. The dimension for scales/zero_points
will be (M1 * M2 ... * Mn)

Args:
   input (torch.Tensor): original float32/float16 Tensor
   dtype (torch.dtype): dtype (e.g. torch.uint8) for input Tensor

Returns:
    scales and zero_points, both float32 Tensors
T©r‘   Úkeepdimz/unsupported dtype in choose_qparams_per_token: gñhãˆµøä>©Úminéÿÿÿÿ)ÚabsÚamaxr   r    r)   r"   Úint8Ú	Exceptionr-   ÚdivÚ
zeros_like)r   r   r›   Ún_bitsr   rœ   s   &&    r   r°   r°     s°   € ð, �Y‰Y‹[×Ñ "¨dÐÓ3€FØ‡|�|”u—}‘}Ô$à�L‰L‹Nð 	ð ”—
‘
ÔØˆØ˜& 1�*Õ%¨Õ)‰	äØ=¸e¸WÐEó
ð 	
ð �\‰\˜dˆ\Ó#×'Ñ'¨	Ó2€FÜ×"Ò" 6Ó*€KØÐÐr   c                ó®   € V ^8„  d   QhR\         P                  R\         P                  R\        \         P                  \         P                  3,          /# r²   r³   )r$   s   "r   r%   r%   2  ó@   € ÷ ñ Ü�<‰<ðä�;‰;ðô Œ5�<‰<œŸ™Ð%Õ&ñr   c                 ó  € \        V P                  R R 4      ^.,           p\        P                  ! V\        P                  V P
                  R7      \        P                  ! V\        P                  V P
                  R7      3# ©Nr„   rº   ©r�   rŸ   r    r†   r‡   r…   rˆ   ©r   r   Úsizes   && r   Úchoose_qparams_per_token_metarÉ   -  ó]   € ô �—‘˜C˜RÐ Ó! Q CÕ'€DÜ�;Š;�t¤5§<¡<¸¿¹ÔEÄuÇ{Â{Ø”E—K‘K¨¯©ôHð ð r   z]_choose_qparams_per_token_asymmetric_impl(Tensor input, ScalarType dtype) -> (Tensor, Tensor)Ú)_choose_qparams_per_token_asymmetric_implÚCompositeImplicitAutogradc                ó®   € V ^8„  d   QhR\         P                  R\         P                  R\        \         P                  \         P                  3,          /# r²   r³   )r$   s   "r   r%   r%   F  s@   € ÷ (?ñ (?Ü�<‰<ð(?ä�;‰;ð(?ô Œ5�<‰<œŸ™Ð%Õ&ñ(?r   c                ó4  € R^r2\         P                  ! V RRR7      p\         P                  ! V RRR7      p\         P                  ! V\         P                  ! V4      4      p\         P
                  ! V\         P                  ! V4      4      p\         P                  ! \         P                  4      P                  pWv,
          \        W2,
          4      ,          p	V	P                  VR7      p	Wi,          p
Wy,          pW*,           pW;,           p\         P                  ! WÍ,           ^ 8„  W*,
          W;,
          4      p\         P                  ! WâV4      P                  4       pV	P                  \         P                  4      VP                  \         P                  4      3# )rµ   Tr¶   r¸   i€ÿÿÿrº   )r    Úaminr¼   r¹   rÀ   ÚmaxÚfinfor,   rl   r"   r-   Úwherer.   r+   Úfloat64rˆ   )r   r   rj   rk   ry   rz   Úmin_val_negÚmax_val_posrl   r   Údescaled_minÚdescaled_maxÚzero_point_from_min_errorÚzero_point_from_max_errorr   s   &&             r   rË   rË   A  s,  € ð, �sˆ$Ü�jŠj˜ B°Ô5€GÜ�jŠj˜ B°Ô5€GÜ—)’)˜G¤U×%5Ò%5°gÓ%>Ó?€KÜ—)’)˜G¤U×%5Ò%5°gÓ%>Ó?€KÜ
�+Š+”e—m‘mÓ
$×
(Ñ
(€Cð Õ&¬%°µÓ*<Õ<€EØ�K‰K˜CˆKÓ €Eð Õ&€LØÕ&€LØ $Õ 3ÐØ $Õ 3ÐÜ—’Ø!Õ=ÀÑAØÕØÕó€Jô
 —’˜Z¨tÓ4×:Ñ:Ó<€Jà�8‰8”E—M‘MÓ" J§M¡M´%·+±+Ó$>Ð>Ð>r   zWchoose_qparams_per_token_asymmetric(Tensor input, ScalarType dtype) -> (Tensor, Tensor)Ú#choose_qparams_per_token_asymmetricc                ó®   € V ^8„  d   QhR\         P                  R\         P                  R\        \         P                  \         P                  3,          /# r²   r³   )r$   s   "r   r%   r%   {  sE   € ÷ Cñ CÜ�<‰<ðCä�;‰;ðCô Œ5�<‰<œŸ™Ð%Õ&ñCr   c                 ó   € \        W4      # rK   )rË   ©r   r   s   &&r   rÚ   rÚ   v  s   € ô 5°UÓBÐBr   c                ó®   € V ^8„  d   QhR\         P                  R\         P                  R\        \         P                  \         P                  3,          /# r²   r³   )r$   s   "r   r%   r%   ‡  rÃ   r   c                 ó  € \        V P                  R R 4      ^.,           p\        P                  ! V\        P                  V P
                  R7      \        P                  ! V\        P                  V P
                  R7      3# rÅ   rÆ   rÇ   s   && r   Ú(choose_qparams_per_token_asymmetric_metarà   ‚  rÊ   r   c                 ó2  € \         P                  ! \        V P                  4       4      R R 4      pW1P	                  4       8w  d    \        RV RVP                  4        24      hW2P	                  4       8w  d    \        RV RVP                  4        24      hR # )Nznum_tokens: z	 scales: z zero_points: rº   )ÚmathÚprodr�   rÈ   r>   r   )r   r›   rœ   Ú
num_tokenss   &&& r   Ú!_per_token_quant_qparam_dim_checkrå   ‘  s‡   € Ü—’œ4 §
¡
£Ó-¨c¨rÐ2Ó3€JØ—\‘\“^Ô#Ü˜|¨J¨<°yÀÇÁÃÀÐPÓQÐQØ×&Ñ&Ó(Ô(ÜØ˜:˜, n°[×5EÑ5EÓ5GÐ4HÐIó
ð 	
ñ )r   z}quantize_per_token(Tensor input, Tensor scales, Tensor zero_points, int quant_min, int quant_max, ScalarType dtype) -> TensorÚquantize_per_tokenc                ó°   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\        R\        R\         P                  /# ©r   r   r›   rœ   r   r   r   r8   )r$   s   "r   r%   r%   ¢  sT   € ÷ #ñ #Ü�<‰<ð#ä�L‰Lð#ô —‘ð#ô ð	#ô
 ð#ô �;‰;ñ#r   c                óÜ   € \        W4V4       \        WV4       V P                  RV,          4      P                  V4      P	                  4       P                  W44      P                  V4      p V # )aß  Per token quantization for the Tensor using the quantization parameters to map
from floating point to quantized values. This means for a N dimension Tensor
(M1, M2, ...Mn, N), we calculate scales/zero_points for each N elements and quantize
every N elements with the same quantization parameter. The dimension for scales/zero_points
will be (M1 * M2 ... * Mn)

Args:
   input (torch.Tensor): original float32 or bfloat16 Tensor
   scales (float32 torch.Tensor): quantization parameter for per token affine quantization
   zero_points (int32 torch.Tensor): quantization parameter for per token affine quantization
   quant_min (int): minimum quantized value for output Tensor
   quant_max (int): maximum quantized value for output Tensor
   dtype (torch.dtype): requested dtype (e.g. torch.uint8) for output Tensor

Returns:
   Tensor with requested dtype (e.g. torch.uint8), note the quantization parameters
   are not stored in the Tensor, we are storing them in function arguments instead
r(   )r   rå   ÚmulÚaddr.   r-   r+   ©r   r›   rœ   r   r   r   s   &&&&&&r   ræ   ræ   ¡  sX   € ô6   	°eÔ<Ü% e°[ÔAà�	‰	�#˜•,Óß	‰ˆ[Ó	ß	‰‹ß	‰ˆyÓ	$ß	‰ˆE‹ð 
ð €Lr   c                ó°   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\        R\        R\         P                  /# rè   r8   )r$   s   "r   r%   r%   É  sT   € ÷ 	0ñ 	0Ü�<‰<ð	0ä�L‰Lð	0ô —‘ð	0ô ð		0ô
 ð	0ô �;‰;ñ	0r   c                 óH   € \        W4V4       \        P                  ! WR 7      # ©r3   ©r   r    r4   rì   s   &&&&&&r   Úquantize_per_token_metarñ   È  s   € ô   	°eÔ<Ü×Ò˜EÔ/Ð/r   z˜dequantize_per_token(Tensor input, Tensor scales, Tensor zero_points, int quant_min, int quant_max, ScalarType dtype, ScalarType output_dtype) -> TensorÚdequantize_per_tokenc                óÐ   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\        R\        R\         P                  R\         P                  /# ©r   r   r›   rœ   r   r   r   Úoutput_dtyper8   )r$   s   "r   r%   r%   Ü  sb   € ÷ "ñ "Ü�<‰<ð"ä�L‰Lð"ô —‘ð"ô ð	"ô
 ð"ô �;‰;ð"ô —+‘+ñ"r   c                óD   € W,
          p W,          p V P                  V4      # )a©  Per token dequantization for the Tensor using the quantization parameters to map
from floating point to quantized values. This means for a N dimension Tensor
(M1, M2, ...Mn, N), we calculate scales/zero_points for each N elements and quantize
every N elements with the same quantization parameter. The dimension for scales/zero_points
will be (M1 * M2 ... * Mn)

Args:
   input (torch.Tensor): quantized Tensor (uint8, int8 etc.)
   scales (float64 torch.Tensor): quantization parameter for per token affine quantization
   zero_points (int64 torch.Tensor): quantization parameter for per token affine quantization
   quant_min (int): minimum quantized value for input Tensor
   quant_max (int): maximum quantized value for input Tensor
   dtype (torch.dtype): dtype (e.g. torch.uint8) for input Tensor
   output_dtype (torch.dtype): dtype (e.g. torch.float32) for output Tensor

Returns:
   dequantized Tensor with dtype `output_dtype`
)r+   ©r   r›   rœ   r   r   r   rõ   s   &&&&&&&r   rò   rò   Û  s"   € ð8 Õ€EØ�N€Eà�8‰8�LÓ!Ð!r   c                óÐ   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\        R\        R\         P                  R\         P                  /# rô   r8   )r$   s   "r   r%   r%   þ  sb   € ÷ 7ñ 7Ü�<‰<ð7ä�L‰Lð7ô —‘ð7ô ð	7ô
 ð7ô �;‰;ð7ô —+‘+ñ7r   c                 óH   € \        W4V4       \        P                  ! WR 7      # rï   rð   r÷   s   &&&&&&&r   Údequantize_per_token_metarú   ý  s   € ô   	°eÔ<ä×Ò˜EÔ6Ð6r   z•quantize_per_channel_group(Tensor input, Tensor scales, Tensor zero_points, int quant_min, int quant_max, ScalarType dtype, int group_size) -> TensorÚquantize_per_channel_groupc                ó°   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\        R\        R\         P                  /# rè   r8   )r$   s   "r   r%   r%     sT   € ÷ %ñ %Ü�<‰<ð%ä�L‰Lð%ô —‘ð%ô ð	%ô
 ð%ô �;‰;ñ%r   c                 óÚ  € V^8:  d   \        R4      hW`P                  R,          8”  d,   VP                  R,          ^8X  d   V P                  R,          pV P                  R,          V,          ^ 8w  d   \        R4      hV P                  4       ^8w  d   \        R4      hV P                  RV4      p\        P
                  ! V4      P                  4       ^ 8w  d   \        R4      hVP                  R^4      pVP                  R^4      pVP                  RV,          4      P                  V4      P                  4       P                  W44      P                  V4      P                  V 4      pV# )rC   úgroup_size must be > 1ú/input.shape[-1] must be divisible by group_sizeúinput must be 2-dimensionalzto_quant must not contain NaNsr(   rº   )r   rŸ   r‘   Úreshaper    ÚisnanÚsumrê   rë   r.   Úclamp_r+   Ú
reshape_as)	r   r›   rœ   r   r   r   Ú
group_sizeÚto_quantÚ
input_int8s	   &&&&&&&  r   rû   rû     s$  € ð �Q„ÜÐ5Ó6Ð6à—K‘K •OÔ#¨¯©°RÕ(8¸AÔ(=Ø—[‘[ •_ˆ
à‡{�{�2…˜Õ# qÔ(ÜÐNÓOÐOØ‡y�yƒ{�aÔÜÐ:Ó;Ð;ð �}‰}˜R Ó,€HÜ‡{‚{�8Ó× Ñ Ó" aÔ'ÜÐ=Ó>Ð>à�^‰^˜B Ó"€FØ×%Ñ% b¨!Ó,€Kð 	�‰�S˜6•\Ó"ß	‰ˆ[Ó	ß	‰‹ß	‰�	Ó	%ß	‰ˆE‹ß	‰�EÓ	ð ð Ðr   c                ó°   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\        R\        R\         P                  /# rè   r8   )r$   s   "r   r%   r%   ?  sT   € ÷ %0ñ %0Ü�<‰<ð%0ä�L‰Lð%0ô —‘ð%0ô ð	%0ô
 ð%0ô �;‰;ñ%0r   c                ól  € V^8:  d   \        R4      hW`P                  R,          8”  d,   VP                  R,          ^8X  d   V P                  R,          pV P                  R,          V,          ^ 8w  d   \        R4      hV P                  4       ^8w  d   \        R4      h\        P                  ! WR7      # )a  Groupwise quantization within each channel for a 2-d Tensor using the quantization parameters
to map from floating point to quantized values. This means for each row of a 2-d Tensor
(M, N), we calculate scales/zero_points for each `group_size` elements
and quantize every `group_size` elements with the same quantization parameter.
The dimension for scales/zero_points will be (M * ceil(N, group_size),)

Args:
   input (torch.Tensor): original float32 or bfloat16 Tensor
   scales (float32 torch.Tensor): quantization parameter for per channel group affine quantization
   zero_points (int32 torch.Tensor): quantization parameter for per channel group affine quantization
   quant_min (int): minimum quantized value for output Tensor
   quant_max (int): maximum quantized value for output Tensor
   dtype (torch.dtype): requested dtype (e.g. torch.uint8) for output Tensor

Returns:
   Tensor with requested dtype (e.g. torch.uint8), note the quantization parameters
   are not stored in the Tensor, we are storing them in function arguments instead
rþ   rÿ   r   r3   rº   )r   rŸ   r‘   r    r4   )r   r›   rœ   r   r   r   r  s   &&&&&&&r   Úquantize_per_channel_group_metar  >  sŽ   € ð8 �Q„ÜÐ5Ó6Ð6à—K‘K •OÔ#¨¯©°RÕ(8¸AÔ(=Ø—[‘[ •_ˆ
à‡{�{�2…˜Õ# qÔ(ÜÐNÓOÐOØ‡y�yƒ{�aÔÜÐ:Ó;Ð;Ü×Ò˜EÔ/Ð/r   z±dequantize_per_channel_group(Tensor input, Tensor scales, Tensor? zero_points, int quant_min, int quant_max, ScalarType dtype, int group_size, ScalarType output_dtype) -> TensorÚdequantize_per_channel_groupc                óê   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R,          R\        R\        R\         P                  R\        R	\         P                  /# )
r   Úw_int8r›   rœ   Nr   r   r   r  rõ   r8   )r$   s   "r   r%   r%   r  sq   € ÷ .ñ .Ü�L‰Lð.ä�L‰Lð.ô —‘ Õ$ð.ô ð	.ô
 ð.ô �;‰;ð.ô ð.ô —+‘+ñ.r   c                ó–  € V^8:  d   \        R4      hW`P                  R,          8”  d,   VP                  R,          ^8X  d   V P                  R,          pV P                  R,          V,          ^ 8w  d   \        R4      hV P                  4       ^8w  d   \        R4      hV P                  RV4      pVP                  R^4      pVe   VP                  R^4      p	M1\        P
                  ! . \        P                  VP                  R7      p	VP                  V	4      P                  V4      P                  V 4      P                  V4      p
V
# )aä  Groupwise dequantization within each channel for a 2-d Tensor using the quantization parameters
to map from floating point to quantized values. This means for each row of a 2-d Tensor
(M, N), we calculate scales/zero_points for each `group_size` elements
and quantize every `group_size` elements with the same quantization parameter.
The dimension for scales/zero_points will be (M * ceil(N, group_size),)

Args:
   input (torch.Tensor): quantized Tensor (uint8/int8 etc.)
   scales (float32 torch.Tensor): quantization parameter for per channel group affine quantization
   zero_points (int32 torch.Tensor): quantization parameter for per channel group affine quantization
   quant_min (int): minimum quantized value for input Tensor
   quant_max (int): maximum quantized value for input Tensor
   dtype (torch.dtype): dtype (e.g. torch.uint8) for input Tensor
   output_dtype (torch.dtype): dtype (e.g. torch.float32) for output Tensor

Returns:
   dequantized Tensor with dtype `output_dtype`
rþ   z0w_int8.shape[-1] must be divisible by group_sizezw_int8 must be 2-dimensionalr„   rº   )r   rŸ   r‘   r  r    ÚzerosÚint32r…   Úsubrê   r  r+   )r  r›   rœ   r   r   r   r  rõ   Úw_int8_groupedÚzpÚw_dqs   &&&&&&&&   r   r  r  m  s	  € ðD �Q„ÜÐ5Ó6Ð6à—L‘L Õ$Ô$¨¯©°bÕ)9¸QÔ)>Ø—\‘\ "Õ%ˆ
Ø‡|�|�BÕ˜*Õ$¨Ô)ÜÐOÓPÐPØ‡z�zƒ|�qÔÜÐ;Ó<Ð<à—^‘^ B¨
Ó3€NØ�^‰^˜B Ó"€FØÒØ× Ñ   QÓ'‰ä�[Š[˜¤5§;¡;°v·}±}ÔEˆØ×Ñ˜bÓ!×%Ñ% fÓ-×8Ñ8¸Ó@×CÑCÀLÓQ€DØ€Kr   zyfake_quant_per_channel(Tensor input, Tensor scales, Tensor zero_points, int axis, int quant_min, int quant_max) -> Tensorc                   ó@   a € ] tR tRt o ]R 4       t]R 4       tRtV tR# )ÚFakeQuantPerChanneli©  c                ón  € VP                   \        P                  8w  d    VP                  \        P                  4      pVP                   \        P                  8w  d    VP                  \        P                  4      pVP                   \        P                  8w  d   \        R VP                    24      hWAP                  4       8¼  d   \        RVP                  4        24      h\        \        V4      4      \        \        V^,           VP                  4      4      ,           p\        W'4      p\        W74      p	\        P                  ! VRV,          ,          4      V	,           p
\        P                  ! W¥V4      V	,
          V,          p\        P                  ! W¥8¬  W¦8*  4      pV P                  V4       V# )r'   rž   r(   )r   r    r,   r+   r  r   r‘   r�   r�   Úndimr   r.   r-   Úlogical_andÚsave_for_backward)Úctxr   r›   rœ   r”   r   r   Úbroadcast_dimsÚunsqueeze_scalesÚunsqueeze_zero_pointsÚtempr¤   Úmasks   &&&&&&&      r   ÚforwardÚFakeQuantPerChannel.forwardª  sC  € ð �<‰<œ5Ÿ=™=Ô(Ø—Y‘YœuŸ}™}Ó-ˆFØ×Ñ¤§¡Ô+Ø%Ÿ.™.¬¯©Ó5ˆKØ�;‰;œ%Ÿ-™-Ô'Ü ØNÈuÏ{É{ÈmÐ\óð ð —9‘9“;ÔÜ Ð#:¸5¿9¹9»;¸-Ð!HÓIÐIÜœe D›kÓ*¬T´%¸¸q½À%Ç*Á*Ó2MÓ-NÕNˆÜ.¨vÓFÐÜ 3°KÓ PÐÜ�{Š{˜5 CÐ*:Õ$:Õ;Ó<Ð?TÕTˆä�KŠK˜¨Ó3Ð6KÕKØõˆô × Ò  $Ñ"3°tÑ7HÓJˆà×Ñ˜dÔ#Øˆ
r   c                ó:   € V P                   w  pW,          R R R R R 3# rK   )Úsaved_tensors)r  Úgyr!  s   && r   ÚbackwardÚFakeQuantPerChannel.backwardÃ  s&   € ð ×#Ñ#‰ˆØ�y˜$  d¨D°$Ð6Ð6r   © N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ústaticmethodr"  r'  Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r   r  r  ©  s+   ø‡ € Øñó ðð. ñ7ó ö7r   r  Úfake_quant_per_channelÚAutogradc                ó¼   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\        R\        R\        R\         P                  /# ©r   r   r›   rœ   r”   r   r   r   ©r    r!   r#   )r$   s   "r   r%   r%   Ë  s^   € ÷ 
ñ 
Ü�<‰<ð
ä�L‰Lð
ô —‘ð
ô ð	
ô
 ð
ô ð
ô ‡\�\ñ
r   c                 ó0   € \         P                  WW#WE4      # rK   )r  Úapply©r   r›   rœ   r”   r   r   s   &&&&&&r   r2  r2  Ê  s   € ô ×$Ñ$Ø�{¨)óð r   c                ó¼   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  R\        R\        R\        R\         P                  /# r5  r6  )r$   s   "r   r%   r%   Ù  s^   € ÷ #ñ #Ü�<‰<ð#ä�L‰Lð#ô —‘ð#ô ð	#ô
 ð#ô ð#ô ‡\�\ñ#r   c                 ó.   € \         P                  ! V 4      # rK   ©r    r4   r9  s   &&&&&&r   Úfake_quant_per_channel_metar=  Ø  s   € ô ×Ò˜EÓ"Ð"r   zFconvert_element_type.no_fuse(Tensor input, ScalarType dtype) -> Tensorzconvert_element_type.no_fusec                óx   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  /# r²   rF   )r$   s   "r   r%   r%   î  s2   € ÷ Fñ F¤§¡ð F´U·[±[ð FÄUÇ\Á\ñ Fr   c                 óh   € \         P                  P                  P                  P	                  W4      # rK   )r    ÚopsÚprimsÚconvert_element_typeÚdefaultrÝ   s   &&r   rB  rB  é  s#   € ô �9‰9�?‰?×/Ñ/×7Ñ7¸ÓEÐEr   c                óx   € V ^8„  d   QhR\         P                  R\         P                  R\         P                  /# r²   rF   )r$   s   "r   r%   r%   ó  s-   € ÷ 0ñ 0¤U§\¡\ð 0¼%¿+¹+ð 0Ì%Ï,É,ñ 0r   c                 ó0   € \         P                  ! WR 7      # rï   r<  rÝ   s   &&r   Úconvert_element_type_metarF  ò  s   € ä×Ò˜EÔ/Ð/r   )é€   )Grâ   r    Útorch._refsr   Útorch.ao.quantization.utilsr   r   Útorch.libraryr   r   Úquantized_decomposed_libÚuint8r½   Úuint16Úint16r  Ú_INTEGER_DTYPESÚfloat8_e5m2Úfloat8_e4m3fnÚ_FLOAT_DTYPESÚiinfor¹   rÐ   r   Úupdater#   rÑ   r   Údefiner   r6   r@   rD   rH   rL   rM   rX   r^   ra   rd   rg   r{   r€   rŠ   r�   r—   r˜   r§   r¨   r¯   r°   rÉ   rË   rÚ   rà   rå   ræ   rñ   r,   rò   rú   rû   r  r  ÚautogradÚFunctionr  r2  r=  rB  rF  )Úks   0r   Ú<module>rY     sÚ  ðã ã Ý +ß Mß 'ñ
 #Ð#9¸5ÓAÐ à—;‘; §
¡
¨E¯L©L¸%¿+¹+ÀuÇ{Á{ÐS€Ø×"Ñ" E×$7Ñ$7Ð8€ñ :IóÙ9H°Aˆ�‰�A‹×Ñ˜EŸK™K¨›N×.Ñ.Ð/Ò/¹ñÐ ð × Ñ ÙDQÓRÁM¸q‰ˆU�[‰[˜‹^×ÑÓ	 ¡# e§k¡k°!£n×&8Ñ&8Ó"9Ð:Ò:ÁMÑRôò
ð$ × Ñ ð@ôñ ÐÐ 5Ð7RÓSô"ó Tð"ñJ ÐÐ 5°vÓ>ô0ó ?ð0ð" × Ñ ð@ôñ ØÐ:Ð<Wóôóðñ> ÐÐ <¸fÓEô0ó Fð0ð4 × Ñ ðFôñ ØÐ;Ð=Xóôóðñ> ÐÐ =¸vÓFôó Gðð, × Ñ ð_ôñ ÐÐ 7Ð9TÓUð0Qð %)ö0Qó Vð0Qñf ÐÐ 7¸Ó@ð4ð %)ö4ó Að4ð × Ñ ð_ôñ ØØ"Øóð
ð %)öóð
ñD ÐÐ >ÀÓGðQð %)öQó HðQð> × Ñ ðeôñ ØØ#Øóð
ð %)öóð
ñD ÐÐ ?ÀÓHðð %)öó Iðð × Ñ ð7ôñ ÐÐ 7Ð9TÓUô(ó Vð(ðV × Ñ ð7ôñ ØØ%Øóô
(óð
(ñV ÐÐ 7¸Ó@ôó Aðñ( ÐÐ AÀ6ÓJôó Kðòð × Ñ ð@ôñ ÐÐ 6Ð8SÓTô.ó Uð.ñb ÐÐ 6¸Ó?ô0ó @ð0ð2 × Ñ ð_ôñ ÐÐ 8Ð:UÓVð=ð %)ö=ó Wð=ñ@ ÐÐ 8¸&ÓAð4ð %)ö4ó Bð4ð. × Ñ ØRôñ
 ØØØóô
 óð
 ñF ØØØ
óô
óð
ð × Ñ Øcôñ
 ØØ/Øóô
(?óð
(?ðV × Ñ Ø]ôñ
 ØØ)Øóô
Cóð
Cñ ØØ)Ø
óô
óð
ò
ð × Ñ ð@ôñ ÐÐ 4Ð6QÓRô#ó Sð#ñL ÐÐ 4°fÓ=ô	0ó >ð	0ð × Ñ ðYôñ ÐÐ 6Ð8SÓTð !&§¡ö"ó Uð"ñB ÐÐ 6¸Ó?ð !&§¡ö7ó @ð7ð × Ñ ðAôñ ØÐ:Ð<Wóö%óð%ñP ÐÐ <¸fÓEö%0ó Fð%0ðP × Ñ ðZôñ ØØ"Øóð Ø %§¡ö.óð
.ðb × Ñ ð.ôô7˜%Ÿ.™.×1Ñ1ô 7ñB ÐÐ 8¸*ÓEô
ó Fð
ñ ÐÐ 8¸&ÓAô#ó Bð#ð × Ñ ØLôñ
 ØØ"Øóô
Fóð
Fñ ÐÐ >ÀÓGô0ó Hò0ùòE'ùò Ss   Á=?VÃAV
