@@ -17,36 +17,38 @@ limitations under the License. */
1717#include < fenv.h>
1818#include < stdio.h>
1919
20- #include < iostream>
2120#include < iomanip>
22- #include < sstream >
21+ #include < iostream >
2322#include < limits>
23+ #include < sstream>
2424
2525#include < google/protobuf/text_format.h>
2626
27+ #include " paddle/utils/Excepts.h"
28+ #include " paddle/utils/GlobalConstants.h"
2729#include " paddle/utils/PythonUtil.h"
2830#include " paddle/utils/Stat.h"
2931#include " paddle/utils/Util.h"
30- #include " paddle/utils/Excepts.h"
31- #include " paddle/utils/GlobalConstants.h"
3232
33- #include " paddle/gserver/gradientmachines/NeuralNetwork.h"
34- #include " paddle/gserver/gradientmachines/GradientMachineMode.h"
35- #include " paddle/gserver/layers/ValidationLayer.h"
33+ #include " RemoteParameterUpdater.h"
3634#include " TesterConfig.h"
3735#include " ThreadParameterUpdater.h"
38- #include " RemoteParameterUpdater.h"
3936#include " TrainerConfigHelper.h"
37+ #include " paddle/gserver/gradientmachines/GradientMachineMode.h"
38+ #include " paddle/gserver/gradientmachines/NeuralNetwork.h"
39+ #include " paddle/gserver/layers/ValidationLayer.h"
4040
4141P_DEFINE_string (config, " " , " Trainer config file" );
4242
43- P_DEFINE_int32 (test_period, 0 ,
43+ P_DEFINE_int32 (test_period,
44+ 0 ,
4445 " if equal 0, do test on all test data at the end of "
4546 " each pass. While if equal non-zero, do test on all test "
4647 " data every test_period batches" );
47- P_DEFINE_bool (test_all_data_in_one_period, false ,
48- " This option was deprecated, since we will always do "
49- " test on all test set " );
48+ P_DEFINE_bool (test_all_data_in_one_period,
49+ false ,
50+ " This option was deprecated, since we will always do "
51+ " test on all test set " );
5052
5153P_DEFINE_bool (local, true , " Train in local mode or not" );
5254
@@ -392,10 +394,6 @@ void Trainer::startTrain() {
392394 dataProvider_->reset ();
393395 }
394396
395- if (this ->testDataProvider_ ) {
396- this ->testDataProvider_ ->reset ();
397- }
398-
399397 trainerInternal_.getGradientMachine ()->start (*config_, dataProvider_);
400398}
401399
@@ -630,16 +628,14 @@ void Trainer::test() { tester_->test(); }
630628std::unique_ptr<TesterConfig> Trainer::createTesterConfig () {
631629 TesterConfig* conf = new TesterConfig;
632630 if (FLAGS_test_period) {
633- LOG (WARNING)
634- << " The meaning of --test_period is changed: "
635- << " if equal 0, do test on all test data at the end of "
636- << " each pass. While if equal non-zero, do test on all test "
637- << " data every test_period batches " ;
631+ LOG (WARNING) << " The meaning of --test_period is changed: "
632+ << " if equal 0, do test on all test data at the end of "
633+ << " each pass. While if equal non-zero, do test on all test "
634+ << " data every test_period batches " ;
638635 }
639636 if (FLAGS_test_all_data_in_one_period) {
640- LOG (WARNING)
641- << " --test_all_data_in_one_period was deprecated, since "
642- << " we will always do test on all test set " ;
637+ LOG (WARNING) << " --test_all_data_in_one_period was deprecated, since "
638+ << " we will always do test on all test set " ;
643639 }
644640 conf->testPeriod = FLAGS_test_period;
645641 conf->prevBatchState = FLAGS_prev_batch_state;
0 commit comments