From: Jihoon Lee Date: Tue, 10 Aug 2021 12:08:46 +0000 (+0900) Subject: [UTC/ITC][nntrainer][Non-ACR] Fix DataFeeding through generator X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c8c57eee7b90b5c41a10d86dd135efdbc096a8ee;p=test%2Ftct%2Fnative%2Fapi.git [UTC/ITC][nntrainer][Non-ACR] Fix DataFeeding through generator 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 --- diff --git a/src/itc/nntrainer/ITs-nntrainer-common.h b/src/itc/nntrainer/ITs-nntrainer-common.h index da7d23f13..67fa0f70a 100755 --- a/src/itc/nntrainer/ITs-nntrainer-common.h +++ b/src/itc/nntrainer/ITs-nntrainer-common.h @@ -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); diff --git a/src/itc/nntrainer/ITs-nntrainer-dataset.c b/src/itc/nntrainer/ITs-nntrainer-dataset.c index 87aac845d..48ff20279 100644 --- a/src/itc/nntrainer/ITs-nntrainer-dataset.c +++ b/src/itc/nntrainer/ITs-nntrainer-dataset.c @@ -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; diff --git a/src/utc/nntrainer/utc-nntrainer-common.h b/src/utc/nntrainer/utc-nntrainer-common.h index d15ba6174..8143e379b 100644 --- a/src/utc/nntrainer/utc-nntrainer-common.h +++ b/src/utc/nntrainer/utc-nntrainer-common.h @@ -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)