From 67e0d8f24fcb86115e834acd19dc57027b03ea4f Mon Sep 17 00:00:00 2001 From: Jacob Bohlin Date: Thu, 20 Aug 2020 10:53:02 +0200 Subject: MLBEDSW-2663: Handle optional tensors Includes a number of changes: * Handle non-existing optional inputs * Handle disabled optional inputs (-1 indexed) * Added unit tests for parsing operators * Add bias tensor to the different Convolutions + FullyConnected if it's missing. Signed-off-by: Jacob Bohlin Change-Id: Ib88d2b610314b1c886fc0aef4f9da87430ce6ae5 --- ethosu/vela/supported_operators.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'ethosu/vela/supported_operators.py') diff --git a/ethosu/vela/supported_operators.py b/ethosu/vela/supported_operators.py index 9e415b51..e6aaca31 100644 --- a/ethosu/vela/supported_operators.py +++ b/ethosu/vela/supported_operators.py @@ -131,22 +131,32 @@ class SupportedOperators: def check_generic_restrictions(self, op): # check fully defined shapes for t in op.inputs: + if not t: + continue if not t.has_fully_defined_shape(): print("Warning:", op.type, "has input(s) of undefined shape, placing on CPU") return False if t.shape == [] and op.type not in self.binary_elem_wise_main_ops: - print("Warning:", op.type, "has input(s) of shape [].", - "Scalar input or broadcasting is not supported for this operator,", - "placing on CPU") + print( + "Warning:", + op.type, + "has input(s) of shape [].", + "Scalar input or broadcasting is not supported for this operator,", + "placing on CPU", + ) return False for t in op.outputs: if not t.has_fully_defined_shape(): print("Warning:", op.type, "has output(s) of undefined shape, placing on CPU") return False if t.shape == []: - print("Warning:", op.type, "has output(s) of shape [].", - "Scalar input or broadcasting is not supported for this operator,", - "placing on CPU") + print( + "Warning:", + op.type, + "has output(s) of shape [].", + "Scalar input or broadcasting is not supported for this operator,", + "placing on CPU", + ) return False # check data type -- cgit v1.2.1