Skip to content

Commit ae5248a

Browse files
committed
Fix some inference code to match the model with a log-softmax output
1 parent 1be1333 commit ae5248a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

intro-to-pytorch/Part 3 - Training Neural Networks (Exercises).ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,10 @@
463463
"img = images[0].view(1, 784)\n",
464464
"# Turn off gradients to speed up this part\n",
465465
"with torch.no_grad():\n",
466-
" logits = model(img)\n",
466+
" logps = model(img)\n",
467467
"\n",
468468
"# Output of the network are logits, need to take softmax for probabilities\n",
469-
"ps = F.softmax(logits, dim=1)\n",
469+
"ps = torch.exp(logps)\n",
470470
"helper.view_classify(img.view(1, 28, 28), ps)"
471471
]
472472
},

0 commit comments

Comments
 (0)