google / google/qkeras

max method of quantized_bits returns incorrect values

Open
#71 1 comment 0 reactions 1 assignee Claimed by @danielemoro View on GitHub
Dominant language
Python
Stars
584
Forks
108
PR merge metrics
No merged PRs in 30d

Description

Hi,

I've noticed that the max method of quantized_bits doesn't return correct values.
According to the documentation, the max method should return the largest value which can be represented by the quantizer.
Defining an unsigned 8-Bit quantization with zero integer bits, the quantizer correctly quantizes
the value `1.0` to `0.99609375`, which is the larges number which can be represented in this configuration.
But the max method returns `1.0`.

Minimum example:
```python
import qkeras as qk

quantizer = qk.quantized_bits(8, 0, 0, False)
x = 1.0
xq = quantizer(x)
q_max = quantizer.max()
print('x: {0}, xq: {1}, q_max: {2}'.format(x, xq, q_max))
```

Output:
> x: 1.0, xq: 0.99609375, q_max: 1.0

Expected Output:
> x: 1.0, xq: 0.99609375, q_max: 0.99609375

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.