diff options
author | Jacob Bohlin <jacob.bohlin@arm.com> | 2020-08-20 15:51:37 +0200 |
---|---|---|
committer | Jacob Bohlin <jacob.bohlin@arm.com> | 2020-08-21 11:57:51 +0200 |
commit | 1cdc4675bab71c8a8d15b1687790954dab42ddd1 (patch) | |
tree | 3de5fd7a8d13f2a48e690d4a16391804b8d1ef48 /ethosu | |
parent | 6c87807ad1dc2ac35b05cb1e375544f04e123db1 (diff) | |
download | ethos-u-vela-1cdc4675bab71c8a8d15b1687790954dab42ddd1.tar.gz |
Added a lower bound for the valid range of shift
Very small quantization scales, below around 2^-31, would return
negative shift values.
Signed-off-by: Jacob Bohlin <jacob.bohlin@arm.com>
Change-Id: I4ca368284c097820f83e5ae53412a08c34516c7f
Diffstat (limited to 'ethosu')
-rw-r--r-- | ethosu/vela/scaling.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ethosu/vela/scaling.py b/ethosu/vela/scaling.py index 7019c217..fcf054e0 100644 --- a/ethosu/vela/scaling.py +++ b/ethosu/vela/scaling.py @@ -33,7 +33,7 @@ def quantise_scale(scale): exponent_q31 = exponent - 31 shift = exponent_q31 * -1 - if shift >= (1 << 6): + if not (0 <= shift < (1 << 6)): # Shift outside of valid range, set scale to 0 return 0, 16 |