aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Alfven <johan.alfven@arm.com>2023-05-15 11:22:48 +0200
committerJohan Alfven <johan.alfven@arm.com>2023-05-15 17:22:23 +0200
commit0426fe9de82e0f6b339edbd2bec78a5d322fb05f (patch)
tree6db358672e936e8941724335963dc6d93045532b
parent3e7d544134f602eb40ce2a242b6c5f0433fe3543 (diff)
downloadethos-u-vela-0426fe9de82e0f6b339edbd2bec78a5d322fb05f.tar.gz
MLBEDSW-7613: Crash when compiling model with resource variables
Fixed serializing of attribute container and shared_name that accidently got lost when fixing the crash for a faulty LSTM model. Change-Id: Ibd11da65735112bed4b1c8bcc4ef048bc093ebc4 Signed-off-by: Johan Alfven <johan.alfven@arm.com>
-rw-r--r--ethosu/vela/tflite_writer.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/ethosu/vela/tflite_writer.py b/ethosu/vela/tflite_writer.py
index 8c03f05..ae529a4 100644
--- a/ethosu/vela/tflite_writer.py
+++ b/ethosu/vela/tflite_writer.py
@@ -314,12 +314,14 @@ class TFLiteSerialiser:
attrs["dilation_w_factor"] = attrs["dilation"][2]
if "channel_multiplier" in attrs:
attrs["depth_multiplier"] = attrs["channel_multiplier"]
- if "container" in attrs:
- attrs["container"] = builder.CreateString(attrs["container"])
- if "shared_name" in attrs:
- attrs["shared_name"] = builder.CreateString(attrs["shared_name"])
attrs["fused_activation_function"] = op.activation.op_type if op.activation is not None else None
+ # Serialize VarHandleOptions (only op that have attributes with type String)
+ if "container" in attrs:
+ attrs["container"] = builder.CreateString(attrs["container"])
+ if "shared_name" in attrs:
+ attrs["shared_name"] = builder.CreateString(attrs["shared_name"])
+
builtin_opt_offset, custom_opt_offset = opt_serializer.serialize(builder, attrs)
# report any missing attributes that could not be written during serialize().