26 : test_data_(max_memory) {}
34 tprintf(
"Failed to load list of eval filenames from %s\n",
35 filenames_file.
c_str());
57 if (total_pages_ == 0) {
58 result.
add_str_int(
"No test data at iteration ", iteration);
61 if (!LockIfNotRunning()) {
62 result.
add_str_int(
"Previous test incomplete, skipping test at iteration ",
67 STRING prev_result = test_result_;
69 if (training_errors !=
nullptr) {
70 test_iteration_ = iteration;
71 test_training_errors_ = training_errors;
72 test_model_mgr_ = model_mgr;
73 test_training_stage_ = training_stage;
74 std::thread t(&LSTMTester::ThreadFunc,
this);
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_;
131 void LSTMTester::ThreadFunc() {
133 test_iteration_, test_training_errors_,
134 test_model_mgr_, test_training_stage_,
141 bool LSTMTester::LockIfNotRunning() {
142 std::lock_guard<std::mutex> lock(running_mutex_);
143 if (async_running_)
return false;
144 async_running_ =
true;
149 void LSTMTester::UnlockRunning() {
150 std::lock_guard<std::mutex> lock(running_mutex_);
151 async_running_ =
false;