aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/tflite_graph_optimiser.py
diff options
context:
space:
mode:
authorTim Hall <tim.hall@arm.com>2021-12-20 16:49:27 +0000
committerTim Hall <tim.hall@arm.com>2021-12-20 17:47:14 +0000
commit51a8dce2c709b6d0f5c1775d8beea27028ed819a (patch)
tree0133f02406f7c83017c0ea8a271807d3fcb4febe /ethosu/vela/tflite_graph_optimiser.py
parent3df5b9624cdf6c2668ea35edc84076f5612bfc15 (diff)
downloadethos-u-vela-51a8dce2c709b6d0f5c1775d8beea27028ed819a.tar.gz
MLBEDSW-5844: Inconsistent calculation of read shapes
- This bug causes a regression in the use of unpack and split operators - The bug is due to the read_shapes attribute being an absolute calculation for slice and strided_slice, but a relative one for unpack and split - The fix is to consistently treat the attribute as a shape relative to the read_offset Signed-off-by: Tim Hall <tim.hall@arm.com> Change-Id: I4504b161be507ea22ca6ee40fbe7808bfe049405
Diffstat (limited to 'ethosu/vela/tflite_graph_optimiser.py')
-rw-r--r--ethosu/vela/tflite_graph_optimiser.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/ethosu/vela/tflite_graph_optimiser.py b/ethosu/vela/tflite_graph_optimiser.py
index 7b10f86a..8cfc3734 100644
--- a/ethosu/vela/tflite_graph_optimiser.py
+++ b/ethosu/vela/tflite_graph_optimiser.py
@@ -146,7 +146,11 @@ def rewrite_split_ops(tens, arch, nng):
new_op = Operation(Op.SplitSliceRead, split_op.name)
new_op.inputs = [inp]
ofm_shape_idx = 0
- read_shape = offset_end
+ if None in (offset_end, offset_start):
+ read_shape = None
+ else:
+ # the read shape is relative to each start offset
+ read_shape = [oe - os for oe, os in zip(offset_end, offset_start)]
# For Split the offset cannot be extracted from the tensor so it has to
# be calculated from the index of the output tensor