Browse Source

CMSIS-NN: Add new test cases for Fully Connected

Add new test cases to increase code coverage.

Change-Id: Idbebe59fcb94718ca24a9cc56473eb98a3cc4d3c
Felix Johnny 5 years ago
parent
commit
3222a9941c
23 changed files with 864 additions and 55 deletions
  1. 2 0
      CMSIS/NN/Tests/UnitTest/PregeneratedData/fully_connected_mve_0/bias.txt
  2. 2 0
      CMSIS/NN/Tests/UnitTest/PregeneratedData/fully_connected_mve_0/input.txt
  3. 17 0
      CMSIS/NN/Tests/UnitTest/PregeneratedData/fully_connected_mve_0/kernel.txt
  4. 12 0
      CMSIS/NN/Tests/UnitTest/PregeneratedData/fully_connected_mve_0/params.txt
  5. 2 0
      CMSIS/NN/Tests/UnitTest/PregeneratedData/fully_connected_mve_1/bias.txt
  6. 2 0
      CMSIS/NN/Tests/UnitTest/PregeneratedData/fully_connected_mve_1/input.txt
  7. 21 0
      CMSIS/NN/Tests/UnitTest/PregeneratedData/fully_connected_mve_1/kernel.txt
  8. 12 0
      CMSIS/NN/Tests/UnitTest/PregeneratedData/fully_connected_mve_1/params.txt
  9. 35 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_0/biases_data.h
  10. 36 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_0/config_data.h
  11. 42 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_0/input_data.h
  12. 35 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_0/output_ref_data.h
  13. 25 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_0/test_data.h
  14. 170 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_0/weights_data.h
  15. 30 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_1/biases_data.h
  16. 36 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_1/config_data.h
  17. 46 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_1/input_data.h
  18. 30 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_1/output_ref_data.h
  19. 25 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_1/test_data.h
  20. 106 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_1/weights_data.h
  21. 10 0
      CMSIS/NN/Tests/UnitTest/TestCases/test_arm_fully_connected_s8/Unity/unity_test_arm_fully_connected_s8.c
  22. 160 54
      CMSIS/NN/Tests/UnitTest/TestCases/test_arm_fully_connected_s8/test_arm_fully_connected_s8.c
  23. 8 1
      CMSIS/NN/Tests/UnitTest/generate_test_data.py

+ 2 - 0
CMSIS/NN/Tests/UnitTest/PregeneratedData/fully_connected_mve_0/bias.txt

@@ -0,0 +1,2 @@
+# 9
+2.000000000000000000e+00,3.000000000000000000e+00,3.000000000000000000e+00,2.000000000000000000e+00,2.000000000000000000e+00,0.000000000000000000e+00,1.000000000000000000e+00,0.000000000000000000e+00,1.000000000000000000e+00

+ 2 - 0
CMSIS/NN/Tests/UnitTest/PregeneratedData/fully_connected_mve_0/input.txt

@@ -0,0 +1,2 @@
+# 1,1,1,16
+3.000000000000000000e+00,-1.000000000000000000e+00,3.000000000000000000e+00,0.000000000000000000e+00,-4.000000000000000000e+00,0.000000000000000000e+00,1.000000000000000000e+00,0.000000000000000000e+00,3.000000000000000000e+00,-2.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00,-4.000000000000000000e+00,1.000000000000000000e+00,2.000000000000000000e+00,3.000000000000000000e+00

+ 17 - 0
CMSIS/NN/Tests/UnitTest/PregeneratedData/fully_connected_mve_0/kernel.txt

@@ -0,0 +1,17 @@
+# 1,1,16,9
+-2.000000000000000000e+00,2.000000000000000000e+00,3.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00,1.000000000000000000e+00,-3.000000000000000000e+00,-4.000000000000000000e+00,2.000000000000000000e+00
+0.000000000000000000e+00,0.000000000000000000e+00,2.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00,2.000000000000000000e+00,0.000000000000000000e+00,-1.000000000000000000e+00,-3.000000000000000000e+00
+-4.000000000000000000e+00,-4.000000000000000000e+00,-4.000000000000000000e+00,-2.000000000000000000e+00,2.000000000000000000e+00,-4.000000000000000000e+00,-2.000000000000000000e+00,2.000000000000000000e+00,-1.000000000000000000e+00
+-4.000000000000000000e+00,-3.000000000000000000e+00,-4.000000000000000000e+00,2.000000000000000000e+00,0.000000000000000000e+00,-3.000000000000000000e+00,0.000000000000000000e+00,-1.000000000000000000e+00,1.000000000000000000e+00
+-4.000000000000000000e+00,2.000000000000000000e+00,-2.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00,0.000000000000000000e+00,3.000000000000000000e+00,-1.000000000000000000e+00,0.000000000000000000e+00
+-4.000000000000000000e+00,-1.000000000000000000e+00,0.000000000000000000e+00,2.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00,-4.000000000000000000e+00,-4.000000000000000000e+00,2.000000000000000000e+00
+-4.000000000000000000e+00,3.000000000000000000e+00,0.000000000000000000e+00,-1.000000000000000000e+00,-3.000000000000000000e+00,-4.000000000000000000e+00,0.000000000000000000e+00,-4.000000000000000000e+00,0.000000000000000000e+00
+1.000000000000000000e+00,-3.000000000000000000e+00,-4.000000000000000000e+00,-1.000000000000000000e+00,-4.000000000000000000e+00,2.000000000000000000e+00,-3.000000000000000000e+00,2.000000000000000000e+00,-2.000000000000000000e+00
+3.000000000000000000e+00,-1.000000000000000000e+00,2.000000000000000000e+00,-3.000000000000000000e+00,3.000000000000000000e+00,-4.000000000000000000e+00,-3.000000000000000000e+00,3.000000000000000000e+00,-2.000000000000000000e+00
+-2.000000000000000000e+00,-4.000000000000000000e+00,3.000000000000000000e+00,0.000000000000000000e+00,-3.000000000000000000e+00,-4.000000000000000000e+00,-1.000000000000000000e+00,1.000000000000000000e+00,-4.000000000000000000e+00
+-3.000000000000000000e+00,-2.000000000000000000e+00,-2.000000000000000000e+00,-4.000000000000000000e+00,0.000000000000000000e+00,-2.000000000000000000e+00,3.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
+-4.000000000000000000e+00,0.000000000000000000e+00,1.000000000000000000e+00,0.000000000000000000e+00,-1.000000000000000000e+00,-4.000000000000000000e+00,-3.000000000000000000e+00,-1.000000000000000000e+00,2.000000000000000000e+00
+3.000000000000000000e+00,-2.000000000000000000e+00,-3.000000000000000000e+00,2.000000000000000000e+00,-2.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00,0.000000000000000000e+00,2.000000000000000000e+00
+-4.000000000000000000e+00,2.000000000000000000e+00,-3.000000000000000000e+00,2.000000000000000000e+00,-4.000000000000000000e+00,-1.000000000000000000e+00,-4.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00
+3.000000000000000000e+00,3.000000000000000000e+00,2.000000000000000000e+00,-1.000000000000000000e+00,3.000000000000000000e+00,0.000000000000000000e+00,-1.000000000000000000e+00,2.000000000000000000e+00,3.000000000000000000e+00
+-4.000000000000000000e+00,2.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00,-4.000000000000000000e+00,1.000000000000000000e+00,3.000000000000000000e+00,3.000000000000000000e+00,-1.000000000000000000e+00

+ 12 - 0
CMSIS/NN/Tests/UnitTest/PregeneratedData/fully_connected_mve_0/params.txt

@@ -0,0 +1,12 @@
+16
+9
+1
+1
+1
+1
+1
+1
+0
+0
+1
+0

+ 2 - 0
CMSIS/NN/Tests/UnitTest/PregeneratedData/fully_connected_mve_1/bias.txt

@@ -0,0 +1,2 @@
+# 4
+-3.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00

+ 2 - 0
CMSIS/NN/Tests/UnitTest/PregeneratedData/fully_connected_mve_1/input.txt

@@ -0,0 +1,2 @@
+# 1,1,1,20
+-4.000000000000000000e+00,-4.000000000000000000e+00,3.000000000000000000e+00,-4.000000000000000000e+00,3.000000000000000000e+00,2.000000000000000000e+00,-2.000000000000000000e+00,3.000000000000000000e+00,-3.000000000000000000e+00,-4.000000000000000000e+00,1.000000000000000000e+00,3.000000000000000000e+00,-1.000000000000000000e+00,2.000000000000000000e+00,-4.000000000000000000e+00,0.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00

+ 21 - 0
CMSIS/NN/Tests/UnitTest/PregeneratedData/fully_connected_mve_1/kernel.txt

@@ -0,0 +1,21 @@
+# 1,1,20,4
+-3.000000000000000000e+00,2.000000000000000000e+00,-2.000000000000000000e+00,3.000000000000000000e+00
+-3.000000000000000000e+00,-3.000000000000000000e+00,0.000000000000000000e+00,-4.000000000000000000e+00
+-4.000000000000000000e+00,-3.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00
+3.000000000000000000e+00,2.000000000000000000e+00,-1.000000000000000000e+00,0.000000000000000000e+00
+1.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00,-4.000000000000000000e+00
+-4.000000000000000000e+00,2.000000000000000000e+00,-2.000000000000000000e+00,1.000000000000000000e+00
+3.000000000000000000e+00,3.000000000000000000e+00,1.000000000000000000e+00,-4.000000000000000000e+00
+-1.000000000000000000e+00,-4.000000000000000000e+00,3.000000000000000000e+00,0.000000000000000000e+00
+1.000000000000000000e+00,-4.000000000000000000e+00,3.000000000000000000e+00,0.000000000000000000e+00
+-2.000000000000000000e+00,0.000000000000000000e+00,-4.000000000000000000e+00,-1.000000000000000000e+00
+-3.000000000000000000e+00,-3.000000000000000000e+00,-4.000000000000000000e+00,-1.000000000000000000e+00
+-3.000000000000000000e+00,2.000000000000000000e+00,-1.000000000000000000e+00,2.000000000000000000e+00
+1.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00,3.000000000000000000e+00
+-3.000000000000000000e+00,3.000000000000000000e+00,-2.000000000000000000e+00,2.000000000000000000e+00
+2.000000000000000000e+00,0.000000000000000000e+00,-4.000000000000000000e+00,-3.000000000000000000e+00
+2.000000000000000000e+00,-2.000000000000000000e+00,-4.000000000000000000e+00,3.000000000000000000e+00
+0.000000000000000000e+00,3.000000000000000000e+00,-1.000000000000000000e+00,-4.000000000000000000e+00
+-2.000000000000000000e+00,1.000000000000000000e+00,3.000000000000000000e+00,-4.000000000000000000e+00
+2.000000000000000000e+00,-2.000000000000000000e+00,-3.000000000000000000e+00,3.000000000000000000e+00
+2.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00,2.000000000000000000e+00

+ 12 - 0
CMSIS/NN/Tests/UnitTest/PregeneratedData/fully_connected_mve_1/params.txt

@@ -0,0 +1,12 @@
+20
+4
+1
+1
+1
+1
+1
+1
+0
+0
+1
+0

+ 35 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_0/biases_data.h

@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2010-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.
+ */
+
+
+// Generated by generate_test_data.py using TFL version 2.1.0 as reference.
+#pragma once
+#include <stdint.h>
+
+const int32_t fully_connected_mve_0_biases[9] =
+{
+  2,
+  3,
+  3,
+  2,
+  2,
+  0,
+  1,
+  0,
+  1
+};

+ 36 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_0/config_data.h

@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2010-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.
+ */
+
+
+// Generated by generate_test_data.py using TFL version 2.1.0 as reference.
+#pragma once
+#define FULLY_CONNECTED_MVE_0_OUT_CH 9
+#define FULLY_CONNECTED_MVE_0_IN_CH 16
+#define FULLY_CONNECTED_MVE_0_INPUT_W 1
+#define FULLY_CONNECTED_MVE_0_INPUT_H 1
+#define FULLY_CONNECTED_MVE_0_DST_SIZE 9
+#define FULLY_CONNECTED_MVE_0_INPUT_SIZE 16
+#define FULLY_CONNECTED_MVE_0_INPUT_OFFSET 3
+#define FULLY_CONNECTED_MVE_0_OUTPUT_OFFSET -2
+#define FULLY_CONNECTED_MVE_0_OUT_ACTIVATION_MIN -128
+#define FULLY_CONNECTED_MVE_0_OUT_ACTIVATION_MAX 127
+#define FULLY_CONNECTED_MVE_0_INPUT_BATCHES 1
+#define FULLY_CONNECTED_MVE_0_WEIGHTS_OFFSET 0
+#define FULLY_CONNECTED_MVE_0_OUTPUT_MULTIPLIER 1073741824
+#define FULLY_CONNECTED_MVE_0_OUTPUT_SHIFT 1
+#define FULLY_CONNECTED_MVE_0_ACCUMULATION_DEPTH 16

+ 42 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_0/input_data.h

@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2010-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.
+ */
+
+
+// Generated by generate_test_data.py using TFL version 2.1.0 as reference.
+#pragma once
+#include <stdint.h>
+
+const q7_t fully_connected_mve_0_input[16] =
+{
+  0,
+  -4,
+  0,
+  -3,
+  -7,
+  -3,
+  -2,
+  -3,
+  0,
+  -5,
+  -3,
+  -3,
+  -7,
+  -2,
+  -1,
+  0
+};

+ 35 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_0/output_ref_data.h

@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2010-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.
+ */
+
+
+// Generated by generate_test_data.py using TFL version 2.1.0 as reference.
+#pragma once
+#include <stdint.h>
+
+const q7_t fully_connected_mve_0_output_ref[9] =
+{
+  18,
+  9,
+  0,
+  14,
+  -16,
+  -13,
+  -10,
+  5,
+  28
+};

+ 25 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_0/test_data.h

@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2010-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.
+ */
+
+
+// Generated by generate_test_data.py using TFL version 2.1.0 as reference.
+#include "config_data.h"
+#include "output_ref_data.h"
+#include "biases_data.h"
+#include "weights_data.h"
+#include "input_data.h"

+ 170 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_0/weights_data.h

@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2010-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.
+ */
+
+
+// Generated by generate_test_data.py using TFL version 2.1.0 as reference.
+#pragma once
+#include <stdint.h>
+
+const q7_t fully_connected_mve_0_weights[144] =
+{
+  -2,
+  2,
+  3,
+  1,
+  -2,
+  1,
+  -3,
+  -4,
+  2,
+  0,
+  0,
+  2,
+  -1,
+  -2,
+  2,
+  0,
+  -1,
+  -3,
+  -4,
+  -4,
+  -4,
+  -2,
+  2,
+  -4,
+  -2,
+  2,
+  -1,
+  -4,
+  -3,
+  -4,
+  2,
+  0,
+  -3,
+  0,
+  -1,
+  1,
+  -4,
+  2,
+  -2,
+  1,
+  1,
+  0,
+  3,
+  -1,
+  0,
+  -4,
+  -1,
+  0,
+  2,
+  -1,
+  -2,
+  -4,
+  -4,
+  2,
+  -4,
+  3,
+  0,
+  -1,
+  -3,
+  -4,
+  0,
+  -4,
+  0,
+  1,
+  -3,
+  -4,
+  -1,
+  -4,
+  2,
+  -3,
+  2,
+  -2,
+  3,
+  -1,
+  2,
+  -3,
+  3,
+  -4,
+  -3,
+  3,
+  -2,
+  -2,
+  -4,
+  3,
+  0,
+  -3,
+  -4,
+  -1,
+  1,
+  -4,
+  -3,
+  -2,
+  -2,
+  -4,
+  0,
+  -2,
+  3,
+  1,
+  1,
+  -4,
+  0,
+  1,
+  0,
+  -1,
+  -4,
+  -3,
+  -1,
+  2,
+  3,
+  -2,
+  -3,
+  2,
+  -2,
+  1,
+  -1,
+  0,
+  2,
+  -4,
+  2,
+  -3,
+  2,
+  -4,
+  -1,
+  -4,
+  1,
+  -2,
+  3,
+  3,
+  2,
+  -1,
+  3,
+  0,
+  -1,
+  2,
+  3,
+  -4,
+  2,
+  1,
+  -2,
+  -4,
+  1,
+  3,
+  3,
+  -1
+};

+ 30 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_1/biases_data.h

@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2010-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.
+ */
+
+
+// Generated by generate_test_data.py using TFL version 2.1.0 as reference.
+#pragma once
+#include <stdint.h>
+
+const int32_t fully_connected_mve_1_biases[4] =
+{
+  -3,
+  1,
+  -1,
+  -2
+};

+ 36 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_1/config_data.h

@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2010-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.
+ */
+
+
+// Generated by generate_test_data.py using TFL version 2.1.0 as reference.
+#pragma once
+#define FULLY_CONNECTED_MVE_1_OUT_CH 4
+#define FULLY_CONNECTED_MVE_1_IN_CH 20
+#define FULLY_CONNECTED_MVE_1_INPUT_W 1
+#define FULLY_CONNECTED_MVE_1_INPUT_H 1
+#define FULLY_CONNECTED_MVE_1_DST_SIZE 4
+#define FULLY_CONNECTED_MVE_1_INPUT_SIZE 20
+#define FULLY_CONNECTED_MVE_1_INPUT_OFFSET 1
+#define FULLY_CONNECTED_MVE_1_OUTPUT_OFFSET 3
+#define FULLY_CONNECTED_MVE_1_OUT_ACTIVATION_MIN -128
+#define FULLY_CONNECTED_MVE_1_OUT_ACTIVATION_MAX 127
+#define FULLY_CONNECTED_MVE_1_INPUT_BATCHES 1
+#define FULLY_CONNECTED_MVE_1_WEIGHTS_OFFSET -3
+#define FULLY_CONNECTED_MVE_1_OUTPUT_MULTIPLIER 1073741824
+#define FULLY_CONNECTED_MVE_1_OUTPUT_SHIFT 1
+#define FULLY_CONNECTED_MVE_1_ACCUMULATION_DEPTH 20

+ 46 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_1/input_data.h

@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2010-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.
+ */
+
+
+// Generated by generate_test_data.py using TFL version 2.1.0 as reference.
+#pragma once
+#include <stdint.h>
+
+const q7_t fully_connected_mve_1_input[20] =
+{
+  -5,
+  -5,
+  2,
+  -5,
+  2,
+  1,
+  -3,
+  2,
+  -4,
+  -5,
+  0,
+  2,
+  -2,
+  1,
+  -5,
+  -1,
+  -3,
+  -2,
+  0,
+  -2
+};

+ 30 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_1/output_ref_data.h

@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2010-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.
+ */
+
+
+// Generated by generate_test_data.py using TFL version 2.1.0 as reference.
+#pragma once
+#include <stdint.h>
+
+const q7_t fully_connected_mve_1_output_ref[4] =
+{
+  -18,
+  5,
+  33,
+  -36
+};

+ 25 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_1/test_data.h

@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2010-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.
+ */
+
+
+// Generated by generate_test_data.py using TFL version 2.1.0 as reference.
+#include "config_data.h"
+#include "output_ref_data.h"
+#include "biases_data.h"
+#include "weights_data.h"
+#include "input_data.h"

+ 106 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/fully_connected_mve_1/weights_data.h

@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2010-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.
+ */
+
+
+// Generated by generate_test_data.py using TFL version 2.1.0 as reference.
+#pragma once
+#include <stdint.h>
+
+const q7_t fully_connected_mve_1_weights[80] =
+{
+  0,
+  5,
+  1,
+  6,
+  0,
+  0,
+  3,
+  -1,
+  -1,
+  0,
+  2,
+  1,
+  6,
+  5,
+  2,
+  3,
+  4,
+  2,
+  1,
+  -1,
+  -1,
+  5,
+  1,
+  4,
+  6,
+  6,
+  4,
+  -1,
+  2,
+  -1,
+  6,
+  3,
+  4,
+  -1,
+  6,
+  3,
+  1,
+  3,
+  -1,
+  2,
+  0,
+  0,
+  -1,
+  2,
+  0,
+  5,
+  2,
+  5,
+  4,
+  4,
+  1,
+  6,
+  0,
+  6,
+  1,
+  5,
+  5,
+  3,
+  -1,
+  0,
+  5,
+  1,
+  -1,
+  6,
+  3,
+  6,
+  2,
+  -1,
+  1,
+  4,
+  6,
+  -1,
+  5,
+  1,
+  0,
+  6,
+  5,
+  4,
+  2,
+  5
+};

+ 10 - 0
CMSIS/NN/Tests/UnitTest/TestCases/test_arm_fully_connected_s8/Unity/unity_test_arm_fully_connected_s8.c

@@ -45,3 +45,13 @@ void test_fully_connected_arm_fully_connected_s8(void)
 {
   fully_connected_arm_fully_connected_s8();
 }
+
+void test_fully_connected_mve_0_arm_fully_connected_s8(void)
+{
+  fully_connected_mve_0_arm_fully_connected_s8();
+}
+
+void test_fully_connected_mve_1_arm_fully_connected_s8(void)
+{
+  fully_connected_mve_1_arm_fully_connected_s8();
+}

+ 160 - 54
CMSIS/NN/Tests/UnitTest/TestCases/test_arm_fully_connected_s8/test_arm_fully_connected_s8.c

@@ -22,61 +22,167 @@
 
 #include "../Utils/validate.h"
 #include "../TestData/fully_connected/test_data.h"
+#include "../TestData/fully_connected_mve_0/test_data.h"
+#include "../TestData/fully_connected_mve_1/test_data.h"
 
 void fully_connected_arm_fully_connected_s8(void)
 {
-  const arm_status expected = ARM_MATH_SUCCESS;
-  q7_t output[FULLY_CONNECTED_DST_SIZE] = {0};
-
-  cmsis_nn_context ctx;
-  cmsis_nn_fc_params fc_params;
-  cmsis_nn_per_tensor_quant_params quant_params;
-  cmsis_nn_dims input_dims;
-  cmsis_nn_dims filter_dims;
-  cmsis_nn_dims bias_dims;
-  cmsis_nn_dims output_dims;
-
-  const q31_t *bias_data = fully_connected_biases;
-  const q7_t *kernel_data = fully_connected_weights;
-  const q7_t *input_data = fully_connected_input;
-  const q7_t *output_ref = fully_connected_output_ref;
-  const int32_t output_ref_size = FULLY_CONNECTED_DST_SIZE;
-
-  input_dims.n = FULLY_CONNECTED_INPUT_BATCHES;
-  input_dims.w = FULLY_CONNECTED_INPUT_W;
-  input_dims.h = FULLY_CONNECTED_INPUT_H;
-  input_dims.c = FULLY_CONNECTED_IN_CH;
-  filter_dims.n = FULLY_CONNECTED_ACCUMULATION_DEPTH;
-  filter_dims.c = FULLY_CONNECTED_OUT_CH;
-  output_dims.n = FULLY_CONNECTED_INPUT_BATCHES;
-  output_dims.c = FULLY_CONNECTED_OUT_CH;
-
-  fc_params.input_offset = FULLY_CONNECTED_INPUT_OFFSET;
-  fc_params.filter_offset = FULLY_CONNECTED_WEIGHTS_OFFSET;
-  fc_params.output_offset = FULLY_CONNECTED_OUTPUT_OFFSET;
-  fc_params.activation.min = FULLY_CONNECTED_OUT_ACTIVATION_MIN;
-  fc_params.activation.max = FULLY_CONNECTED_OUT_ACTIVATION_MAX;
-
-  quant_params.multiplier = FULLY_CONNECTED_OUTPUT_MULTIPLIER;
-  quant_params.shift = FULLY_CONNECTED_OUTPUT_SHIFT;
-
-  int32_t buf_size = arm_fully_connected_s8_get_buffer_size(&filter_dims);
-  ctx.buf = malloc(buf_size);
-  ctx.size = buf_size;
-
-  arm_status result = arm_fully_connected_s8(&ctx,
-                                             &fc_params,
-                                             &quant_params,
-                                             &input_dims,
-                                             input_data,
-                                             &filter_dims,
-                                             kernel_data,
-                                             &bias_dims,
-                                             bias_data,
-                                             &output_dims,
-                                             output);
-
-  free(ctx.buf);
-  TEST_ASSERT_EQUAL(expected, result);
-  TEST_ASSERT_TRUE(validate(output, output_ref, output_ref_size));
+    const arm_status expected = ARM_MATH_SUCCESS;
+    q7_t output[FULLY_CONNECTED_DST_SIZE] = {0};
+
+    cmsis_nn_context ctx;
+    cmsis_nn_fc_params fc_params;
+    cmsis_nn_per_tensor_quant_params quant_params;
+    cmsis_nn_dims input_dims;
+    cmsis_nn_dims filter_dims;
+    cmsis_nn_dims bias_dims;
+    cmsis_nn_dims output_dims;
+
+    const q31_t *bias_data = fully_connected_biases;
+    const q7_t *kernel_data = fully_connected_weights;
+    const q7_t *input_data = fully_connected_input;
+    const q7_t *output_ref = fully_connected_output_ref;
+    const int32_t output_ref_size = FULLY_CONNECTED_DST_SIZE;
+
+    input_dims.n = FULLY_CONNECTED_INPUT_BATCHES;
+    input_dims.w = FULLY_CONNECTED_INPUT_W;
+    input_dims.h = FULLY_CONNECTED_INPUT_H;
+    input_dims.c = FULLY_CONNECTED_IN_CH;
+    filter_dims.n = FULLY_CONNECTED_ACCUMULATION_DEPTH;
+    filter_dims.c = FULLY_CONNECTED_OUT_CH;
+    output_dims.n = FULLY_CONNECTED_INPUT_BATCHES;
+    output_dims.c = FULLY_CONNECTED_OUT_CH;
+
+    fc_params.input_offset = FULLY_CONNECTED_INPUT_OFFSET;
+    fc_params.filter_offset = FULLY_CONNECTED_WEIGHTS_OFFSET;
+    fc_params.output_offset = FULLY_CONNECTED_OUTPUT_OFFSET;
+    fc_params.activation.min = FULLY_CONNECTED_OUT_ACTIVATION_MIN;
+    fc_params.activation.max = FULLY_CONNECTED_OUT_ACTIVATION_MAX;
+
+    quant_params.multiplier = FULLY_CONNECTED_OUTPUT_MULTIPLIER;
+    quant_params.shift = FULLY_CONNECTED_OUTPUT_SHIFT;
+
+    int32_t buf_size = arm_fully_connected_s8_get_buffer_size(&filter_dims);
+    ctx.buf = malloc(buf_size);
+    ctx.size = buf_size;
+
+    arm_status result = arm_fully_connected_s8(&ctx,
+                                               &fc_params,
+                                               &quant_params,
+                                               &input_dims,
+                                               input_data,
+                                               &filter_dims,
+                                               kernel_data,
+                                               &bias_dims,
+                                               bias_data,
+                                               &output_dims,
+                                               output);
+
+    free(ctx.buf);
+    TEST_ASSERT_EQUAL(expected, result);
+    TEST_ASSERT_TRUE(validate(output, output_ref, output_ref_size));
 }
+
+void fully_connected_mve_0_arm_fully_connected_s8(void)
+{
+    const arm_status expected = ARM_MATH_SUCCESS;
+    q7_t output[FULLY_CONNECTED_MVE_0_DST_SIZE] = {0};
+    cmsis_nn_context ctx;
+    cmsis_nn_fc_params fc_params;
+    cmsis_nn_per_tensor_quant_params quant_params;
+    cmsis_nn_dims input_dims;
+    cmsis_nn_dims filter_dims;
+    cmsis_nn_dims bias_dims;
+    cmsis_nn_dims output_dims;
+    const q31_t *bias_data = fully_connected_mve_0_biases;
+    const q7_t *kernel_data = fully_connected_mve_0_weights;
+    const q7_t *input_data = fully_connected_mve_0_input;
+    const q7_t *output_ref = fully_connected_mve_0_output_ref;
+    const int32_t output_ref_size = FULLY_CONNECTED_MVE_0_DST_SIZE;
+    input_dims.n = FULLY_CONNECTED_MVE_0_INPUT_BATCHES;
+    input_dims.w = FULLY_CONNECTED_MVE_0_INPUT_W;
+    input_dims.h = FULLY_CONNECTED_MVE_0_INPUT_H;
+    input_dims.c = FULLY_CONNECTED_MVE_0_IN_CH;
+    filter_dims.n = FULLY_CONNECTED_MVE_0_ACCUMULATION_DEPTH;
+    filter_dims.c = FULLY_CONNECTED_MVE_0_OUT_CH;
+    output_dims.n = FULLY_CONNECTED_MVE_0_INPUT_BATCHES;
+    output_dims.c = FULLY_CONNECTED_MVE_0_OUT_CH;
+    fc_params.input_offset = FULLY_CONNECTED_MVE_0_INPUT_OFFSET;
+    fc_params.filter_offset = FULLY_CONNECTED_MVE_0_WEIGHTS_OFFSET;
+    fc_params.output_offset = FULLY_CONNECTED_MVE_0_OUTPUT_OFFSET;
+    fc_params.activation.min = FULLY_CONNECTED_MVE_0_OUT_ACTIVATION_MIN;
+    fc_params.activation.max = FULLY_CONNECTED_MVE_0_OUT_ACTIVATION_MAX;
+    quant_params.multiplier = FULLY_CONNECTED_MVE_0_OUTPUT_MULTIPLIER;
+    quant_params.shift = FULLY_CONNECTED_MVE_0_OUTPUT_SHIFT;
+
+    int32_t buf_size = arm_fully_connected_s8_get_buffer_size(&filter_dims);
+    ctx.buf = malloc(buf_size);
+    ctx.size = buf_size;
+    arm_status result = arm_fully_connected_s8(&ctx,
+                                               &fc_params,
+                                               &quant_params,
+                                               &input_dims,
+                                               input_data,
+                                               &filter_dims,
+                                               kernel_data,
+                                               &bias_dims,
+                                               bias_data,
+                                               &output_dims,
+                                               output);
+
+    free(ctx.buf);
+    TEST_ASSERT_EQUAL(expected, result);
+    TEST_ASSERT_TRUE(validate(output, output_ref, output_ref_size));
+}
+
+void fully_connected_mve_1_arm_fully_connected_s8(void)
+{
+    const arm_status expected = ARM_MATH_SUCCESS;
+    q7_t output[FULLY_CONNECTED_MVE_1_DST_SIZE] = {0};
+    cmsis_nn_context ctx;
+    cmsis_nn_fc_params fc_params;
+    cmsis_nn_per_tensor_quant_params quant_params;
+    cmsis_nn_dims input_dims;
+    cmsis_nn_dims filter_dims;
+    cmsis_nn_dims bias_dims;
+    cmsis_nn_dims output_dims;
+    const q31_t *bias_data = fully_connected_mve_1_biases;
+    const q7_t *kernel_data = fully_connected_mve_1_weights;
+    const q7_t *input_data = fully_connected_mve_1_input;
+    const q7_t *output_ref = fully_connected_mve_1_output_ref;
+    const int32_t output_ref_size = FULLY_CONNECTED_MVE_1_DST_SIZE;
+    input_dims.n = FULLY_CONNECTED_MVE_1_INPUT_BATCHES;
+    input_dims.w = FULLY_CONNECTED_MVE_1_INPUT_W;
+    input_dims.h = FULLY_CONNECTED_MVE_1_INPUT_H;
+    input_dims.c = FULLY_CONNECTED_MVE_1_IN_CH;
+    filter_dims.n = FULLY_CONNECTED_MVE_1_ACCUMULATION_DEPTH;
+    filter_dims.c = FULLY_CONNECTED_MVE_1_OUT_CH;
+    output_dims.n = FULLY_CONNECTED_MVE_1_INPUT_BATCHES;
+    output_dims.c = FULLY_CONNECTED_MVE_1_OUT_CH;
+    fc_params.input_offset = FULLY_CONNECTED_MVE_1_INPUT_OFFSET;
+    fc_params.filter_offset = FULLY_CONNECTED_MVE_1_WEIGHTS_OFFSET;
+    fc_params.output_offset = FULLY_CONNECTED_MVE_1_OUTPUT_OFFSET;
+    fc_params.activation.min = FULLY_CONNECTED_MVE_1_OUT_ACTIVATION_MIN;
+    fc_params.activation.max = FULLY_CONNECTED_MVE_1_OUT_ACTIVATION_MAX;
+    quant_params.multiplier = FULLY_CONNECTED_MVE_1_OUTPUT_MULTIPLIER;
+    quant_params.shift = FULLY_CONNECTED_MVE_1_OUTPUT_SHIFT;
+
+    int32_t buf_size = arm_fully_connected_s8_get_buffer_size(&filter_dims);
+    ctx.buf = malloc(buf_size);
+    ctx.size = buf_size;
+    arm_status result = arm_fully_connected_s8(&ctx,
+                                               &fc_params,
+                                               &quant_params,
+                                               &input_dims,
+                                               input_data,
+                                               &filter_dims,
+                                               kernel_data,
+                                               &bias_dims,
+                                               bias_data,
+                                               &output_dims,
+                                               output);
+
+    free(ctx.buf);
+    TEST_ASSERT_EQUAL(expected, result);
+    TEST_ASSERT_TRUE(validate(output, output_ref, output_ref_size));
+}

+ 8 - 1
CMSIS/NN/Tests/UnitTest/generate_test_data.py

@@ -786,7 +786,14 @@ def load_all_testdatasets():
                                                         w_x=2, w_y=1, randmin=-4, randmax=4, batches=3,
                                                         input_zero_point=-50, weights_zero_point=-22,
                                                         output_zero_point=-2)
-
+    dataset = 'fully_connected_mve_0'
+    ALL_TESTDATA_SETS[dataset] = FullyConnectedSettings(dataset, type_of_test, args, in_ch=16, out_ch=9, x_in=1, y_in=1,
+                                                        input_zero_point=-3, w_x=1, w_y=1, randmin=-4, randmax=4, batches=1,
+                                                        output_zero_point=-2)
+    dataset = 'fully_connected_mve_1'
+    ALL_TESTDATA_SETS[dataset] = FullyConnectedSettings(dataset, type_of_test, args, in_ch=20, out_ch=4, x_in=1, y_in=1,
+                                                        input_zero_point=-1, weights_zero_point=3, w_x=1, w_y=1,
+                                                        randmin=-4, randmax=4, batches=1, output_zero_point=3)
     type_of_test = 'avgpool'
     dataset = 'avgpooling'
     ALL_TESTDATA_SETS[dataset] = PoolingSettings(dataset, type_of_test, args, channels=8, x_in=22, y_in=12, stride_x=9,