diff options
author | Tim Hall <tim.hall@arm.com> | 2021-12-16 13:17:29 +0000 |
---|---|---|
committer | tim.hall <tim.hall@arm.com> | 2021-12-16 18:31:52 +0000 |
commit | 3751aa415849e37fb3288d9d5db9ce9b682f8d14 (patch) | |
tree | 3d539888306a49f27713db1dd28be82fe6c6c1f7 /ethosu/vela/high_level_command_to_npu_op.py | |
parent | 7d7cb671f369fd6ffdbddd12f1e29b6503df2c4d (diff) | |
download | ethos-u-vela-3751aa415849e37fb3288d9d5db9ce9b682f8d14.tar.gz |
MLBEDSW-5629: MLCE: Model falling when creating explicit_padding
- Issue was due to a previous patch to fix MLBEDSW-4350
- Manually reverted that fix 5fabfcaa2b636b02899b4d6e0ccf95d853986475
- Made a new fix for MLBEDSW-4350 that calculates the padding and
skirt by taking into account the split read offsets and shapes
Signed-off-by: Tim Hall <tim.hall@arm.com>
Change-Id: I96010c1b977011aecbc411a3c91ab3e61af22db4
Diffstat (limited to 'ethosu/vela/high_level_command_to_npu_op.py')
-rw-r--r-- | ethosu/vela/high_level_command_to_npu_op.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/ethosu/vela/high_level_command_to_npu_op.py b/ethosu/vela/high_level_command_to_npu_op.py index 318960ec..9abfbd40 100644 --- a/ethosu/vela/high_level_command_to_npu_op.py +++ b/ethosu/vela/high_level_command_to_npu_op.py @@ -147,13 +147,22 @@ def create_padding(cmd: NpuStripe, primary_op: Operation) -> NpuPadding: top = cmd.pad_top bottom = cmd.pad_bottom + # the ifm box coordinate range depends upon whether the primary op was combined with a split slice read + ifm_read_offset = primary_op.read_offsets[0] + ifm_read_shape = primary_op.read_shapes[0] + if ifm_read_offset is None or len(ifm_read_offset) < 2: + box_start_coord_min = 0 + box_end_coord_max = cmd.ps.ifm_shapes[0].width + else: + box_start_coord_min = ifm_read_offset[-2] + box_end_coord_max = ifm_read_shape[-2] + # 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 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 + if len(cmd.ifm_box.start_coord) >= 2 and cmd.ifm_box.start_coord[-2] > box_start_coord_min: + left = 0 + if len(cmd.ifm_box.end_coord) >= 2 and cmd.ifm_box.end_coord[-2] < box_end_coord_max: + right = 0 return NpuPadding(top=top, left=left, bottom=bottom, right=right) |