From 1bbd06bf538ff9d290e9703b6bac05b9617f2ab0 Mon Sep 17 00:00:00 2001 From: Tim Hall Date: Thu, 25 Aug 2022 13:38:50 +0100 Subject: MLBEDSW-6879: TFLG pass-through test crash - The optimisation of the SHAPE operator resulted in a divide by zero when printing the percentage of npu/cpu operators in the final output summary - The fix is to detect when there are no operators in the output tflite and then avoid the division Signed-off-by: Tim Hall Change-Id: I5bd2342335e9468a8b7028e6e2291a03960e2e55 --- ethosu/vela/stats_writer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethosu/vela/stats_writer.py b/ethosu/vela/stats_writer.py index 22605a6b..f3e2dbac 100644 --- a/ethosu/vela/stats_writer.py +++ b/ethosu/vela/stats_writer.py @@ -277,7 +277,7 @@ def print_performance_metrics_for_strat( n_cpu_operations = len(cpu_operations) n_npu_operations = len(npu_operations) - n_total_operations = n_cpu_operations + n_npu_operations + n_total_operations = max(n_cpu_operations + n_npu_operations, 1) # avoid potential divide by zero def format_tens_list(lst): return " ".join(str(list(tens.shape)) for tens in lst) -- cgit v1.2.1