From a92ade4aa4825e095314248d01f781a6789d10c9 Mon Sep 17 00:00:00 2001 From: wanghuancoder Date: Thu, 17 Dec 2020 11:32:15 +0800 Subject: [PATCH] modify batch cost time statistics (#126) --- ppgan/engine/trainer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ppgan/engine/trainer.py b/ppgan/engine/trainer.py index 7a1e1a8..4812a12 100644 --- a/ppgan/engine/trainer.py +++ b/ppgan/engine/trainer.py @@ -160,6 +160,9 @@ class Trainer: batch_cost_averager.record(time.time() - step_start_time, num_samples=self.cfg.get( 'batch_size', 1)) + + step_start_time = time.time() + if self.current_iter % self.log_interval == 0: self.data_time = reader_cost_averager.get_average() self.step_time = batch_cost_averager.get_average() @@ -172,8 +175,6 @@ class Trainer: if self.current_iter % self.visual_interval == 0: self.visual('visual_train') - step_start_time = time.time() - self.model.lr_scheduler.step() if self.by_epoch: -- GitLab