aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael McGeagh <michael.mcgeagh@arm.com>2020-07-31 16:59:45 +0100
committerMichael McGeagh <michael.mcgeagh@arm.com>2020-08-06 10:11:38 +0100
commitecd2052d8106bc81a866f4d80ed5906d99437eec (patch)
treed39d02d6e43b01880f9b379c492eefb59dee2913
parent36ffaf3b7b5eda1cc1e88a8dc2a0882d910742bd (diff)
downloadethos-u-vela-ecd2052d8106bc81a866f4d80ed5906d99437eec.tar.gz
MLBEDSW-2549 Crash with incorrect strided slice op
A valid strided slice should have (positive) non-zero elements when you do "end - begin" When encountering an invalid strided slice, vela asserted. This now checks that it is valid and wont claim support if it isnt. Signed-off-by: Michael McGeagh <michael.mcgeagh@arm.com> Change-Id: I33ef118bd6a31ac78c680acb5229ff31b0809d6a
-rw-r--r--ethosu/vela/supported_operators.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/ethosu/vela/supported_operators.py b/ethosu/vela/supported_operators.py
index b5853236..43ba36f0 100644
--- a/ethosu/vela/supported_operators.py
+++ b/ethosu/vela/supported_operators.py
@@ -330,6 +330,9 @@ class SupportedOperators:
# check stride size
if len(op.inputs) > 3 and any(stride != 1 for stride in op.inputs[3].values):
return False
+ # check "end - begin" doesnt result in any zero or negative elements
+ if any((end - begin) <= 0 for begin, end in zip(op.inputs[1].values, op.inputs[2].values)):
+ return False
# check ellipsis_mask
if op.attrs["ellipsis_mask"] != 0:
return False