Просмотр исходного кода

CMSIS-NN: Fix and add conv TC for batch > 1

1. Incorrect output reference array size in case of batch !=1
    is fixed for the TC reference
2. TC conv_4 TC is added
3. conv_1_x_n_1 is re generated

TC - Test Case

Change-Id: I73378665ba7baffd06f080d00ddb6b5a414bdd95
Felix Johnny 5 лет назад
Родитель
Сommit
92e282b288
25 измененных файлов с 874 добавлено и 164 удалено
  1. 1 1
      CMSIS/NN/Tests/UnitTest/PregeneratedData/conv_1_x_n_1/bias.txt
  2. 42 42
      CMSIS/NN/Tests/UnitTest/PregeneratedData/conv_1_x_n_1/input.txt
  3. 6 6
      CMSIS/NN/Tests/UnitTest/PregeneratedData/conv_1_x_n_1/kernel.txt
  4. 2 0
      CMSIS/NN/Tests/UnitTest/PregeneratedData/conv_4/bias.txt
  5. 76 0
      CMSIS/NN/Tests/UnitTest/PregeneratedData/conv_4/input.txt
  6. 19 0
      CMSIS/NN/Tests/UnitTest/PregeneratedData/conv_4/kernel.txt
  7. 12 0
      CMSIS/NN/Tests/UnitTest/PregeneratedData/conv_4/params.txt
  8. 3 3
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_1_x_n_1/biases_data.h
  9. 1 1
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_1_x_n_1/config_data.h
  10. 55 55
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_1_x_n_1/input_data.h
  11. 42 42
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_1_x_n_1/output_ref_data.h
  12. 2 2
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_1_x_n_1/output_shift_data.h
  13. 10 10
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_1_x_n_1/weights_data.h
  14. 29 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_4/biases_data.h
  15. 40 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_4/config_data.h
  16. 251 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_4/input_data.h
  17. 29 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_4/output_mult_data.h
  18. 62 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_4/output_ref_data.h
  19. 29 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_4/output_shift_data.h
  20. 27 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_4/test_data.h
  21. 80 0
      CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_4/weights_data.h
  22. 1 1
      CMSIS/NN/Tests/UnitTest/TestCases/Utils/validate.h
  23. 5 0
      CMSIS/NN/Tests/UnitTest/TestCases/test_arm_convolve_s8/Unity/unity_test_arm_convolve_s8.c
  24. 45 0
      CMSIS/NN/Tests/UnitTest/TestCases/test_arm_convolve_s8/test_arm_convolve_s8.c
  25. 5 1
      CMSIS/NN/Tests/UnitTest/generate_test_data.py

+ 1 - 1
CMSIS/NN/Tests/UnitTest/PregeneratedData/conv_1_x_n_1/bias.txt

@@ -1,2 +1,2 @@
 # 3
-1.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00
+-1.000000000000000000e+00,0.000000000000000000e+00,1.000000000000000000e+00

+ 42 - 42
CMSIS/NN/Tests/UnitTest/PregeneratedData/conv_1_x_n_1/input.txt

@@ -1,51 +1,51 @@
 # 2,5,5,3
--1.000000000000000000e+00,-1.000000000000000000e+00,0.000000000000000000e+00
--2.000000000000000000e+00,-2.000000000000000000e+00,1.000000000000000000e+00
-1.000000000000000000e+00,-2.000000000000000000e+00,0.000000000000000000e+00
-0.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
-1.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00
--1.000000000000000000e+00,0.000000000000000000e+00,-1.000000000000000000e+00
--2.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
-1.000000000000000000e+00,0.000000000000000000e+00,1.000000000000000000e+00
-0.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00
-1.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00
--2.000000000000000000e+00,-1.000000000000000000e+00,-1.000000000000000000e+00
--2.000000000000000000e+00,0.000000000000000000e+00,-1.000000000000000000e+00
-0.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
-0.000000000000000000e+00,-1.000000000000000000e+00,-1.000000000000000000e+00
--1.000000000000000000e+00,-1.000000000000000000e+00,1.000000000000000000e+00
-0.000000000000000000e+00,-2.000000000000000000e+00,0.000000000000000000e+00
--2.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00
--2.000000000000000000e+00,-2.000000000000000000e+00,-2.000000000000000000e+00
-0.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
--2.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00
--1.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00
--2.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00
--2.000000000000000000e+00,0.000000000000000000e+00,1.000000000000000000e+00
--2.000000000000000000e+00,-2.000000000000000000e+00,-2.000000000000000000e+00
+1.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
+1.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
 -1.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00
+-2.000000000000000000e+00,0.000000000000000000e+00,-1.000000000000000000e+00
+1.000000000000000000e+00,-1.000000000000000000e+00,1.000000000000000000e+00
 1.000000000000000000e+00,0.000000000000000000e+00,-2.000000000000000000e+00
-1.000000000000000000e+00,-2.000000000000000000e+00,0.000000000000000000e+00
--1.000000000000000000e+00,-2.000000000000000000e+00,0.000000000000000000e+00
-0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00
--2.000000000000000000e+00,-1.000000000000000000e+00,1.000000000000000000e+00
+-1.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
+0.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
+0.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00
+1.000000000000000000e+00,0.000000000000000000e+00,-1.000000000000000000e+00
+1.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00
+1.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
 0.000000000000000000e+00,0.000000000000000000e+00,1.000000000000000000e+00
--2.000000000000000000e+00,-1.000000000000000000e+00,-1.000000000000000000e+00
--2.000000000000000000e+00,0.000000000000000000e+00,1.000000000000000000e+00
-1.000000000000000000e+00,-2.000000000000000000e+00,1.000000000000000000e+00
--2.000000000000000000e+00,-1.000000000000000000e+00,0.000000000000000000e+00
+-1.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00
+-2.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00
+-1.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
 1.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
--2.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
+0.000000000000000000e+00,-1.000000000000000000e+00,0.000000000000000000e+00
+-1.000000000000000000e+00,-2.000000000000000000e+00,-2.000000000000000000e+00
 -1.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
--1.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
-1.000000000000000000e+00,-1.000000000000000000e+00,1.000000000000000000e+00
-1.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00
--2.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00
-0.000000000000000000e+00,0.000000000000000000e+00,-2.000000000000000000e+00
--1.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00
--1.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00
+1.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00
+-2.000000000000000000e+00,1.000000000000000000e+00,0.000000000000000000e+00
+-2.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00
+0.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00
+1.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
 1.000000000000000000e+00,-2.000000000000000000e+00,1.000000000000000000e+00
--1.000000000000000000e+00,-1.000000000000000000e+00,-1.000000000000000000e+00
+1.000000000000000000e+00,0.000000000000000000e+00,-1.000000000000000000e+00
 -2.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
+0.000000000000000000e+00,-1.000000000000000000e+00,0.000000000000000000e+00
+-1.000000000000000000e+00,-2.000000000000000000e+00,1.000000000000000000e+00
+-2.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00
+-1.000000000000000000e+00,-1.000000000000000000e+00,-1.000000000000000000e+00
+0.000000000000000000e+00,-1.000000000000000000e+00,-1.000000000000000000e+00
+-1.000000000000000000e+00,0.000000000000000000e+00,-1.000000000000000000e+00
+1.000000000000000000e+00,1.000000000000000000e+00,0.000000000000000000e+00
+-2.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00
+0.000000000000000000e+00,-1.000000000000000000e+00,1.000000000000000000e+00
+-1.000000000000000000e+00,-2.000000000000000000e+00,0.000000000000000000e+00
+0.000000000000000000e+00,-2.000000000000000000e+00,-2.000000000000000000e+00
+-1.000000000000000000e+00,0.000000000000000000e+00,-2.000000000000000000e+00
+1.000000000000000000e+00,0.000000000000000000e+00,-2.000000000000000000e+00
+1.000000000000000000e+00,-1.000000000000000000e+00,-1.000000000000000000e+00
+0.000000000000000000e+00,-2.000000000000000000e+00,1.000000000000000000e+00
+0.000000000000000000e+00,-1.000000000000000000e+00,1.000000000000000000e+00
+-1.000000000000000000e+00,-2.000000000000000000e+00,-2.000000000000000000e+00
+1.000000000000000000e+00,-2.000000000000000000e+00,0.000000000000000000e+00
+1.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00
+1.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00
 0.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00
--1.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
+-1.000000000000000000e+00,-2.000000000000000000e+00,1.000000000000000000e+00

+ 6 - 6
CMSIS/NN/Tests/UnitTest/PregeneratedData/conv_1_x_n_1/kernel.txt

@@ -1,7 +1,7 @@
 # 1,2,3,3
--1.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00
--2.000000000000000000e+00,-1.000000000000000000e+00,1.000000000000000000e+00
--2.000000000000000000e+00,-1.000000000000000000e+00,1.000000000000000000e+00
-1.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00
--1.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
--1.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
+-2.000000000000000000e+00,0.000000000000000000e+00,-1.000000000000000000e+00
+1.000000000000000000e+00,-1.000000000000000000e+00,1.000000000000000000e+00
+1.000000000000000000e+00,1.000000000000000000e+00,0.000000000000000000e+00
+1.000000000000000000e+00,1.000000000000000000e+00,0.000000000000000000e+00
+-2.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00
+1.000000000000000000e+00,0.000000000000000000e+00,-1.000000000000000000e+00

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

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

+ 76 - 0
CMSIS/NN/Tests/UnitTest/PregeneratedData/conv_4/input.txt

@@ -0,0 +1,76 @@
+# 3,5,5,3
+1.000000000000000000e+00,-2.000000000000000000e+00,-2.000000000000000000e+00
+0.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
+-1.000000000000000000e+00,-1.000000000000000000e+00,-1.000000000000000000e+00
+-2.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
+-1.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00
+0.000000000000000000e+00,-2.000000000000000000e+00,0.000000000000000000e+00
+1.000000000000000000e+00,-1.000000000000000000e+00,0.000000000000000000e+00
+-1.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00
+-1.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00
+1.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
+-2.000000000000000000e+00,-1.000000000000000000e+00,0.000000000000000000e+00
+-1.000000000000000000e+00,-1.000000000000000000e+00,-1.000000000000000000e+00
+1.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
+-1.000000000000000000e+00,-1.000000000000000000e+00,0.000000000000000000e+00
+-1.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00
+0.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00
+1.000000000000000000e+00,0.000000000000000000e+00,-1.000000000000000000e+00
+0.000000000000000000e+00,0.000000000000000000e+00,-2.000000000000000000e+00
+0.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
+0.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
+-2.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
+-2.000000000000000000e+00,-1.000000000000000000e+00,0.000000000000000000e+00
+-2.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00
+-2.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00
+1.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00
+-2.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
+1.000000000000000000e+00,-2.000000000000000000e+00,1.000000000000000000e+00
+-2.000000000000000000e+00,-1.000000000000000000e+00,-1.000000000000000000e+00
+0.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00
+-2.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00
+0.000000000000000000e+00,-2.000000000000000000e+00,1.000000000000000000e+00
+1.000000000000000000e+00,0.000000000000000000e+00,1.000000000000000000e+00
+1.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
+-2.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00
+-1.000000000000000000e+00,0.000000000000000000e+00,1.000000000000000000e+00
+0.000000000000000000e+00,0.000000000000000000e+00,-2.000000000000000000e+00
+-1.000000000000000000e+00,0.000000000000000000e+00,-2.000000000000000000e+00
+0.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00
+-1.000000000000000000e+00,0.000000000000000000e+00,-1.000000000000000000e+00
+0.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00
+-1.000000000000000000e+00,-2.000000000000000000e+00,0.000000000000000000e+00
+-2.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00
+0.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00
+-2.000000000000000000e+00,-2.000000000000000000e+00,-2.000000000000000000e+00
+0.000000000000000000e+00,-2.000000000000000000e+00,1.000000000000000000e+00
+1.000000000000000000e+00,0.000000000000000000e+00,-1.000000000000000000e+00
+-2.000000000000000000e+00,-2.000000000000000000e+00,0.000000000000000000e+00
+-1.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00
+-2.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
+1.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
+-1.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00
+0.000000000000000000e+00,1.000000000000000000e+00,0.000000000000000000e+00
+-2.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00
+1.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00
+-2.000000000000000000e+00,-2.000000000000000000e+00,0.000000000000000000e+00
+1.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00
+1.000000000000000000e+00,-2.000000000000000000e+00,-2.000000000000000000e+00
+1.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
+-1.000000000000000000e+00,0.000000000000000000e+00,-2.000000000000000000e+00
+-2.000000000000000000e+00,1.000000000000000000e+00,-2.000000000000000000e+00
+0.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
+-2.000000000000000000e+00,1.000000000000000000e+00,0.000000000000000000e+00
+1.000000000000000000e+00,1.000000000000000000e+00,0.000000000000000000e+00
+-2.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00
+0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00
+-1.000000000000000000e+00,-2.000000000000000000e+00,1.000000000000000000e+00
+0.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
+0.000000000000000000e+00,-1.000000000000000000e+00,1.000000000000000000e+00
+1.000000000000000000e+00,-2.000000000000000000e+00,0.000000000000000000e+00
+1.000000000000000000e+00,1.000000000000000000e+00,0.000000000000000000e+00
+-1.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
+-2.000000000000000000e+00,0.000000000000000000e+00,1.000000000000000000e+00
+-2.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
+1.000000000000000000e+00,-1.000000000000000000e+00,-1.000000000000000000e+00
+-1.000000000000000000e+00,-1.000000000000000000e+00,1.000000000000000000e+00

+ 19 - 0
CMSIS/NN/Tests/UnitTest/PregeneratedData/conv_4/kernel.txt

@@ -0,0 +1,19 @@
+# 3,2,3,3
+-2.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
+-1.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00
+1.000000000000000000e+00,-1.000000000000000000e+00,0.000000000000000000e+00
+-1.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
+1.000000000000000000e+00,-2.000000000000000000e+00,1.000000000000000000e+00
+0.000000000000000000e+00,-2.000000000000000000e+00,-1.000000000000000000e+00
+1.000000000000000000e+00,1.000000000000000000e+00,-1.000000000000000000e+00
+-1.000000000000000000e+00,-1.000000000000000000e+00,-1.000000000000000000e+00
+-1.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00
+1.000000000000000000e+00,1.000000000000000000e+00,1.000000000000000000e+00
+0.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00
+-2.000000000000000000e+00,-1.000000000000000000e+00,-2.000000000000000000e+00
+-2.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00
+0.000000000000000000e+00,0.000000000000000000e+00,-2.000000000000000000e+00
+-2.000000000000000000e+00,-2.000000000000000000e+00,-2.000000000000000000e+00
+1.000000000000000000e+00,-2.000000000000000000e+00,1.000000000000000000e+00
+1.000000000000000000e+00,0.000000000000000000e+00,0.000000000000000000e+00
+-1.000000000000000000e+00,-2.000000000000000000e+00,1.000000000000000000e+00

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

@@ -0,0 +1,12 @@
+3
+3
+5
+5
+2
+3
+2
+2
+0
+0
+3
+0

+ 3 - 3
CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_1_x_n_1/biases_data.h

@@ -23,7 +23,7 @@
 
 const int32_t conv_1_x_n_1_biases[3] =
 {
-  2699,
-  2699,
-  -10795
+  -2699,
+  0,
+  2699
 };

+ 1 - 1
CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_1_x_n_1/config_data.h

@@ -31,7 +31,7 @@
 #define CONV_1_X_N_1_PAD_Y 0
 #define CONV_1_X_N_1_OUTPUT_W 2
 #define CONV_1_X_N_1_OUTPUT_H 5
-#define CONV_1_X_N_1_DST_SIZE 30
+#define CONV_1_X_N_1_DST_SIZE 60
 #define CONV_1_X_N_1_INPUT_SIZE 75
 #define CONV_1_X_N_1_INPUT_OFFSET 0
 #define CONV_1_X_N_1_OUTPUT_OFFSET 0

+ 55 - 55
CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_1_x_n_1/input_data.h

@@ -23,62 +23,49 @@
 
 const q7_t conv_1_x_n_1_input[150] =
 {
-  -42,
-  -42,
-  0,
-  -85,
-  -85,
-  42,
   42,
   -85,
-  0,
-  0,
-  -85,
   -42,
   42,
-  0,
-  0,
+  -85,
   -42,
-  0,
   -42,
-  -85,
-  42,
-  42,
   42,
+  -42,
+  -85,
   0,
+  -42,
   42,
-  0,
   -42,
-  -85,
   42,
-  0,
+  42,
   0,
   -85,
   -42,
-  -42,
   -85,
-  0,
   -42,
   0,
   -85,
   -42,
   0,
+  42,
   -42,
+  42,
+  0,
   -42,
+  42,
   -42,
-  -42,
+  -85,
   42,
-  0,
   -85,
+  -42,
+  0,
   0,
-  -85,
   42,
   -42,
+  -42,
   -85,
   -85,
-  -85,
-  0,
-  42,
   42,
   -85,
   -42,
@@ -86,91 +73,104 @@ const q7_t conv_1_x_n_1_input[150] =
   -42,
   42,
   -85,
-  -85,
-  42,
   -42,
-  -85,
   0,
-  42,
-  -85,
+  -42,
+  0,
+  -42,
   -85,
   -85,
   -42,
   42,
-  -42,
   42,
-  0,
-  -85,
+  42,
   42,
   -85,
-  0,
-  -42,
   -85,
+  42,
   0,
+  -85,
   0,
   0,
   0,
-  -85,
-  -42,
   42,
-  0,
-  0,
+  -42,
   42,
   -85,
   -42,
-  -42,
+  42,
   -85,
-  0,
   42,
   42,
+  0,
+  -42,
   -85,
-  42,
   -85,
   -42,
   0,
-  42,
-  -85,
+  -42,
+  0,
   -42,
   -85,
+  42,
   -85,
+  42,
   -42,
   -42,
-  42,
-  42,
+  -42,
+  -42,
+  0,
+  -42,
+  -42,
+  -42,
+  0,
   -42,
   42,
   42,
+  0,
+  -85,
   42,
+  -85,
+  0,
   -42,
   42,
-  42,
   -42,
   -85,
+  0,
+  0,
   -85,
-  42,
   -85,
+  -42,
   0,
+  -85,
+  42,
   0,
   -85,
-  -42,
   42,
   -42,
   -42,
-  42,
-  -85,
-  42,
+  0,
   -85,
   42,
+  0,
   -42,
+  42,
   -42,
-  -42,
   -85,
   -85,
+  42,
+  -85,
+  0,
+  42,
+  0,
+  0,
+  42,
   -42,
+  -85,
   0,
   42,
   -42,
   -42,
   -85,
-  -42
+  42
 };

+ 42 - 42
CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_1_x_n_1/output_ref_data.h

@@ -23,64 +23,64 @@
 
 const q7_t conv_1_x_n_1_output_ref[60] =
 {
-  9,
-  2,
-  -1,
-  1,
-  5,
-  -8,
-  6,
-  -3,
-  2,
+  0,
+  -2,
+  0,
   -1,
-  5,
-  -5,
-  6,
-  5,
+  -2,
+  4,
   -1,
+  -2,
   1,
-  5,
-  -7,
-  3,
-  2,
   -2,
-  3,
+  -1,
+  1,
+  1,
+  -1,
   2,
+  -4,
   -2,
+  1,
   4,
-  -1,
+  -4,
+  4,
+  -2,
+  -4,
+  1,
+  -4,
+  1,
   0,
-  7,
-  10,
+  1,
   -1,
+  6,
+  -4,
   0,
-  0,
-  -8,
-  2,
-  5,
-  -3,
+  -2,
   5,
-  3,
-  -1,
+  -5,
   4,
+  3,
+  -3,
+  7,
+  -2,
+  -2,
+  1,
+  7,
+  -2,
   7,
-  -1,
-  5,
-  2,
-  -7,
-  4,
-  -1,
-  4,
   1,
-  -1,
   -5,
+  3,
+  0,
   1,
-  -1,
+  3,
+  0,
+  -3,
+  -3,
+  -2,
+  0,
+  -2,
   -3,
-  2,
-  4,
-  -5,
   1,
-  7,
-  -3
+  1
 };

+ 2 - 2
CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_1_x_n_1/output_shift_data.h

@@ -24,6 +24,6 @@
 const int32_t conv_1_x_n_1_output_shift[3] =
 {
   -11,
-  -11,
-  -12
+  -12,
+  -11
 };

+ 10 - 10
CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_1_x_n_1/weights_data.h

@@ -23,22 +23,22 @@
 
 const q7_t conv_1_x_n_1_weights[18] =
 {
-  -64,
-  0,
-  0,
   -127,
+  0,
   -64,
   64,
-  -127,
   -64,
   64,
-  64,
-  -64,
-  -127,
-  -127,
   127,
   127,
-  -127,
+  0,
+  127,
   127,
-  127
+  0,
+  -127,
+  64,
+  -64,
+  64,
+  0,
+  -64
 };

+ 29 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_4/biases_data.h

@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#include <stdint.h>
+
+const int32_t conv_4_biases[3] =
+{
+  2699,
+  -5398,
+  -2699
+};

+ 40 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_4/config_data.h

@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#define CONV_4_OUT_CH 3
+#define CONV_4_IN_CH 3
+#define CONV_4_INPUT_W 5
+#define CONV_4_INPUT_H 5
+#define CONV_4_FILTER_X 2
+#define CONV_4_FILTER_Y 3
+#define CONV_4_STRIDE_X 2
+#define CONV_4_STRIDE_Y 2
+#define CONV_4_PAD_X 0
+#define CONV_4_PAD_Y 0
+#define CONV_4_OUTPUT_W 2
+#define CONV_4_OUTPUT_H 2
+#define CONV_4_DST_SIZE 36
+#define CONV_4_INPUT_SIZE 75
+#define CONV_4_INPUT_OFFSET 0
+#define CONV_4_OUTPUT_OFFSET 0
+#define CONV_4_OUT_ACTIVATION_MIN -128
+#define CONV_4_OUT_ACTIVATION_MAX 127
+#define CONV_4_INPUT_BATCHES 3

+ 251 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_4/input_data.h

@@ -0,0 +1,251 @@
+/*
+ * 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.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#include <stdint.h>
+
+const q7_t conv_4_input[225] =
+{
+  42,
+  -85,
+  -85,
+  0,
+  42,
+  42,
+  -42,
+  -42,
+  -42,
+  -85,
+  42,
+  42,
+  -42,
+  -42,
+  -85,
+  0,
+  -85,
+  0,
+  42,
+  -42,
+  0,
+  -42,
+  42,
+  -42,
+  -42,
+  42,
+  -42,
+  42,
+  -85,
+  -42,
+  -85,
+  -42,
+  0,
+  -42,
+  -42,
+  -42,
+  42,
+  -85,
+  -42,
+  -42,
+  -42,
+  0,
+  -42,
+  0,
+  0,
+  0,
+  42,
+  -42,
+  42,
+  0,
+  -42,
+  0,
+  0,
+  -85,
+  0,
+  42,
+  42,
+  0,
+  42,
+  42,
+  -85,
+  42,
+  42,
+  -85,
+  -42,
+  0,
+  -85,
+  42,
+  -42,
+  -85,
+  -42,
+  -85,
+  42,
+  42,
+  -85,
+  -85,
+  42,
+  42,
+  42,
+  -85,
+  42,
+  -85,
+  -42,
+  -42,
+  0,
+  -42,
+  -85,
+  -85,
+  42,
+  -85,
+  0,
+  -85,
+  42,
+  42,
+  0,
+  42,
+  42,
+  42,
+  42,
+  -85,
+  42,
+  -85,
+  -42,
+  0,
+  42,
+  0,
+  0,
+  -85,
+  -42,
+  0,
+  -85,
+  0,
+  42,
+  -85,
+  -42,
+  0,
+  -42,
+  0,
+  42,
+  -42,
+  -42,
+  -85,
+  0,
+  -85,
+  -42,
+  -85,
+  0,
+  42,
+  -85,
+  -85,
+  -85,
+  -85,
+  0,
+  -85,
+  42,
+  42,
+  0,
+  -42,
+  -85,
+  -85,
+  0,
+  -42,
+  0,
+  0,
+  -85,
+  -85,
+  -42,
+  42,
+  -85,
+  -42,
+  -42,
+  42,
+  -85,
+  0,
+  42,
+  0,
+  -85,
+  0,
+  0,
+  42,
+  42,
+  -85,
+  -85,
+  -85,
+  0,
+  42,
+  0,
+  0,
+  42,
+  -85,
+  -85,
+  42,
+  -85,
+  -42,
+  -42,
+  0,
+  -85,
+  -85,
+  42,
+  -85,
+  0,
+  -85,
+  -42,
+  -85,
+  42,
+  0,
+  42,
+  42,
+  0,
+  -85,
+  0,
+  0,
+  0,
+  0,
+  0,
+  -42,
+  -85,
+  42,
+  0,
+  -85,
+  -42,
+  0,
+  -42,
+  42,
+  42,
+  -85,
+  0,
+  42,
+  42,
+  0,
+  -42,
+  -85,
+  -42,
+  -85,
+  0,
+  42,
+  -85,
+  -85,
+  -42,
+  42,
+  -42,
+  -42,
+  -42,
+  -42,
+  42
+};

+ 29 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_4/output_mult_data.h

@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#include <stdint.h>
+
+const int32_t conv_4_output_mult[3] =
+{
+  1636076574,
+  1636076574,
+  1636076574
+};

+ 62 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_4/output_ref_data.h

@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#include <stdint.h>
+
+const q7_t conv_4_output_ref[36] =
+{
+  -2,
+  2,
+  2,
+  8,
+  0,
+  1,
+  1,
+  3,
+  7,
+  -2,
+  11,
+  0,
+  8,
+  4,
+  4,
+  1,
+  -1,
+  -5,
+  4,
+  5,
+  14,
+  2,
+  5,
+  7,
+  -1,
+  -2,
+  2,
+  5,
+  -4,
+  11,
+  -1,
+  -2,
+  8,
+  4,
+  2,
+  0
+};

+ 29 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_4/output_shift_data.h

@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#include <stdint.h>
+
+const int32_t conv_4_output_shift[3] =
+{
+  -11,
+  -11,
+  -11
+};

+ 27 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_4/test_data.h

@@ -0,0 +1,27 @@
+/*
+ * 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
+#include "config_data.h"
+#include "output_ref_data.h"
+#include "output_shift_data.h"
+#include "output_mult_data.h"
+#include "biases_data.h"
+#include "weights_data.h"
+#include "input_data.h"

+ 80 - 0
CMSIS/NN/Tests/UnitTest/TestCases/TestData/conv_4/weights_data.h

@@ -0,0 +1,80 @@
+/*
+ * 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.
+ */
+
+
+#pragma once
+// Generated by generate_test_data.py
+#include <stdint.h>
+
+const q7_t conv_4_weights[54] =
+{
+  -127,
+  64,
+  64,
+  -64,
+  0,
+  0,
+  64,
+  -64,
+  0,
+  -64,
+  64,
+  64,
+  64,
+  -127,
+  64,
+  0,
+  -127,
+  -64,
+  64,
+  64,
+  -64,
+  -64,
+  -64,
+  -64,
+  -64,
+  0,
+  0,
+  64,
+  64,
+  64,
+  0,
+  0,
+  0,
+  -127,
+  -64,
+  -127,
+  -127,
+  0,
+  0,
+  0,
+  0,
+  -127,
+  -127,
+  -127,
+  -127,
+  64,
+  -127,
+  64,
+  64,
+  0,
+  0,
+  -64,
+  -127,
+  64
+};

+ 1 - 1
CMSIS/NN/Tests/UnitTest/TestCases/Utils/validate.h

@@ -38,7 +38,7 @@ inline int validate(int8_t *act, const int8_t *ref, int size)
       }
       else
       {
-        //printf("PASS at pos %d: %d\r\n", i, act[i]);
+        // printf("PASS at pos %d: %d\r\n", i, act[i]);
       }
     }
 

+ 5 - 0
CMSIS/NN/Tests/UnitTest/TestCases/test_arm_convolve_s8/Unity/unity_test_arm_convolve_s8.c

@@ -61,6 +61,11 @@ void test_conv_3_arm_convolve_s8(void)
   conv_3_arm_convolve_s8();
 }
 
+void test_conv_4_arm_convolve_s8(void)
+{
+  conv_4_arm_convolve_s8();
+}
+
 void test_conv_1_x_n_1_arm_convolve_s8(void)
 {
   conv_1_x_n_1_arm_convolve_s8();

+ 45 - 0
CMSIS/NN/Tests/UnitTest/TestCases/test_arm_convolve_s8/test_arm_convolve_s8.c

@@ -24,6 +24,7 @@
 #include "../TestData/stride2pad1/test_data.h"
 #include "../TestData/conv_2/test_data.h"
 #include "../TestData/conv_3/test_data.h"
+#include "../TestData/conv_4/test_data.h"
 #include "../TestData/conv_1_x_n_1/test_data.h"
 #include "../TestData/conv_1_x_n_2/test_data.h"
 #include "../TestData/conv_1_x_n_3/test_data.h"
@@ -191,6 +192,50 @@ void conv_3_arm_convolve_s8(void)
   free(bufferA);
 }
 
+void conv_4_arm_convolve_s8(void)
+{
+  arm_status expected = ARM_MATH_SUCCESS;
+  q7_t output[CONV_4_DST_SIZE] = {0};
+
+  const int32_t buf_size = arm_convolve_s8_get_buffer_size(CONV_4_IN_CH,
+                                                           CONV_4_FILTER_X,
+                                                           CONV_4_FILTER_Y);
+
+
+  q15_t *bufferA = (q15_t*)malloc(buf_size);
+
+
+  arm_status result = arm_convolve_s8(conv_4_input,
+                                      CONV_4_INPUT_W,
+                                      CONV_4_INPUT_H,
+                                      CONV_4_IN_CH,
+                                      CONV_4_INPUT_BATCHES,
+                                      conv_4_weights,
+                                      CONV_4_OUT_CH,
+                                      CONV_4_FILTER_X,
+                                      CONV_4_FILTER_Y,
+                                      CONV_4_PAD_X,
+                                      CONV_4_PAD_Y,
+                                      CONV_4_STRIDE_X,
+                                      CONV_4_STRIDE_Y,
+                                      conv_4_biases,
+                                      output,
+                                      conv_4_output_shift,
+                                      conv_4_output_mult,
+                                      CONV_4_OUTPUT_OFFSET,
+                                      CONV_4_INPUT_OFFSET,
+                                      CONV_4_OUT_ACTIVATION_MIN,
+                                      CONV_4_OUT_ACTIVATION_MAX,
+                                      CONV_4_OUTPUT_W,
+                                      CONV_4_OUTPUT_H,
+                                      bufferA);
+
+  TEST_ASSERT_EQUAL(expected, result);
+  TEST_ASSERT_TRUE(validate(output, conv_4_output_ref, CONV_4_DST_SIZE));
+
+  free(bufferA);
+}
+
 void conv_1_x_n_1_arm_convolve_s8(void)
 {
   arm_status expected = ARM_MATH_SUCCESS;

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

@@ -257,7 +257,7 @@ class TestSettings(ABC):
             f.write("#define {}_PAD_Y {}\n".format(prefix, self.pad_y))
             f.write("#define {}_OUTPUT_W {}\n".format(prefix, self.x_output))
             f.write("#define {}_OUTPUT_H {}\n".format(prefix, self.y_output))
-            f.write("#define {}_DST_SIZE {}\n".format(prefix, self.x_output * self.y_output * self.output_ch))
+            f.write("#define {}_DST_SIZE {}\n".format(prefix, self.x_output * self.y_output * self.output_ch * self.batches))
             f.write("#define {}_INPUT_SIZE {}\n".format(prefix, self.x_input * self.y_input * self.input_ch))
             f.write("#define {}_INPUT_OFFSET {}\n".format(prefix, -self.input_zero_point))
             f.write("#define {}_OUTPUT_OFFSET {}\n".format(prefix, self.output_zero_point))
@@ -536,6 +536,10 @@ if __name__ == '__main__':
         # generator = ConvSettings(args, in_ch=2, out_ch=4, x_in=6, y_in=3, w_x=3, w_y=3, stride_x=1, stride_y=1,
         #                        pad=True, randmin=-2, randmax=2, outminrange=-126, outmaxrange=127)
 
+        #conv_4 batches > 2
+        # generator = ConvSettings(args, in_ch=3, out_ch=3, x_in=5, y_in=5, w_x=2, w_y=3, stride_x=2, stride_y=2,
+        #                         pad=False, randmin=-2, randmax=2, outminrange=-127, outmaxrange=127, batches=3)
+
 
     elif args.type == 'avgpool' or args.type == 'maxpool':
         generator = PoolingSettings(args, channels=8, x_in=22, y_in=12, stride_x=9, stride_y=5, w_x=6, w_y=5, pad=True)