aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Alfvén <johan.alfven@arm.com>2022-10-25 16:22:58 +0200
committerJohan Alfvén <johan.alfven@arm.com>2022-10-26 11:04:30 +0200
commit0b799e465b7b0ce8c5ea4f246a61773f607ebf74 (patch)
tree05e67a5719878383a0728a4fe1bc118fe55c672f
parent3a6325f667bfdfce3031b2e6f92ef72759248c99 (diff)
downloadethos-u-vela-0b799e465b7b0ce8c5ea4f246a61773f607ebf74.tar.gz
MLBEDSW-7059: Updated offset calculation for Slice
Corrected offset calculation for operator Slice. All values in tensor begin and tensor size must be used to calculate the offset range in order to read the correct data. Signed-off-by: Johan Alfven <johan.alfven@arm.com> Change-Id: Ic463d8f72a2167f8129109b8dcf005f034cce6ed
-rw-r--r--ethosu/vela/operation.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/ethosu/vela/operation.py b/ethosu/vela/operation.py
index 4a56f1f0..b4d0e48a 100644
--- a/ethosu/vela/operation.py
+++ b/ethosu/vela/operation.py
@@ -762,10 +762,8 @@ class Operation:
offset_end = [0] * len(input_tens.shape)
for idx in range(len(begin_tens.values)):
- # Check if the op should slice in dimension idx
- if size_tens.values[idx] != input_tens.shape[idx]:
- offset_start[idx] = begin_tens.values[idx]
- offset_end[idx] = size_tens.values[idx] + offset_start[idx]
+ offset_start[idx] = begin_tens.values[idx]
+ offset_end[idx] = size_tens.values[idx] + offset_start[idx]
elif self.type == Op.StridedSlice:
input_tens, begin_tens, end_tens, strides_tens = self.inputs