DTypeWithConstraints#
- class torch.ao.quantization.backend_config.DTypeWithConstraints(dtype=None, quant_min_lower_bound=None, quant_max_upper_bound=None, scale_min_lower_bound=None, scale_max_upper_bound=None, scale_exact_match=None, zero_point_exact_match=None)[source]#
用于指定给定数据类型的附加约束的配置,例如量化值范围、尺度值范围和固定量化参数,用于
DTypeConfig
。目前支持的约束包括
quant_min_lower_bound 和 quant_max_upper_bound:量化值的最小值和最大值的下限和上限。如果 QConfig 的 quant_min 和 quant_max 超出此范围,则忽略该 QConfig。
scale_min_lower_bound 和 scale_max_upper_bound:尺度值的最小值和最大值的下限和上限。如果 QConfig 的最小尺度值(当前暴露为 eps)低于下限,则忽略该 QConfig。请注意,上限目前未强制执行。
scale_exact_match 和 zero_point_exact_match:尺度和零点的精确匹配要求,用于具有固定量化参数的算子(例如 sigmoid 和 tanh)。如果 QConfig 中指定的观察器不是 FixedQParamsObserver 或 FixedQParamsFakeQuantize,或者量化参数不匹配,则忽略该 QConfig。