Skip to content

Commit 9407dd7

Browse files
zhoonitjijoongmoon
authored andcommitted
[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 <[email protected]>
1 parent ad701df commit 9407dd7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Applications/ProductRatings/jni/main.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const unsigned int total_train_data_size = 25;
3333

3434
unsigned int train_count = 0;
3535

36-
const unsigned int batch_size = 10;
36+
const unsigned int batch_size = 20;
3737

3838
const unsigned int feature_size = 2;
3939

@@ -134,8 +134,9 @@ int getBatch_train(float **outVec, float **outLabel, bool *last,
134134
return -1;
135135
}
136136

137-
for (unsigned int j = 0; j < feature_size; ++j)
137+
for (unsigned int j = 0; j < feature_size; ++j) {
138138
outVec[0][count * feature_size + j] = o[j];
139+
}
139140
outLabel[0][count] = l[0];
140141

141142
count++;
@@ -219,9 +220,9 @@ int main(int argc, char *argv[]) {
219220
if (training) {
220221
NN.setDataset(dataset);
221222
try {
222-
NN.train();
223-
} catch (...) {
224-
std::cerr << "Error during train" << std::endl;
223+
NN.train({"batch_size=" + std::to_string(batch_size)});
224+
} catch (std::exception &e) {
225+
std::cerr << "Error during train " << e.what() << std::endl;
225226
return 1;
226227
}
227228

0 commit comments

Comments
 (0)