Skip to content

Commit 90a5ded

Browse files
author
Han Wang
committed
print the error at restart
1 parent f6b1041 commit 90a5ded

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

source/train/Trainer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ def train (self,
386386
fp = open(self.disp_file, "a")
387387

388388
cur_batch = self.sess.run(self.global_step)
389+
is_first_step = True
389390
self.cur_batch = cur_batch
390391
self.run_opt.message("start training at lr %.2e (== %.2e), final lr will be %.2e" %
391392
(self.sess.run(self.learning_rate),
@@ -417,8 +418,9 @@ def train (self,
417418
feed_dict_batch[self.place_holders[ii]] = batch_data[ii]
418419
feed_dict_batch[self.place_holders['is_training']] = True
419420

420-
if self.display_in_training and cur_batch == 0 :
421+
if self.display_in_training and is_first_step :
421422
self.test_on_the_fly(fp, data, feed_dict_batch)
423+
is_first_step = False
422424
if self.timing_in_training : tic = time.time()
423425
self.sess.run([self.train_op], feed_dict = feed_dict_batch, options=prf_options, run_metadata=prf_run_metadata)
424426
if self.timing_in_training : toc = time.time()

0 commit comments

Comments
 (0)