diff options
author | Raul Farkas <raul.farkas@arm.com> | 2023-05-16 17:18:31 +0100 |
---|---|---|
committer | Fredrik Svedberg <fredrik.svedberg@arm.com> | 2023-06-16 12:25:03 +0000 |
commit | 3b64f068db4ea8e954a1b472de169dd423b8c049 (patch) | |
tree | cbd0c98da22bb62473daf08fdb6b53209ef6d971 /ethosu/vela/test | |
parent | 5d24821355ea5c3af1d069fd50864c5f2f0effd3 (diff) | |
download | ethos-u-vela-3b64f068db4ea8e954a1b472de169dd423b8c049.tar.gz |
MLBEDSW-7648: Fix bug with filter padding in conv2d
* Fix bug that caused filter padding to not be added proportionally
compared to the hardware padding added to IFM.
* Update needed_total_padding function that calculates hardware padding
to also account for the cases in which IFM width is not divisible by
the stride width.
* Update supported ops constraint on strides for conv2d to mark ops with
stride width > 3 and IFM width that is not divisible by the
optimization resize factor as not supported.
* Update unit tests that verify correct functionality when checking
whether ops are supported or not.
Change-Id: I62f14cca890b779ca787a9603fa37c873ad522f8
Signed-off-by: Raul Farkas <raul.farkas@arm.com>
Diffstat (limited to 'ethosu/vela/test')
-rw-r--r-- | ethosu/vela/test/test_tflite_supported_operators.py | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/ethosu/vela/test/test_tflite_supported_operators.py b/ethosu/vela/test/test_tflite_supported_operators.py index 4aca00da..cbad1713 100644 --- a/ethosu/vela/test/test_tflite_supported_operators.py +++ b/ethosu/vela/test/test_tflite_supported_operators.py @@ -106,23 +106,24 @@ def test_constraint_conv_pass(): @pytest.mark.parametrize( - "stride_w, stride_h, supported", + "ifm_shape, stride_w, stride_h, supported", [ - [0, 20, False], - [20, 0, False], - [4, 3, True], - [4, 5, False], - [4, 9, False], - [3, 3, True], - [1, 1, True], - [20, 2, True], - [6, 3, True], - [8, 1, True], + [[1, 8, 8, 8], 0, 20, False], + [[1, 8, 8, 8], 20, 0, False], + [[1, 8, 8, 8], 4, 3, True], + [[1, 8, 8, 8], 4, 5, False], + [[1, 8, 8, 8], 4, 9, False], + [[1, 8, 8, 8], 3, 3, True], + [[1, 8, 8, 8], 1, 1, True], + [[1, 8, 8, 8], 20, 2, False], + [[1, 8, 40, 8], 20, 2, True], + [[1, 8, 40, 8], 6, 3, True], + [[1, 8, 40, 8], 8, 1, True], ], ) -def test_constraint_stride_range(stride_w: int, stride_h: int, supported: bool): +def test_constraint_stride_range(ifm_shape: list[int], stride_w: int, stride_h: int, supported: bool): # Stride width and height must lie within a certain range - op = testutil.create_op_with_quant_tensors(Op.Conv2DBias, [1, 8, 8, 8], [1, 8, 8, 8], [1, 1, 1, 1]) + op = testutil.create_op_with_quant_tensors(Op.Conv2DBias, ifm_shape, [1, 8, 8, 8], [1, 1, 1, 1]) op.attrs = {"stride_w": stride_w, "stride_h": stride_h} assert support.is_operator_supported(op) == supported |