choose_qparams_affine_with_min_max¶
- torchao.quantization.choose_qparams_affine_with_min_max(min_val: Tensor, max_val: Tensor, mapping_type: MappingType, block_size: Tuple[int, ...], target_dtype: dtype, quant_min: Optional[int] = None, quant_max: Optional[int] = None, eps: Optional[float] = None, scale_dtype: Optional[dtype] = None, zero_point_dtype: Optional[dtype] = None, preserve_zero: bool = True, zero_point_domain: ZeroPointDomain = ZeroPointDomain.INT) Tuple[Tensor, Tensor] [source]¶
A variant of
choose_qparams_affine()
operator that pass in min_val and max_val directly instead of deriving these from a single input. This is used for observers in static quantization where min_val and max_val may be obtained through tracking all the data in calibration data set.:param Mostly same as
choose_qparams_affine()
. with one: :param difference: instead of passing in input Tensor and use that to calculate min_val/max_val :param and then scale/zero_point: :param we pass in min_val/max_val directly: