aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ethosu/vela/high_level_command_stream.py4
-rw-r--r--ethosu/vela/tflite_graph_optimiser.py6
2 files changed, 7 insertions, 3 deletions
diff --git a/ethosu/vela/high_level_command_stream.py b/ethosu/vela/high_level_command_stream.py
index abf6d837..cf31aa5f 100644
--- a/ethosu/vela/high_level_command_stream.py
+++ b/ethosu/vela/high_level_command_stream.py
@@ -79,13 +79,13 @@ class Box:
if len(new_start_coord) >= 2:
stride = strides[2]
# if the current op was combined with a split slice read then the valid ifm range is given by the output
- # of the split op
+ # of the split op (which is defined by the read offset and the read shape)
if split_offset is None:
new_start_coord[-2] = max(new_start_coord[-2] * stride - skirt[1], 0)
new_end_coord[-2] = min(new_end_coord[-2] * stride + skirt[3], ifm_shape.width)
else:
new_start_coord[-2] = max(new_start_coord[-2] * stride - skirt[1], split_offset[-2])
- new_end_coord[-2] = min(new_end_coord[-2] * stride + skirt[3], split_shape[-2])
+ new_end_coord[-2] = min(new_end_coord[-2] * stride + skirt[3], split_offset[-2] + split_shape[-2])
if len(new_start_coord) >= 3:
stride = strides[1]
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