MLBEDSW-3493: bug fixes in mark_tensors
None inputs and unsupported tensor shapes caused asserts when
marking tensor purpose/format.
Change-Id: I4498b61576f529c1a594341cfbb6ba278c6e7ec5
Signed-off-by: Louis Verhaard <louis.verhaard@arm.com>
diff --git a/ethosu/vela/mark_tensors.py b/ethosu/vela/mark_tensors.py
index 1379628..723bd87 100644
--- a/ethosu/vela/mark_tensors.py
+++ b/ethosu/vela/mark_tensors.py
@@ -59,6 +59,8 @@
mark_purpose(tens, arch, TensorPurpose.FeatureMap)
weight_tensors = op.get_weight_tensors()
for tens in op.inputs:
+ if tens is None:
+ continue
if tens.purpose != TensorPurpose.Unknown:
purpose = tens.purpose
elif tens in weight_tensors:
diff --git a/ethosu/vela/tensor.py b/ethosu/vela/tensor.py
index 45518b4..0d299e1 100644
--- a/ethosu/vela/tensor.py
+++ b/ethosu/vela/tensor.py
@@ -446,6 +446,8 @@
except TypeError:
pass
+ if shape_len > 4:
+ return
self.storage_rounding_quantum = arch.storage_rounding_quantums[self.format]
self.storage_rounding_quantum = self.storage_rounding_quantum[-shape_len:]
self.brick_size = arch.brick_sizes[self.format]