[UTC/ITC][nntrainer][Non-ACR] Fix DataFeeding through generator 34/262434/2
authorJihoon Lee <jhoon.it.lee@samsung.com>
Tue, 10 Aug 2021 12:08:46 +0000 (21:08 +0900)
committerJihoon Lee <jhoon.it.lee@samsung.com>
Tue, 10 Aug 2021 13:38:31 +0000 (22:38 +0900)
Generator is supposed to give a single element. However, the test was
feeding for multiple elements. This patch removes BATCH_SIZE definition
to make it feed for a single element.

**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped

Change-Id: Ia10049c3ac3a49cde0643fd4eb9cb4201e9047e5
Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
src/itc/nntrainer/ITs-nntrainer-common.h
src/itc/nntrainer/ITs-nntrainer-dataset.c
src/utc/nntrainer/utc-nntrainer-common.h

index da7d23f1376f715c787c36962637b88b11a1ce79..67fa0f70a68f2b037797f662e485d29b02dc321e 100755 (executable)
@@ -36,7 +36,6 @@
 #define TRAININGSET_PATH       "trainingSet.dat"
 #define VALSET_PATH                    "trainingSet.dat"
 #define PATH_LEN                       1024
-#define BATCH_SIZE                     32
 #define FEATURE_SIZE           62720
 
 char* NnTrainerGetError(int nRet);
index 87aac845d3f6a351682a12d975db6cb2be69b44f..48ff20279f43c919d5b21549a805abdf2272441f 100644 (file)
@@ -38,15 +38,13 @@ static int ConstantGeneratorCB(float **outVec, float **outLabel, bool *last, voi
 
        static int count = 0;
        unsigned int i;
-       unsigned int data_size = BATCH_SIZE * FEATURE_SIZE;
+       unsigned int data_size = FEATURE_SIZE;
 
        for (i = 0; i < data_size; ++i) {
                outVec[0][i] = 1;
        }
 
-       for(i = 0; i < BATCH_SIZE; ++i) {
-               outLabel[0][i] = 1;
-       }
+       outLabel[0][0] = 1;
 
        if (count == 5) {
                *last = true;
index d15ba6174a2a00b0da7f60c81c6a07dc866e2923..8143e379babdd495ee021260d2e187c7221e5a8e 100644 (file)
@@ -34,7 +34,6 @@
 #define TRAININGSET_PATH "trainingSet.dat"
 #define VALSET_PATH "trainingSet.dat"
 
-#define BATCH_SIZE 9
 #define FEATURE_SIZE 100
 #define NUM_CLASS 10
 
@@ -154,20 +153,18 @@ static int constant_generator_cb(float **outVec, float **outLabel, bool *last,
 {
   static int count = 0;
   unsigned int i, j;
-  unsigned int data_size = BATCH_SIZE * FEATURE_SIZE;
+  unsigned int data_size = FEATURE_SIZE;
 
   for (i = 0; i < data_size; ++i)
   {
     outVec[0][i] = 0.0f;
   }
 
-  for (i = 0; i < BATCH_SIZE; ++i)
+
+  outLabel[0][0] = 1.0f;
+  for (j = 1; j < NUM_CLASS; ++j)
   {
-    outLabel[0][i * NUM_CLASS] = 1.0f;
-    for (j = 1; j < NUM_CLASS; ++j)
-    {
-      outLabel[0][i * NUM_CLASS + j] = 0.0f;
-    }
+    outLabel[0][j] = 0.0f;
   }
 
   if (count == 10)