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][source]¶
用于指定给定 dtype 的附加约束的配置,例如量化值范围、比例值范围和固定量化参数,用于
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。