未验证 提交 a92ade4a 编写于 作者: W wanghuancoder 提交者: GitHub

modify batch cost time statistics (#126)

上级 d76c74e4
...@@ -160,6 +160,9 @@ class Trainer: ...@@ -160,6 +160,9 @@ class Trainer:
batch_cost_averager.record(time.time() - step_start_time, batch_cost_averager.record(time.time() - step_start_time,
num_samples=self.cfg.get( num_samples=self.cfg.get(
'batch_size', 1)) 'batch_size', 1))
step_start_time = time.time()
if self.current_iter % self.log_interval == 0: if self.current_iter % self.log_interval == 0:
self.data_time = reader_cost_averager.get_average() self.data_time = reader_cost_averager.get_average()
self.step_time = batch_cost_averager.get_average() self.step_time = batch_cost_averager.get_average()
...@@ -172,8 +175,6 @@ class Trainer: ...@@ -172,8 +175,6 @@ class Trainer:
if self.current_iter % self.visual_interval == 0: if self.current_iter % self.visual_interval == 0:
self.visual('visual_train') self.visual('visual_train')
step_start_time = time.time()
self.model.lr_scheduler.step() self.model.lr_scheduler.step()
if self.by_epoch: if self.by_epoch:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册