aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Bohlin <jacob.bohlin@arm.com>2020-08-31 10:14:02 +0200
committerpatrik.gustavsson <patrik.gustavsson@arm.com>2020-08-31 12:57:53 +0000
commitc3c08d848642431243c71da366883137d2bcfc28 (patch)
tree63e3f6114bd40aa2906bf4f8884aca36b6617372
parent258ebbaee96fb24543bde99c3e48ae69d9d5486f (diff)
downloadethos-u-vela-c3c08d848642431243c71da366883137d2bcfc28.tar.gz
MLBEDSW-2804: Removed invalid assert for shift range
Signed-off-by: Jacob Bohlin <jacob.bohlin@arm.com> Change-Id: I857aeb7aeb34f4b8ea47e6ac954cead268335e32
-rw-r--r--ethosu/vela/scaling.py4
-rw-r--r--ethosu/vela/weight_compressor.py3
2 files changed, 4 insertions, 3 deletions
diff --git a/ethosu/vela/scaling.py b/ethosu/vela/scaling.py
index fcf054e0..74f21660 100644
--- a/ethosu/vela/scaling.py
+++ b/ethosu/vela/scaling.py
@@ -46,6 +46,10 @@ def reduced_quantise_scale(scale):
reduced_multiplier = int((multiplier + (1 << 15)) >> 16)
reduced_shift = shift - 16
+ if not (0 <= shift < (1 << 6)):
+ # Shift outside of valid range, set scale to 0
+ return 0, 16
+
return reduced_multiplier, reduced_shift
diff --git a/ethosu/vela/weight_compressor.py b/ethosu/vela/weight_compressor.py
index a275e412..175646b8 100644
--- a/ethosu/vela/weight_compressor.py
+++ b/ethosu/vela/weight_compressor.py
@@ -460,9 +460,6 @@ def calc_scales_and_pack_biases(tens, arch, ofm_depth_step, rescale_for_faf=Fals
else:
quantised_scales = [quantise_scale(scale) for scale in scales]
- for _, shift in quantised_scales:
- assert shift >= 16
-
# pack the biases and scales
if len(quantised_scales) == 1:
# If only 1 quantised scale is used, repeat that value for the length of the biases