diff options
author | Rickard Bolin <rickard.bolin@arm.com> | 2024-01-31 08:42:00 +0000 |
---|---|---|
committer | Rickard Bolin <rickard.bolin@arm.com> | 2024-02-06 14:10:31 +0100 |
commit | 646314ef1ee268cb972f3c918a49bff85748a332 (patch) | |
tree | 119132bd62c75f90dd5a728f2e5e545454fcbcfb | |
parent | fdbb072dacae339dd3f8efd3fb70fa84b9296033 (diff) | |
download | ethos-u-vela-646314ef1ee268cb972f3c918a49bff85748a332.tar.gz |
MLBEDSW-8620: Fix MirrorPad supported ops check
Change-Id: I1458009f4b92c1a599efa3a63d6768148e55606d
Signed-off-by: Rickard Bolin <rickard.bolin@arm.com>
-rw-r--r-- | SUPPORTED_OPS.md | 18 | ||||
-rw-r--r-- | ethosu/vela/tflite_supported_operators.py | 5 | ||||
-rw-r--r-- | ethosu/vela/vela.py | 4 |
3 files changed, 19 insertions, 8 deletions
diff --git a/SUPPORTED_OPS.md b/SUPPORTED_OPS.md index b2bd096..43f087f 100644 --- a/SUPPORTED_OPS.md +++ b/SUPPORTED_OPS.md @@ -1,5 +1,5 @@ <!-- -SPDX-FileCopyrightText: Copyright 2020-2023 Arm Limited and/or its affiliates <open-source-office@arm.com> +SPDX-FileCopyrightText: Copyright 2020-2024 Arm Limited and/or its affiliates <open-source-office@arm.com> SPDX-License-Identifier: Apache-2.0 @@ -19,7 +19,7 @@ limitations under the License. # Supported Ops This file was automatically generated by Vela using the `--supported-ops-report` parameter. -Vela version: `3.11.0.` +Vela version: `3.11.0` This file complies with [**Gitiles Markdown syntax**](https://gerrit.googlesource.com/gitiles/+/HEAD/Documentation/markdown.md) @@ -53,6 +53,7 @@ Please check the supported operator list for your chosen runtime for further inf | MAX_POOL_2D | [Generic](#tflite-generic-constraints), [Specific](#tflite-max_pool_2d-constraints) | | MEAN | [Generic](#tflite-generic-constraints), [Specific](#tflite-mean-constraints) | | MINIMUM | [Generic](#tflite-generic-constraints), [Specific](#tflite-minimum-constraints) | +| MIRROR_PAD | [Generic](#tflite-generic-constraints), [Specific](#tflite-mirror_pad-constraints) | | MUL | [Generic](#tflite-generic-constraints), [Specific](#tflite-mul-constraints) | | PACK | [Generic](#tflite-generic-constraints) | | PAD | [Generic](#tflite-generic-constraints), [Specific](#tflite-pad-constraints) | @@ -91,12 +92,12 @@ This is a list of constraints most NPU operators must satisfy in order to be sch - Output tensors cannot be scalar - [QUANTIZE] - Scalar Input tensors are only valid for op type: ADD, ARG_MAX, EXPAND_DIMS, MAXIMUM, MEAN, MINIMUM, MUL, QUANTIZE, SPLIT, SPLIT_V, SUB - Input(s) and Output tensors must not be greater than 4D -- Input(s), Output and Weight tensors must have quantization parameters - [ARG_MAX, SHAPE, TRANSPOSE] +- Input(s), Output and Weight tensors must have quantization parameters - [ARG_MAX, MIRROR_PAD, SHAPE, TRANSPOSE] - Input(s), Output and Weight tensors with quantization scales must be finite - Input and Output tensors must have quantization scales that fit within float32 precision - Constant tensors should not have NoneType-values - Tensors must be of type: int16, int32, int8, uint8 - [ARG_MAX] -- Tensors which are int32 are only valid when op type is: ADD, ARG_MAX, MUL, SHAPE, SUB, TRANSPOSE +- Tensors which are int32 are only valid when op type is: ADD, ARG_MAX, MIRROR_PAD, MUL, SHAPE, SUB, TRANSPOSE - Tensor dimensions must be in the range [1, 65535] - Per-axis quantization is only supported for the following op types: CONV_2D, DEPTHWISE_CONV_2D, TRANSPOSE_CONV - IFM Tensor batch size must be 1 - [FULLY_CONNECTED, RESHAPE, SHAPE, SLICE, SOFTMAX, SPLIT, SPLIT_V, SQUEEZE, STRIDED_SLICE, UNPACK] @@ -285,6 +286,15 @@ This is a list of constraints that the MINIMUM operator must satisfy in order to - Both Input quantization parameters must match OFM quantization parameters - Broadcasting is only allowed for rank indices with dimension 1, from either IFM1 or IFM2 +### TFLite MIRROR_PAD Constraints + +This is a list of constraints that the MIRROR_PAD operator must satisfy in order to be scheduled on the NPU. + +- The padding tensor must have the shape [3,2] or [4,2] +- The pad tensor can only pad width and height +- Pad tensor must be of type: int32, int64 +- The number of pad values for each direction must not be larger than the ifm size in that dimension + ### TFLite MUL Constraints This is a list of constraints that the MUL operator must satisfy in order to be scheduled on the NPU. diff --git a/ethosu/vela/tflite_supported_operators.py b/ethosu/vela/tflite_supported_operators.py index ad61fca..91a3ee8 100644 --- a/ethosu/vela/tflite_supported_operators.py +++ b/ethosu/vela/tflite_supported_operators.py @@ -831,10 +831,11 @@ class TFLiteSupportedOperators: @staticmethod def constraint_mirror_pad_padding_values(op): "The number of pad values for each direction must not be larger than the ifm size in that dimension" + valid = True pad_tensor = op.inputs[1].values ifm_shape = op.inputs[0].shape - for dim_padding, ifm_dim_shape in enumerate(pad_tensor, ifm_shape): - if any(dim_padding > ifm_dim_shape): + for dim_padding, ifm_dim_shape in zip(pad_tensor, ifm_shape): + if any([pad_val > ifm_dim_shape for pad_val in dim_padding]): valid = False return valid, f"IFM shape: {ifm_shape}, number of padding values per dimension: {pad_tensor}" diff --git a/ethosu/vela/vela.py b/ethosu/vela/vela.py index 66a2104..a4b93f1 100644 --- a/ethosu/vela/vela.py +++ b/ethosu/vela/vela.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright 2020-2023 Arm Limited and/or its affiliates <open-source-office@arm.com> +# SPDX-FileCopyrightText: Copyright 2020-2024 Arm Limited and/or its affiliates <open-source-office@arm.com> # # SPDX-License-Identifier: Apache-2.0 # @@ -178,7 +178,7 @@ def print_subgraph_io_summary(nng): def generate_license(): lines = [ "<!--", - "SPDX-FileCopyrightText: Copyright 2020-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>", + "SPDX-FileCopyrightText: Copyright 2020-2024 Arm Limited and/or its affiliates <open-source-office@arm.com>", "", "SPDX-License-Identifier: Apache-2.0", "", |