From 9407dd74c1f5d9477f87e7704115d5380c224810 Mon Sep 17 00:00:00 2001 From: Jihoon Lee Date: Wed, 2 Jun 2021 15:42:00 +0900 Subject: [PATCH] [Product Ratings] Fix inconsistent batch This patch fixes inconcistent batch size between source file and model configuration. Also found a bug #1238, which will be dealt seperately. **Self evaluation:** 1. Build test: [X]Passed [ ]Failed [ ]Skipped 2. Run test: [X]Passed [ ]Failed [ ]Skipped Signed-off-by: Jihoon Lee --- Applications/ProductRatings/jni/main.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Applications/ProductRatings/jni/main.cpp b/Applications/ProductRatings/jni/main.cpp index f304696..971b7f2 100644 --- a/Applications/ProductRatings/jni/main.cpp +++ b/Applications/ProductRatings/jni/main.cpp @@ -33,7 +33,7 @@ const unsigned int total_train_data_size = 25; unsigned int train_count = 0; -const unsigned int batch_size = 10; +const unsigned int batch_size = 20; const unsigned int feature_size = 2; @@ -134,8 +134,9 @@ int getBatch_train(float **outVec, float **outLabel, bool *last, return -1; } - for (unsigned int j = 0; j < feature_size; ++j) + for (unsigned int j = 0; j < feature_size; ++j) { outVec[0][count * feature_size + j] = o[j]; + } outLabel[0][count] = l[0]; count++; @@ -219,9 +220,9 @@ int main(int argc, char *argv[]) { if (training) { NN.setDataset(dataset); try { - NN.train(); - } catch (...) { - std::cerr << "Error during train" << std::endl; + NN.train({"batch_size=" + std::to_string(batch_size)}); + } catch (std::exception &e) { + std::cerr << "Error during train " << e.what() << std::endl; return 1; } -- 2.7.4