Skip to content

Commit

Permalink
fixed running accuracy calculation in 16_tensorboard
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickloeber committed Oct 13, 2020
1 parent d71cf9d commit e6dd99c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion 16_tensorboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ def forward(self, x):
print (f'Epoch [{epoch+1}/{num_epochs}], Step [{i+1}/{n_total_steps}], Loss: {loss.item():.4f}')
############## TENSORBOARD ########################
writer.add_scalar('training loss', running_loss / 100, epoch * n_total_steps + i)
writer.add_scalar('accuracy', running_correct / 100, epoch * n_total_steps + i)
running_accuracy = running_correct / 100 / predicted.size(0)
writer.add_scalar('accuracy', running_accuracy, epoch * n_total_steps + i)
running_correct = 0
running_loss = 0.0
###################################################
Expand Down

0 comments on commit e6dd99c

Please sign in to comment.