File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 1
1
"""
2
- This program is a MNIST classifier using AlexNet.
2
+ This program is a MNIST classifier using AlexNet.
3
3
4
4
For example, to train and test AlexNet with 1 and 2 MNIST samples with 4 training epochs.
5
5
The command line input should be:
@@ -103,9 +103,9 @@ def test(model, test_loader):
103
103
with torch .no_grad ():
104
104
data , target = Variable (data ), Variable (target )
105
105
output = model (data )
106
- test_loss += F .cross_entropy (output , target , reduction = "sum" ).item ()
106
+ test_loss += F .cross_entropy (output , target , reduction = "sum" ).item ()
107
107
# size_average=False
108
- pred = output .data .max (1 , keepdim = True )[1 ]
108
+ pred = output .data .max (1 , keepdim = True )[1 ]
109
109
# get the index of the max log-probability
110
110
correct += pred .eq (target .data .view_as (pred )).long ().cpu ().sum ()
111
111
You can’t perform that action at this time.
0 commit comments