Merge pull request #1493 from stweil/train

lstmtraining: Fix handling of --max_iterations
This commit is contained in:
Egor Pugin 2018-04-19 17:43:55 +03:00 committed by GitHub
commit a474fd05a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -195,7 +195,8 @@ int main(int argc, char **argv) {
// Train a few.
int iteration = trainer.training_iteration();
for (int target_iteration = iteration + kNumPagesPerBatch;
iteration < target_iteration;
iteration < target_iteration &&
(iteration < FLAGS_max_iterations || FLAGS_max_iterations == 0);
iteration = trainer.training_iteration()) {
trainer.TrainOnLine(&trainer, false);
}