aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/tflite_model_semantic.py
diff options
context:
space:
mode:
Diffstat (limited to 'ethosu/vela/tflite_model_semantic.py')
-rw-r--r--ethosu/vela/tflite_model_semantic.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/ethosu/vela/tflite_model_semantic.py b/ethosu/vela/tflite_model_semantic.py
index 6ba7b835..66770487 100644
--- a/ethosu/vela/tflite_model_semantic.py
+++ b/ethosu/vela/tflite_model_semantic.py
@@ -92,6 +92,7 @@ class TFLiteSemantic:
def __init__(self):
# Setup the generic constraints. Note: the order matters
self.generic_constraints = []
+ self.generic_constraints.append(TFLiteSemantic.constraint_attributes_specified)
self.generic_constraints.append(TFLiteSemantic.constraint_tens_no_dynamic)
self.generic_constraints.append(TFLiteSemantic.constraint_tens_defined_shape)
self.generic_constraints.append(TFLiteSemantic.constraint_tens_output_scalar)
@@ -258,6 +259,16 @@ class TFLiteSemantic:
return valid, f"Unexpected None value for constant tensor: {extra}"
@staticmethod
+ def constraint_attributes_specified(op):
+ "All required operator attributes must be specified"
+ # operators that have been created internally (i.e. not created as part of reading an input network) may not
+ # have the read error attribute
+ attribute_read_error = op.attrs.get("attribute_read_error", [])
+ valid = len(attribute_read_error) == 0
+ extra = ", ".join(attribute_read_error)
+ return valid, f"Op has missing attributes: {extra}"
+
+ @staticmethod
def constraint_tens_no_dynamic(op):
"Input(s) and Output tensors must not be dynamic"
valid = True