qkeras icon indicating copy to clipboard operation
qkeras copied to clipboard

removed the integer and bits scaling in quantized bits for alpha=auto and alpha=auto_po2

Open fabrizioaymone opened this issue 1 year ago • 1 comments

In the quantized_bits class, when alpha=auto or alpha=auto_po2, the unquantized value "x" is manipulated in a strange way. Even if the number of integer bits is not considered when scaling with alpha=auto and alpha=auto_po2, "x" is divided by m_i (, namely 2**integer_bits) to be later remultiplied by the same value m_i. As x is originally divided by m_i, z (which depends on x) is later multiplied by m_i and divided by m. In order to adjust for the division by m, the scale factor (which multiplies z) is multiplied by m.

I removed the m_i and m references in the code as they don't matter when considering alpha=auto or alpha=auto_po2. I also tested this new version of the quantizer with older versions and the result is the same.

fabrizioaymone avatar Mar 10 '24 11:03 fabrizioaymone

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Mar 10 '24 11:03 google-cla[bot]