aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Nevalainen <andreas.nevalainen@arm.com>2020-09-24 13:43:00 +0200
committerAndreas Nevalainen <andreas.nevalainen@arm.com>2020-09-24 13:48:01 +0200
commit8854dc9088586e1bb0bf2640b2289903dfa3c822 (patch)
treec7a09788b7cb89f4e28835fc95ded6a8cf3a1cd8
parent6c97e9a689736febf76c739c6b677d1b253048e5 (diff)
downloadethos-u-vela-8854dc9088586e1bb0bf2640b2289903dfa3c822.tar.gz
MLBEDSW-2788 Fix crash on non-constant weight tensors
Change-Id: I750ec63a0e37b38feaf4cbdcc883fdbef92bccdf Signed-off-by: Andreas Nevalainen <andreas.nevalainen@arm.com>
-rw-r--r--ethosu/vela/supported_operators.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/ethosu/vela/supported_operators.py b/ethosu/vela/supported_operators.py
index b0afa2c9..63eb01b5 100644
--- a/ethosu/vela/supported_operators.py
+++ b/ethosu/vela/supported_operators.py
@@ -215,6 +215,11 @@ class SupportedOperators:
if dilated_weight_w > 64 or dilated_weight_h > 64:
return False
+ # check non const weights
+ if weight_tensor.values is None:
+ print("Warning:", op.type, "has non-const weights, placing on CPU")
+ return False
+
# check weight sums over [HWI]
zero_point = weight_tensor.quantization.zero_point
quant_weights = weight_tensor.quant_values.astype(np.int64)
@@ -228,11 +233,6 @@ class SupportedOperators:
if ifm_tensor.shape[0] != 1:
return False
- # check non const weights
- if weight_tensor.values is None:
- print("Warning:", op.type, "has non-const weights, placing on CPU")
- return False
-
return True
def check_depthwise_convolution_restrictions(self, op):