Redefine symmetry as offset=-round((qmin + qmax) / 2) #3718
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem Statement
Given an unsigned asymmetric quantizer, setting
quantizer.symmetric = True
only turns it into an unsigned symmetric quantizer.This is problematic for three reasons
Proposal
I propose redefining symmetry as below:
offset = -round((qmin+qmax) / 2)
In a sense, this is a generalized version of the current definition of symmetry (
offset = 0
) because, with the new definition, floating point 0.0 will always line up with the midpoint of the integer grid -- 0 if int8, 128 if uint8.This new definition has the following pros and cons
Pros:
Cons:
Particularly, quantizer.signed = False and quantizer.symmetric = True doesn't mean what we've been conventionally referring to as "unsigned symmetry".