Skip to content

Commit

Permalink
Write TimeMeters and StopWatchMeters to tensorboard. (facebookresearc…
Browse files Browse the repository at this point in the history
  • Loading branch information
taylanbil authored Apr 3, 2020
1 parent aa9d12c commit c252f6f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fairseq/progress_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,10 @@ def _log_to_tensorboard(self, stats, tag='', step=None):
if isinstance(logval, torch.Tensor):
logval = logval.item()
writer.add_scalar(key, logval, step)
elif isinstance(stats[key], (TimeMeter, StopwatchMeter)):
logval = stats[key].avg
if logval:
writer.add_scalar(key, logval, step)
elif isinstance(stats[key], Number):
writer.add_scalar(key, stats[key], step)

Expand Down

0 comments on commit c252f6f

Please sign in to comment.