Skip to content

Commit 53f25e0

Browse files
committed
unuse average over batch
1 parent d610b4a commit 53f25e0

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mnist/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,8 @@ def test():
9797
if args.cuda:
9898
data, target = data.cuda(), target.cuda()
9999
data, target = Variable(data, volatile=True), Variable(target)
100-
current_batch_size = data.data.size()[0]
101100
output = model(data)
102-
test_loss += F.nll_loss(output, target).data[0] * current_batch_size # sum up batch loss
101+
test_loss += F.nll_loss(output, target, size_average=False).data[0] # sum up batch loss
103102
pred = output.data.max(1)[1] # get the index of the max log-probability
104103
correct += pred.eq(target.data).cpu().sum()
105104

0 commit comments

Comments
 (0)