From ecd2052d8106bc81a866f4d80ed5906d99437eec Mon Sep 17 00:00:00 2001 From: Michael McGeagh Date: Fri, 31 Jul 2020 16:59:45 +0100 Subject: 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 Change-Id: I33ef118bd6a31ac78c680acb5229ff31b0809d6a --- ethosu/vela/supported_operators.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ethosu') 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 -- cgit v1.2.1