Skip to content

Commit d13c789

Browse files
Arm backend: Update bias quantization range (#15918)
Bias range was [-2147483648, 2147483646] which isn't really symmetric. This patch changes the range to [-2147483647, 2147483647]. Signed-off-by: Oscar Andersson <[email protected]>
1 parent e37062e commit d13c789

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

backends/arm/quantizer/arm_quantizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def get_symmetric_a16w8_quantization_config(
209209
# 16-bit activation quantization spec
210210
act_quantization_spec = QuantizationSpec(
211211
dtype=torch.int16,
212-
quant_min=torch.iinfo(torch.int16).min, # -32768
212+
quant_min=torch.iinfo(torch.int16).min + 1, # -32767
213213
quant_max=torch.iinfo(torch.int16).max, # 32767
214214
qscheme=torch.per_tensor_symmetric,
215215
is_dynamic=is_dynamic,

backends/arm/quantizer/quantization_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ def _derive_qparams_fn(
206206
derived_from=[(input_act, node), (weight, node)], # type: ignore[list-item]
207207
derive_qparams_fn=_derive_qparams_fn,
208208
dtype=torch.int32,
209-
quant_min=torch.iinfo(torch.int32).min,
210-
quant_max=torch.iinfo(torch.int32).max - 1,
209+
quant_min=torch.iinfo(torch.int32).min + 1,
210+
quant_max=torch.iinfo(torch.int32).max,
211211
qscheme=qscheme,
212212
ch_axis=ch_axis,
213213
)

0 commit comments

Comments
 (0)