aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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