From 0b5aafa8a67da2e28f20d24ba8c4aa756fe24990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Alfv=C3=A9n?= Date: Thu, 23 Jan 2025 14:52:17 +0100 Subject: [PATCH] MLBEDSW-10310: MLCE: Wrong ofm shape for Prelu ops implemented by AvgPool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - An Avgpool with the wrong ofm shape caused an output difference - The wrong shape is caused by the removal of a Reshape op causing the Prelu actual op ofm shape and tensor shape to differ - Prelu was then later converted the an AvgPool with an faulty value on the op ofm shape (using the Reshape output shape) - The fix is to make sure the original Prelu output shape is used for the AvgPool Change-Id: I878695cbac2e9c0a5323eb7f620047588454b138 Signed-off-by: Johan Alfvén --- ethosu/vela/tflite_graph_optimiser.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ethosu/vela/tflite_graph_optimiser.py b/ethosu/vela/tflite_graph_optimiser.py index e80fe1e3..3918e847 100644 --- a/ethosu/vela/tflite_graph_optimiser.py +++ b/ethosu/vela/tflite_graph_optimiser.py @@ -1288,7 +1288,11 @@ def fixup_relus_with_differing_ifm_ofm_scaling(op: Operation, arch, nng) -> Oper relu_fused_op.add_input_tensor(ifm) relu_fused_op.set_output_tensor(ofm) - relu_fused_op.set_ifm_ofm_shapes() + + # Original shape should be used in case modifications has been done to the + # actual tensor (bypass_memory_only_ops) + relu_fused_op.ifm_shapes.append(op.ifm_shapes[0]) + relu_fused_op.ofm_shapes.append(op.ofm_shapes[0]) op = relu_fused_op return op -- GitLab