aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/supported_operators.py
diff options
context:
space:
mode:
authorPatrik Gustavsson <patrik.gustavsson@arm.com>2020-11-13 09:02:31 +0100
committerpatrik.gustavsson <patrik.gustavsson@arm.com>2020-11-16 09:11:31 +0000
commit2fa1588f9128e077ec02d195356e89eb17452f3f (patch)
treec519d61e20598f737e4675480eec3413ca73c627 /ethosu/vela/supported_operators.py
parente05de456770926fdc057478739d1b96b7f651756 (diff)
downloadethos-u-vela-2fa1588f9128e077ec02d195356e89eb17452f3f.tar.gz
MLBEDSW-3350 Put softmax on CPU if beta < 0
Put softmax on CPU if beta < 0 Signed-off-by: Patrik Gustavsson <patrik.gustavsson@arm.com> Change-Id: I4ec866dd44d14e2737c4cd96474e54bb770bfb3e
Diffstat (limited to 'ethosu/vela/supported_operators.py')
-rw-r--r--ethosu/vela/supported_operators.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/ethosu/vela/supported_operators.py b/ethosu/vela/supported_operators.py
index b537b650..46f7a5d3 100644
--- a/ethosu/vela/supported_operators.py
+++ b/ethosu/vela/supported_operators.py
@@ -212,6 +212,7 @@ class SupportedOperators:
# Softmax specific checks:
self.specific_constraints[Op.Softmax].append(SupportedOperators.constraint_matching_shapes)
self.specific_constraints[Op.Softmax].append(SupportedOperators.constraint_matching_in_out_types)
+ self.specific_constraints[Op.Softmax].append(SupportedOperators.constraint_beta_value_range)
# SplitV specific checks:
self.specific_constraints[Op.SplitV].append(SupportedOperators.constraint_splitv_inferred)
@@ -560,6 +561,13 @@ class SupportedOperators:
return valid, f"Op has ifm_dtype={ifm_dtype} and ofm_dtype={ofm_dtype}"
@staticmethod
+ def constraint_beta_value_range(op):
+ "Beta value needs to be positive"
+ beta = op.attrs.get("beta", 1.0)
+ valid = beta >= 0
+ return valid, f"Op has beta={beta}"
+
+ @staticmethod
def constraint_filter_type(op):
"Kernel filter values for both width and height must be integer types"
w = op.kernel.width