From 7b245fd5d6f676be670d9bb0e03f5ac51864e73e Mon Sep 17 00:00:00 2001 From: Michael McGeagh Date: Fri, 31 Jul 2020 12:50:57 +0100 Subject: 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 Change-Id: I28ebf028c68bf34bcf03746f57fce53abfcf09e1 --- ethosu/vela/tflite_reader.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ethosu') 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: -- cgit v1.2.1