aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Hall <tim.hall@arm.com>2022-02-23 17:58:02 +0000
committertim.hall <tim.hall@arm.com>2022-02-24 10:51:15 +0000
commit0ab2edc73d037fe9da88900b98c2260fec6e9abc (patch)
tree7b34f2ebeb8aaae3285b0fbccbc6c9dfd541120c
parentd5cbef3366c185de0c322d7fbdd75d50f0263778 (diff)
downloadethos-u-vela-0ab2edc73d037fe9da88900b98c2260fec6e9abc.tar.gz
MLBEDSW-6247: MLCE: Issue when running a model with Padding
- The bug is that TransposeConv does not support explicit padding which is needed in order to combine it with a proceeding Pad op - The fix is to exclude such combination Signed-off-by: Tim Hall <tim.hall@arm.com> Change-Id: Ide03d034dc32b5fc9bcaaf291ab713482223a042
-rw-r--r--ethosu/vela/tflite_graph_optimiser.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/ethosu/vela/tflite_graph_optimiser.py b/ethosu/vela/tflite_graph_optimiser.py
index 4098798..97e30ad 100644
--- a/ethosu/vela/tflite_graph_optimiser.py
+++ b/ethosu/vela/tflite_graph_optimiser.py
@@ -236,7 +236,7 @@ def calc_padding_and_skirt(padding_type, kernel, input_shape, explicit_padding):
top_pad, bottom_pad = calc_explicit_padding(int(input_shape.height), int(s_y), int(k_h), int(top), int(bottom))
left_pad, right_pad = calc_explicit_padding(int(input_shape.width), int(s_x), int(k_w), int(left), int(right))
else:
- raise UnsupportedFeatureError(f"Unknown padding")
+ raise UnsupportedFeatureError(f"Unsupported padding = {padding_type} for padding calculation")
padding = (top_pad, left_pad, bottom_pad, right_pad)
skirt = (top_pad, left_pad, ypad - top_pad, xpad - left_pad)
return padding, skirt
@@ -257,7 +257,7 @@ def calc_upscaled_padding_and_skirt(padding_type, kernel_size, stride, input_sha
left_pad = kernel_width - 1
top_pad = kernel_height - 1
else:
- raise UnsupportedFeatureError(f"Unknown padding")
+ raise UnsupportedFeatureError(f"Unsupported padding = {padding_type} for up-scaled padding calculation")
padding = (top_pad, left_pad, bottom_pad, right_pad)
skirt = padding
return padding, skirt
@@ -977,6 +977,7 @@ def replace_pad_by_hw_pad(op: Operation, arch, nng):
"""
if (
(op.type.is_conv2d_op() or op.type.is_depthwise_conv2d_op() or op.type.is_avgpool_op())
+ and op.type not in (Op.Conv2DBackpropInput, Op.Conv2DBackpropInputSwitchedBias)
and op.run_on_npu
and op.attrs["padding"] == Padding.VALID
):