MLBEDSW-4602: Fix Deepspeech scale & bias reuse issue.
- Deepspeech reuses identical weights and biases throughout
the network. Since biases are now interleaved with weights
there is a scaling issue when the ifm scales differ between
operations using the same weight and scale tensor.
- This commit uses interleaved weights/scales on their first use
but separates scales to source memory on subsequent use (if
the ifm scale is different).
Signed-off-by: Tim Hall <tim.hall@arm.com>
Change-Id: I7aae163438160a919cae04e235966e75355a6148
diff --git a/ethosu/vela/npu_serialisation.py b/ethosu/vela/npu_serialisation.py
index 39a7f21..f462168 100644
--- a/ethosu/vela/npu_serialisation.py
+++ b/ethosu/vela/npu_serialisation.py
@@ -98,6 +98,8 @@
op_info = sg.schedule.cost_map[sched_op]
if op_info.npu_weights_tensor:
copy_compressed_values_to_memory_tensor(sg.flash_tensor, op_info.npu_weights_tensor)
+ if op_info.npu_scales_tensor:
+ copy_compressed_values_to_memory_tensor(sg.flash_tensor, op_info.npu_scales_tensor)
if ifm_tensor and ifm_tensor.mem_type not in (MemType.Scratch, MemType.Scratch_fast):
copy_ifm_values_to_memory_tensor(sg.flash_tensor, ifm_tensor)