From 8854dc9088586e1bb0bf2640b2289903dfa3c822 Mon Sep 17 00:00:00 2001 From: Andreas Nevalainen Date: Thu, 24 Sep 2020 13:43:00 +0200 Subject: MLBEDSW-2788 Fix crash on non-constant weight tensors Change-Id: I750ec63a0e37b38feaf4cbdcc883fdbef92bccdf Signed-off-by: Andreas Nevalainen --- ethosu/vela/supported_operators.py | 10 +++++----- 1 file 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): -- cgit v1.2.1