aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/test
diff options
context:
space:
mode:
authorJames Ward <james.ward@arm.com>2021-09-08 11:14:20 +0100
committerpatrik.gustavsson <patrik.gustavsson@arm.com>2021-10-14 05:30:58 +0000
commit6bf1613c5894d81849dd12b5be6145c1f24caca2 (patch)
tree5c46ae4c43b71403898eb5fa5f2ecab2fd16a90f /ethosu/vela/test
parent7c0607e142456ebd3577c756b419a3b551cdeafb (diff)
downloadethos-u-vela-6bf1613c5894d81849dd12b5be6145c1f24caca2.tar.gz
MLBEDSW-5162 MLCE: Vela [3.1.0] falling to run with yolov4_int8.tflite
* fix indices for tflite mapping of EXP operator * fix indices for tflite mapping of Transpose operator * ensure read offset after slice is aligned to 16 bytes for NHCWB16 or force linear format * add unit test to ensure mapping of indices is consistent across TFLite, TOSA and NNG Signed-off-by: James Ward <james.ward@arm.com> Change-Id: I17b6e44bc06853325d5eea62a558418ee1ebefe8
Diffstat (limited to 'ethosu/vela/test')
-rw-r--r--ethosu/vela/test/test_nng_mapping.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/ethosu/vela/test/test_nng_mapping.py b/ethosu/vela/test/test_nng_mapping.py
new file mode 100644
index 00000000..08d77fea
--- /dev/null
+++ b/ethosu/vela/test/test_nng_mapping.py
@@ -0,0 +1,41 @@
+# Copyright (C) 2021 Arm Limited or its affiliates. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed under the Apache License, Version 2.0 (the License); you may
+# not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an AS IS BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# Description:
+# Unit tests for the mapping of TFLite or TOSA to NNG
+import pytest
+
+from ethosu.vela.tflite_mapping import builtin_operator_map
+from ethosu.vela.tosa_mapping import tosa_operator_map
+
+
+class TestNNGMapping:
+ """Ensure the mappings from TFLite to NNG are consistent."""
+
+ @pytest.mark.parametrize(
+ "operator_map",
+ ((builtin_operator_map), (tosa_operator_map)),
+ ids=("test_tflite_indices_match_nng", "test_tosa_indices_match_nng"),
+ )
+ def test_op_indices_match(self, operator_map):
+ """Ensure TFLite/TOSA indices and NNG indices are consistent for each operator."""
+ for map_op in operator_map.values():
+ op_type = map_op[0]
+ map_op_indices = map_op[-1] # TFLite/TOSA indices in last element of tuple
+
+ nng_indices = op_type.info.indices
+
+ for idx in range(3):
+ assert len(map_op_indices[idx]) == len(nng_indices[idx])