Skip to content

Commit

Permalink
fix logging in dcgan example (pytorch#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Varela Ramos authored and vfdev-5 committed Nov 2, 2018
1 parent 4b7481e commit 34e74e4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/gan/dcgan.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,11 @@ def step(engine, batch):

# attach running average metrics
monitoring_metrics = ['errD', 'errG', 'D_x', 'D_G_z1', 'D_G_z2']
for metric in monitoring_metrics:
RunningAverage(alpha=alpha, output_transform=lambda x: x[metric]).attach(trainer, metric)
RunningAverage(alpha=alpha, output_transform=lambda x: x['errD']).attach(trainer, 'errD')
RunningAverage(alpha=alpha, output_transform=lambda x: x['errG']).attach(trainer, 'errG')
RunningAverage(alpha=alpha, output_transform=lambda x: x['D_x']).attach(trainer, 'D_x')
RunningAverage(alpha=alpha, output_transform=lambda x: x['D_G_z1']).attach(trainer, 'D_G_z1')
RunningAverage(alpha=alpha, output_transform=lambda x: x['D_G_z2']).attach(trainer, 'D_G_z2')

# attach progress bar
pbar = ProgressBar()
Expand Down

0 comments on commit 34e74e4

Please sign in to comment.