diff options
author | Andreas Nevalainen <andreas.nevalainen@arm.com> | 2020-11-18 10:45:50 +0100 |
---|---|---|
committer | patrik.gustavsson <patrik.gustavsson@arm.com> | 2020-11-19 15:03:53 +0000 |
commit | 083f103fe612a88f41495022af89d5a12ea4aded (patch) | |
tree | 05393a90aaf91731f7aabd522c5e105df65d08e3 | |
parent | 986e3198d18d857112f15c2236fceec2397b5801 (diff) | |
download | ethos-u-vela-083f103fe612a88f41495022af89d5a12ea4aded.tar.gz |
MLBEDSW-3346: Add index check during padding
Change-Id: If63acbc3bcb986db6b81afa4078d5abed05d8afa
Signed-off-by: Andreas Nevalainen <andreas.nevalainen@arm.com>
-rw-r--r-- | ethosu/vela/high_level_command_to_npu_op.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ethosu/vela/high_level_command_to_npu_op.py b/ethosu/vela/high_level_command_to_npu_op.py index 61ce1c96..f7864442 100644 --- a/ethosu/vela/high_level_command_to_npu_op.py +++ b/ethosu/vela/high_level_command_to_npu_op.py @@ -163,9 +163,9 @@ def create_padding(cmd: NpuStripe, primary_op: Operation) -> NpuPadding: # Indexing from end since a 1x1 Avgpool might have been added with non 4-dimensional input/output, # because of activation function needed to be fused. - if cmd.ifm_box.start_coord[-2] > 0: + if len(cmd.ifm_box.start_coord) >= 2 and cmd.ifm_box.start_coord[-2] > 0: left = 0 - if cmd.ifm_box.end_coord[-2] < Block.from_shape(cmd.ifm_tensor.shape).width: + if len(cmd.ifm_box.end_coord) >= 2 and cmd.ifm_box.end_coord[-2] < Block.from_shape(cmd.ifm_tensor.shape).width: right = 0 return NpuPadding(top=top, left=left, bottom=bottom, right=right) |