Skip to content

Commit dbb12d6

Browse files
committed
more updates to lstm related unittests
1 parent 3690606 commit dbb12d6

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

unittest/lstm_recode_test.cc

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ TEST_F(LSTMTrainerTest, RecodeTestKorBase) {
2323
double kor_full_err = TrainIterations(kTrainerIterations * 2);
2424
EXPECT_LT(kor_full_err, 88);
2525
// EXPECT_GT(kor_full_err, 85);
26+
LOG(INFO) << "********** Expected < 88 ************\n" ;
2627
}
2728

2829
TEST_F(LSTMTrainerTest, RecodeTestKor) {
@@ -31,6 +32,7 @@ TEST_F(LSTMTrainerTest, RecodeTestKor) {
3132
"kor.Arial_Unicode_MS.exp0.lstmf", true, true, 5e-4, false);
3233
double kor_recode_err = TrainIterations(kTrainerIterations);
3334
EXPECT_LT(kor_recode_err, 60);
35+
LOG(INFO) << "********** Expected < 60 ************\n" ;
3436
}
3537

3638
// Tests that the given string encodes and decodes back to the same

unittest/lstm_squashed_test.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ TEST_F(LSTMTrainerTest, TestSquashed) {
2424
"SQU-2-layer-lstm", /*recode*/ true, /*adam*/ true);
2525
double lstm_2d_err = TrainIterations(kTrainerIterations * 2);
2626
EXPECT_LT(lstm_2d_err, 80);
27-
LOG(INFO) << "********** < 80 ************" ;
27+
LOG(INFO) << "********** < 80 ************\n" ;
2828
TestIntMode(kTrainerIterations);
2929
}
3030

unittest/lstm_test.cc

+9-9
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ TEST_F(LSTMTrainerTest, BasicTest) {
3333
"Ct1,1,64O1c1]",
3434
"no-lstm", "eng/eng.unicharset", "eng.Arial.exp0.lstmf", false, false,
3535
2e-4, false);
36-
double non_lstm_err = TrainIterations(kTrainerIterations * 3);
36+
double non_lstm_err = TrainIterations(kTrainerIterations * 4);
3737
EXPECT_LT(non_lstm_err, 98);
3838
LOG(INFO) << "********** Expected < 98 ************\n" ;
3939

@@ -55,7 +55,7 @@ TEST_F(LSTMTrainerTest, ColorTest) {
5555
double lstm_uni_err = TrainIterations(kTrainerIterations);
5656
EXPECT_LT(lstm_uni_err, 85);
5757
// EXPECT_GT(lstm_uni_err, 66);
58-
LOG(INFO) << "********** Expected > 66 ** < 85 ************\n" ;
58+
LOG(INFO) << "********** Expected < 85 ************\n" ;
5959
}
6060

6161
TEST_F(LSTMTrainerTest, BidiTest) {
@@ -75,10 +75,10 @@ TEST_F(LSTMTrainerTest, Test2D) {
7575
// A 2-layer LSTM with a 2-D feature-extracting LSTM on the bottom.
7676
SetupTrainerEng("[1,32,0,1 S4,2 L2xy16 Ct1,1,16 S8,1 Lbx100 O1c1]",
7777
"2-D-2-layer-lstm", false, false);
78-
double lstm_2d_err = TrainIterations(kTrainerIterations);
78+
double lstm_2d_err = TrainIterations(kTrainerIterations * 3 / 2 );
7979
EXPECT_LT(lstm_2d_err, 98);
80-
EXPECT_GT(lstm_2d_err, 90);
81-
LOG(INFO) << "********** Expected > 90 ** < 98 ************\n" ;
80+
// EXPECT_GT(lstm_2d_err, 90);
81+
LOG(INFO) << "********** Expected < 98 ************\n" ;
8282
// Int mode training is dead, so convert the trained network to int and check
8383
// that its error rate is close to the float version.
8484
TestIntMode(kTrainerIterations);
@@ -111,15 +111,15 @@ TEST_F(LSTMTrainerTest, SpeedTest) {
111111
TEST_F(LSTMTrainerTest, DeterminismTest) {
112112
SetupTrainerEng("[1,32,0,1 S4,2 L2xy16 Ct1,1,16 S8,1 Lbx100 O1c1]",
113113
"2-D-2-layer-lstm", false, false);
114-
double lstm_2d_err_a = TrainIterations(kTrainerIterations / 3);
114+
double lstm_2d_err_a = TrainIterations(kTrainerIterations);
115115
double act_error_a = trainer_->ActivationError();
116116
double char_error_a = trainer_->CharError();
117117
GenericVector<char> trainer_a_data;
118118
EXPECT_TRUE(trainer_->SaveTrainingDump(NO_BEST_TRAINER, trainer_.get(),
119119
&trainer_a_data));
120120
SetupTrainerEng("[1,32,0,1 S4,2 L2xy16 Ct1,1,16 S8,1 Lbx100 O1c1]",
121121
"2-D-2-layer-lstm", false, false);
122-
double lstm_2d_err_b = TrainIterations(kTrainerIterations / 3);
122+
double lstm_2d_err_b = TrainIterations(kTrainerIterations);
123123
double act_error_b = trainer_->ActivationError();
124124
double char_error_b = trainer_->CharError();
125125
EXPECT_FLOAT_EQ(lstm_2d_err_a, lstm_2d_err_b);
@@ -148,8 +148,8 @@ TEST_F(LSTMTrainerTest, SoftmaxBaselineTest) {
148148
SetupTrainerEng("[1,1,0,32 Lfx96 O1c1]", "1D-lstm", false, true);
149149
double lstm_uni_err = TrainIterations(kTrainerIterations * 2);
150150
EXPECT_LT(lstm_uni_err, 60);
151-
EXPECT_GT(lstm_uni_err, 48);
152-
LOG(INFO) << "********** Expected > 48 ** < 60 ************\n" ;
151+
// EXPECT_GT(lstm_uni_err, 48);
152+
LOG(INFO) << "********** Expected < 60 ************\n" ;
153153
// Check that it works in int mode too.
154154
TestIntMode(kTrainerIterations);
155155
// If we run TestIntMode again, it tests that int_mode networks can

0 commit comments

Comments
 (0)