From 352607ca99a4a71de11a241227982b9c95dc69b2 Mon Sep 17 00:00:00 2001 From: Dwight Lidman Date: Wed, 29 Sep 2021 17:00:09 +0200 Subject: MLBEDSW-5286 - MLCE: IndexError for ADD + TANH network Resolves a bug where an IndexError would occur if the same tensor was assigned to both IFM and IFM2 of a binary elementwise operator due to duplicates being allowed in operator inputs but not in pass inputs. Signed-off-by: Dwight Lidman Change-Id: I39a6206a6252f6a848be9f9d4c5a8dc749c71699 --- ethosu/vela/scheduler.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ethosu/vela/scheduler.py b/ethosu/vela/scheduler.py index 044b246c..2ac47878 100644 --- a/ethosu/vela/scheduler.py +++ b/ethosu/vela/scheduler.py @@ -978,7 +978,10 @@ class Scheduler: new_tens.consumer_list.append(parent_op) parent_op.inputs[idx] = new_tens - sched_op.parent_ps.inputs[idx] = new_tens + # If the index is out of range, IFM and IFM2 are the same tensor + # and pass inputs don't have duplicates + if idx < len(sched_op.parent_ps.inputs): + sched_op.parent_ps.inputs[idx] = new_tens def print_schedule(self, schedule: Schedule): print(f"Schedule: '{schedule.name}'") -- cgit v1.2.1