From 2bdf516440139ce59f9a45f3cd6c84540e2cb040 Mon Sep 17 00:00:00 2001 From: Jonathan L Long Date: Wed, 3 Sep 2014 20:55:00 -0700 Subject: [PATCH] add test_initialization option to allow skipping initial test --- src/caffe/proto/caffe.proto | 3 +++ src/caffe/solver.cpp | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/caffe/proto/caffe.proto b/src/caffe/proto/caffe.proto index 74c2bab..364cde6 100644 --- a/src/caffe/proto/caffe.proto +++ b/src/caffe/proto/caffe.proto @@ -106,6 +106,9 @@ message SolverParameter { // The number of iterations between two testing phases. optional int32 test_interval = 4 [default = 0]; optional bool test_compute_loss = 19 [default = false]; + // If true, run an initial test pass before the first iteration, + // ensuring memory availability and printing the starting value of the loss. + optional bool test_initialization = 32 [default = true]; optional float base_lr = 5; // The base learning rate // the number of iterations between displaying info. If display = 0, no info // will be displayed. diff --git a/src/caffe/solver.cpp b/src/caffe/solver.cpp index dcac4c1..d68de5f 100644 --- a/src/caffe/solver.cpp +++ b/src/caffe/solver.cpp @@ -184,7 +184,8 @@ void Solver::Solve(const char* resume_file) { Snapshot(); } - if (param_.test_interval() && iter_ % param_.test_interval() == 0) { + if (param_.test_interval() && iter_ % param_.test_interval() == 0 + && (iter_ > 0 || param_.test_initialization())) { TestAll(); } -- 2.7.4