32 "[1,32,0,1 Ct5,5,16 Mp4,4 Ct1,1,16 Ct3,3,128 Mp4,1 Ct1,1,64 S2,1 "
34 "no-lstm",
"eng/eng.unicharset",
"eng.Arial.exp0.lstmf",
false,
false,
37 EXPECT_LT(non_lstm_err, 98);
38 LOG(
INFO) <<
"********** Expected < 98 ************\n" ;
41 SetupTrainerEng(
"[1,1,0,32 Lfx100 O1c1]",
"1D-lstm",
false,
false);
43 EXPECT_LT(lstm_uni_err, 86);
44 LOG(
INFO) <<
"********** Expected < 86 ************\n" ;
47 EXPECT_LT(lstm_uni_err, non_lstm_err);
53 SetupTrainerEng(
"[1,32,0,3 S4,2 L2xy16 Ct1,1,16 S8,1 Lbx100 O1c1]",
54 "2D-color-lstm",
true,
true);
56 EXPECT_LT(lstm_uni_err, 85);
58 LOG(
INFO) <<
"********** Expected < 85 ************\n" ;
63 SetupTrainerEng(
"[1,1,0,32 Lbx100 O1c1]",
"bidi-lstm",
false,
false);
65 EXPECT_LT(lstm_bi_err, 75);
66 LOG(
INFO) <<
"********** Expected < 75 ************\n" ;
76 SetupTrainerEng(
"[1,32,0,1 S4,2 L2xy16 Ct1,1,16 S8,1 Lbx100 O1c1]",
77 "2-D-2-layer-lstm",
false,
false);
79 EXPECT_LT(lstm_2d_err, 98);
81 LOG(
INFO) <<
"********** Expected < 98 ************\n" ;
91 SetupTrainerEng(
"[1,32,0,1 S4,2 L2xy16 Ct1,1,16 S8,1 Lbx100 O1c1]",
92 "2-D-2-layer-lstm",
false,
true);
94 EXPECT_LT(lstm_2d_err, 70);
95 LOG(
INFO) <<
"********** Expected < 70 ************\n" ;
102 "[1,30,0,1 Ct5,5,16 Mp2,2 L2xy24 Ct1,1,48 Mp5,1 Ct1,1,32 S3,1 Lbx64 "
104 "2-D-2-layer-lstm",
false,
true);
106 LOG(
INFO) <<
"********** *** ************\n" ;
112 SetupTrainerEng(
"[1,32,0,1 S4,2 L2xy16 Ct1,1,16 S8,1 Lbx100 O1c1]",
113 "2-D-2-layer-lstm",
false,
false);
115 double act_error_a = trainer_->ActivationError();
116 double char_error_a = trainer_->CharError();
118 EXPECT_TRUE(trainer_->SaveTrainingDump(
NO_BEST_TRAINER, trainer_.get(),
120 SetupTrainerEng(
"[1,32,0,1 S4,2 L2xy16 Ct1,1,16 S8,1 Lbx100 O1c1]",
121 "2-D-2-layer-lstm",
false,
false);
123 double act_error_b = trainer_->ActivationError();
124 double char_error_b = trainer_->CharError();
125 EXPECT_FLOAT_EQ(lstm_2d_err_a, lstm_2d_err_b);
126 EXPECT_FLOAT_EQ(act_error_a, act_error_b);
127 EXPECT_FLOAT_EQ(char_error_a, char_error_b);
130 act_error_b = trainer_->ActivationError();
131 char_error_b = trainer_->CharError();
133 SetupTrainerEng(
"[1,32,0,1 S4,2 L2xy16 Ct1,1,16 S8,1 Lbx100 O1c1]",
134 "2-D-2-layer-lstm",
false,
false);
135 EXPECT_TRUE(trainer_->ReadTrainingDump(trainer_a_data, trainer_.
get()));
137 act_error_a = trainer_->ActivationError();
138 char_error_a = trainer_->CharError();
139 EXPECT_FLOAT_EQ(lstm_2d_err_a, lstm_2d_err_b);
140 EXPECT_FLOAT_EQ(act_error_a, act_error_b);
141 EXPECT_FLOAT_EQ(char_error_a, char_error_b);
142 LOG(
INFO) <<
"********** *** ************\n" ;
148 SetupTrainerEng(
"[1,1,0,32 Lfx96 O1c1]",
"1D-lstm",
false,
true);
150 EXPECT_LT(lstm_uni_err, 60);
152 LOG(
INFO) <<
"********** Expected < 60 ************\n" ;
159 LOG(
INFO) <<
"Delta in Int mode error rates = " << delta <<
"\n";
160 EXPECT_LT(delta, 0.01);
168 SetupTrainerEng(
"[1,1,0,32 LS96]",
"Lstm-+-softmax",
false,
true);
170 EXPECT_LT(lstm_sm_err, 49.0);
171 LOG(
INFO) <<
"********** Expected < 49 ************\n" ;
180 SetupTrainerEng(
"[1,1,0,32 LE96]",
"Lstm-+-softmax",
false,
true);
182 EXPECT_LT(lstm_sm_err, 62.0);
183 LOG(
INFO) <<
"********** Expected < 62 ************\n" ;
191 SetupTrainerEng(
"[1,32,0,1 Ct5,5,16 Mp2,2 Lfys32 Lbx128 O1c1]",
"SQU-lstm",
194 const int kNumLayers = 8;
196 const char* kLayerIds[kNumLayers] = {
":0",
":1:0",
":1:1",
":2",
197 ":3:0",
":4:0",
":4:1:0",
":5"};
198 const char* kLayerNames[kNumLayers] = {
"Input",
"Convolve",
"ConvNL",
199 "Maxpool",
"Lfys32",
"Lbx128LTR",
202 const int kNumWeights[kNumLayers] = {0,
206 32 * (4 * (32 + 16 + 1)),
207 128 * (4 * (128 + 32 + 1)),
208 128 * (4 * (128 + 32 + 1)),
209 112 * (2 * 128 + 1)};
212 EXPECT_EQ(kNumLayers, layers.
size());
213 for (
int i = 0; i < kNumLayers && i < layers.
size(); ++i) {
214 EXPECT_STREQ(kLayerIds[i], layers[i].c_str());
215 EXPECT_STREQ(kLayerNames[i],
216 trainer_->GetLayer(layers[i])->name().c_str());
217 EXPECT_EQ(kNumWeights[i], trainer_->GetLayer(layers[i])->num_weights());