Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@
"optimizer.zero_grad()\n",
"\n",
"# Forward pass, then backward pass, then update weights\n",
"output = model.forward(images)\n",
"output = model(images)\n",
"loss = criterion(output, labels)\n",
"loss.backward()\n",
"print('Gradient -', model[0].weight.grad)"
Expand Down Expand Up @@ -463,7 +463,7 @@
"img = images[0].view(1, 784)\n",
"# Turn off gradients to speed up this part\n",
"with torch.no_grad():\n",
" logits = model.forward(img)\n",
" logits = model(img)\n",
"\n",
"# Output of the network are logits, need to take softmax for probabilities\n",
"ps = F.softmax(logits, dim=1)\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@
"optimizer.zero_grad()\n",
"\n",
"# Forward pass, then backward pass, then update weights\n",
"output = model.forward(images)\n",
"output = model(images)\n",
"loss = criterion(output, labels)\n",
"loss.backward()\n",
"print('Gradient -', model[0].weight.grad)"
Expand Down Expand Up @@ -581,7 +581,7 @@
" # TODO: Training pass\n",
" optimizer.zero_grad()\n",
" \n",
" output = model.forward(images)\n",
" output = model(images)\n",
" loss = criterion(output, labels)\n",
" loss.backward()\n",
" optimizer.step()\n",
Expand Down Expand Up @@ -625,7 +625,7 @@
"img = images[0].view(1, 784)\n",
"# Turn off gradients to speed up this part\n",
"with torch.no_grad():\n",
" logps = model.forward(img)\n",
" logps = model(img)\n",
"\n",
"# Output of the network are logits, need to take softmax for probabilities\n",
"ps = torch.exp(logps)\n",
Expand Down