aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/high_level_command_to_npu_op.py
diff options
context:
space:
mode:
authorHenrik G Olsson <henrik.olsson@arm.com>2021-04-15 17:57:26 +0200
committerpatrik.gustavsson <patrik.gustavsson@arm.com>2021-04-30 13:00:31 +0000
commit5fabfcaa2b636b02899b4d6e0ccf95d853986475 (patch)
treec2dff0cc2e67bbb90b192a209855cab9e8c0fbad /ethosu/vela/high_level_command_to_npu_op.py
parentdec6fbcb16fa2f3d7254c4beb3235ab50f72a923 (diff)
downloadethos-u-vela-5fabfcaa2b636b02899b4d6e0ccf95d853986475.tar.gz
MLBEDSW-4350 Use padding instead of skirt for merged SplitSlice
When the operations are merged some later passes are confused by start and end coordinates for the convolution not being along the edges of the IFM, and omitting padding. But we need the zero padding to keep the output the same as before the transformation. Also fixes bug where Vela could crash if convolution had explicit start coordinate. Signed-off-by: Henrik G Olsson <henrik.olsson@arm.com> Change-Id: I8449d237350d528f83738b2f09124f1ed79c07ca
Diffstat (limited to 'ethosu/vela/high_level_command_to_npu_op.py')
-rw-r--r--ethosu/vela/high_level_command_to_npu_op.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/ethosu/vela/high_level_command_to_npu_op.py b/ethosu/vela/high_level_command_to_npu_op.py
index c56eb04d..ad9e2664 100644
--- a/ethosu/vela/high_level_command_to_npu_op.py
+++ b/ethosu/vela/high_level_command_to_npu_op.py
@@ -151,10 +151,11 @@ 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 len(cmd.ifm_box.start_coord) >= 2 and cmd.ifm_box.start_coord[-2] > 0:
- left = 0
- if len(cmd.ifm_box.end_coord) >= 2 and cmd.ifm_box.end_coord[-2] < cmd.ps.ifm_shapes[0].width:
- right = 0
+ if not primary_op.attrs.get("force_padding"):
+ if len(cmd.ifm_box.start_coord) >= 2 and cmd.ifm_box.start_coord[-2] > 0:
+ left = 0
+ if len(cmd.ifm_box.end_coord) >= 2 and cmd.ifm_box.end_coord[-2] < cmd.ps.ifm_shapes[0].width:
+ right = 0
return NpuPadding(top=top, left=left, bottom=bottom, right=right)