aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/test
diff options
context:
space:
mode:
authorDiego Russo <diego.russo@arm.com>2020-04-23 18:14:37 +0100
committerTim Hall <tim.hall@arm.com>2020-06-18 17:53:52 +0100
commitd0eee26bc17ecd237c1b1e86cda78f5f310af391 (patch)
tree8b4b78d1cc0f01d3686be5459353bdf1b4ea73e8 /ethosu/vela/test
parente4e58e15d9916fdcef33f5c43c2f60ef124da6a6 (diff)
downloadethos-u-vela-d0eee26bc17ecd237c1b1e86cda78f5f310af391.tar.gz
Add test for len1_array_to_scalar function
Moved len1_array_to_scalar from a nested function to a staticmethod of TFLiteSubgraph. Change-Id: I182f0b70f03070855c1a4478d26644892c1ebb15 Signed-off-by: Diego Russo <diego.russo@arm.com>
Diffstat (limited to 'ethosu/vela/test')
-rw-r--r--ethosu/vela/test/test_tflite_reader.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/ethosu/vela/test/test_tflite_reader.py b/ethosu/vela/test/test_tflite_reader.py
new file mode 100644
index 00000000..898e3840
--- /dev/null
+++ b/ethosu/vela/test/test_tflite_reader.py
@@ -0,0 +1,36 @@
+# Copyright (C) 2020 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:
+# Contains unit tests for tflite_reader
+import pytest
+from ethosu.vela.tflite_reader import TFLiteSubgraph
+
+
+class TestTFLiteSubgraph:
+
+ # Generate some data for testing len1_array_to_scalar
+ len1_testdata = [
+ (0, None),
+ pytest.param(1, None, marks=pytest.mark.xfail),
+ ([1, 2, 3], [1, 2, 3]),
+ ([10], 10),
+ ([], []),
+ ]
+
+ @pytest.mark.parametrize("test_input,expected", len1_testdata)
+ def test_len1_array_to_scalar(self, test_input, expected):
+ output = TFLiteSubgraph.len1_array_to_scalar(test_input)
+ assert output == expected