From 0426fe9de82e0f6b339edbd2bec78a5d322fb05f Mon Sep 17 00:00:00 2001 From: Johan Alfven Date: Mon, 15 May 2023 11:22:48 +0200 Subject: 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 --- ethosu/vela/tflite_writer.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ethosu/vela/tflite_writer.py b/ethosu/vela/tflite_writer.py index 8c03f051..ae529a43 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(). -- cgit v1.2.1