Skip to content

Commit

Permalink
fix symmetric zero points for unit8 quantization (#604) (#605)
Browse files Browse the repository at this point in the history
  • Loading branch information
bfineran committed Mar 10, 2022
1 parent 33d764a commit 45e8c28
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/sparseml/pytorch/sparsification/quantization/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,11 @@ def fix_observer_quant_range(module: Module):
fake_quantize.quant_min is None
or fake_quantize.quant_max is None
or (observer.quant_min is not None or observer.quant_max is not None)
or ( # do not propagate default uint8 symmetric range
observer.qscheme == torch.per_tensor_symmetric
and fake_quantize.quant_min == 0
and fake_quantize.quant_max == 255
)
):
continue
observer.quant_min = fake_quantize.quant_min
Expand Down

0 comments on commit 45e8c28

Please sign in to comment.