aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael McGeagh <michael.mcgeagh@arm.com>2020-07-31 12:50:57 +0100
committerMichael McGeagh <michael.mcgeagh@arm.com>2020-08-03 15:52:32 +0100
commit7b245fd5d6f676be670d9bb0e03f5ac51864e73e (patch)
tree44fab638926d723cfc21c66566b09ede9be5c1b6
parent8d939c032703aa513705abc9c286d4410e28ced0 (diff)
downloadethos-u-vela-7b245fd5d6f676be670d9bb0e03f5ac51864e73e.tar.gz
MLBEDSW-2603 Missing "new_shape" attrib in Reshape
Reshape ops should contain a "new_shape" attribute. An invalid tflite file without this attribute caused vela to crash. The new_shape however is the same as the output shape, so if missing, we can easily add this missing attribute. Signed-off-by: Michael McGeagh <michael.mcgeagh@arm.com> Change-Id: I28ebf028c68bf34bcf03746f57fce53abfcf09e1
-rw-r--r--ethosu/vela/tflite_reader.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/ethosu/vela/tflite_reader.py b/ethosu/vela/tflite_reader.py
index 9d312e52..be47cb13 100644
--- a/ethosu/vela/tflite_reader.py
+++ b/ethosu/vela/tflite_reader.py
@@ -164,6 +164,10 @@ class TFLiteSubgraph:
if opt_serializer is not None:
op.attrs = opt_serializer.deserialize(op_data)
+ if op_type == "Reshape" and "new_shape" not in op.attrs:
+ # Reshape should have an attrib "new_shape" but if it is missing, add it based on the output shape
+ op.attrs["new_shape"] = outputs[0].shape
+
if "stride_w" in op.attrs:
op.attrs["strides"] = (1, op.attrs["stride_h"], op.attrs["stride_w"], 1)
if "filter_width" in op.attrs: