aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Nevalainen <andreas.nevalainen@arm.com>2020-09-01 15:36:26 +0200
committerpatrik.gustavsson <patrik.gustavsson@arm.com>2020-09-28 10:21:54 +0000
commiteadb166072958febd7e222297d2a65bcf6063f01 (patch)
treecdfdbdf21b4e222cea62169576a527be0452dedd
parentfa2f92a51246630532d53b24228b7620b66595d1 (diff)
downloadethos-u-vela-eadb166072958febd7e222297d2a65bcf6063f01.tar.gz
MLBEDSW-2885: Fix overflow from inf number
Added check for inf numbers for all scales. Signed-off-by: Andreas Nevalainen <andreas.nevalainen@arm.com> Change-Id: I84fcae429be4869d8489f66bef26863c254104cd
-rw-r--r--ethosu/vela/supported_operators.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/ethosu/vela/supported_operators.py b/ethosu/vela/supported_operators.py
index 9e9da8c6..0a1af829 100644
--- a/ethosu/vela/supported_operators.py
+++ b/ethosu/vela/supported_operators.py
@@ -192,6 +192,16 @@ class SupportedOperators:
and op.attrs["fused_activation_function"] not in self.supported_fused_activations
):
return False
+
+ # check inf values
+ for tens in op.get_ifm_ifm2_weights_ofm():
+ if (tens is not None) and (
+ tens.quantization is not None) and (
+ tens.quantization.scale_f32 is not None) and (
+ np.isinf(tens.quantization.scale_f32).any()):
+ print("Warning:", op.type, "has inf valued tensor(s), placing on CPU")
+ return False
+
return True
def check_convolution_restrictions(self, op):