From 0ab2edc73d037fe9da88900b98c2260fec6e9abc Mon Sep 17 00:00:00 2001 From: Tim Hall Date: Wed, 23 Feb 2022 17:58:02 +0000 Subject: 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 Change-Id: Ide03d034dc32b5fc9bcaaf291ab713482223a042 --- ethosu/vela/tflite_graph_optimiser.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ethosu/vela/tflite_graph_optimiser.py b/ethosu/vela/tflite_graph_optimiser.py index 40987986..97e30ad6 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 ): -- cgit v1.2.1