27 : test_data_(max_memory), total_pages_(0), async_running_(false) {}
35 tprintf(
"Failed to load list of eval filenames from %s\n",
58 if (total_pages_ == 0) {
59 result.
add_str_int(
"No test data at iteration", iteration);
62 if (!LockIfNotRunning()) {
63 result.
add_str_int(
"Previous test incomplete, skipping test at iteration",
68 STRING prev_result = test_result_;
70 if (training_errors !=
nullptr) {
71 test_iteration_ = iteration;
72 test_training_errors_ = training_errors;
73 test_model_mgr_ = model_mgr;
74 test_training_stage_ = training_stage;
86 int training_stage,
int verbosity) {
92 return "Deserialize failed";
94 int eval_iteration = 0;
95 double char_error = 0.0;
96 double word_error = 0.0;
98 while (error_count < total_pages_) {
108 if (verbosity > 1 || (verbosity > 0 && result !=
PERFECT)) {
118 char_error *= 100.0 / total_pages_;
119 word_error *= 100.0 / total_pages_;
135 void* LSTMTester::ThreadFunc(
void* lstmtester_void) {
137 lstmtester->test_result_ = lstmtester->
RunEvalSync(
138 lstmtester->test_iteration_, lstmtester->test_training_errors_,
139 lstmtester->test_model_mgr_, lstmtester->test_training_stage_,
141 lstmtester->UnlockRunning();
142 return lstmtester_void;
147 bool LSTMTester::LockIfNotRunning() {
149 if (async_running_)
return false;
150 async_running_ =
true;
155 void LSTMTester::UnlockRunning() {
157 async_running_ =
false;