Skip to content

Commit

Permalink
unuse average over batch
Browse files Browse the repository at this point in the history
  • Loading branch information
chao1224 committed Jul 6, 2017
1 parent d610b4a commit 53f25e0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions mnist/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ def test():
if args.cuda:
data, target = data.cuda(), target.cuda()
data, target = Variable(data, volatile=True), Variable(target)
current_batch_size = data.data.size()[0]
output = model(data)
test_loss += F.nll_loss(output, target).data[0] * current_batch_size # sum up batch loss
test_loss += F.nll_loss(output, target, size_average=False).data[0] # sum up batch loss
pred = output.data.max(1)[1] # get the index of the max log-probability
correct += pred.eq(target.data).cpu().sum()

Expand Down

0 comments on commit 53f25e0

Please sign in to comment.