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)[源代码]#
用于在
DTypeConfig
中指定给定 dtype 的额外约束的配置,例如量化值范围、比例值范围和固定量化参数。当前支持的约束有:
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。