diff options
author | Johan Alfven <johan.alfven@arm.com> | 2023-04-13 11:49:11 +0200 |
---|---|---|
committer | Johan Alfven <johan.alfven@arm.com> | 2023-04-24 12:43:10 +0200 |
commit | 301ca6046884ccacd6cb4d64bd4c4869ff66b4bf (patch) | |
tree | cbbef0b6cc5406f451b515acec3fb2e70bc2a75c /ethosu/vela/tflite_reader.py | |
parent | 2f18e172a3d727d7c610855e93d8aeccd2fca9b1 (diff) | |
download | ethos-u-vela-301ca6046884ccacd6cb4d64bd4c4869ff66b4bf.tar.gz |
MLBEDSW-7458: Fused activation not passed through correctly
- Fixed a problem where the fused activation got lost
when the op was passed through to the CPU
- The fix is to always make sure the attribute is not removed
Change-Id: I612cfa8f6f0a0465459080762094fe61e7ddc1c3
Signed-off-by: Johan Alfven <johan.alfven@arm.com>
Diffstat (limited to 'ethosu/vela/tflite_reader.py')
-rw-r--r-- | ethosu/vela/tflite_reader.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ethosu/vela/tflite_reader.py b/ethosu/vela/tflite_reader.py index 18b61e75..061f3626 100644 --- a/ethosu/vela/tflite_reader.py +++ b/ethosu/vela/tflite_reader.py @@ -209,7 +209,12 @@ class TFLiteSubgraph: # The original value is cached above in channel_multiplier op.attrs["depth_multiplier"] = op.weights.shape[2] // op.ifm.shape[-1] - faf = op.attrs.pop("fused_activation_function", None) + # The fused_activation_function attribute needs to be retained so that the + # tflite_writer can correctly pass through operators that run on the CPU. + # This is because the operator activation attribute is later converted to an + # NpuActivation which treats None and ReLU the same, thereby making it difficult + # for the tflite_writer to recover the original activation function. + faf = op.attrs.get("fused_activation_function", None) if faf is not None: op.activation = create_activation_function(faf) if custom_code is not None: |