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)[原始碼][原始碼]¶
用於指定給定 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。