Skip to content

Commit 4b67434

Browse files
authored
Merge pull request yunjey#49 from Kongsea/master
Update main-gpu.py
2 parents 8f459d7 + 9cce6c6 commit 4b67434

File tree

1 file changed

+3
-3
lines changed
  • tutorials/01-basics/feedforward_neural_network

1 file changed

+3
-3
lines changed

tutorials/01-basics/feedforward_neural_network/main-gpu.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def forward(self, x):
5757
for epoch in range(num_epochs):
5858
for i, (images, labels) in enumerate(train_loader):
5959
# Convert torch tensor to Variable
60-
images = Variable(images.view(-1, 28*28)).cuda()
61-
labels = Variable(labels).cuda()
60+
images = Variable(images.view(-1, 28*28).cuda())
61+
labels = Variable(labels.cuda())
6262

6363
# Forward + Backward + Optimize
6464
optimizer.zero_grad() # zero the gradient buffer
@@ -84,4 +84,4 @@ def forward(self, x):
8484
print('Accuracy of the network on the 10000 test images: %d %%' % (100 * correct / total))
8585

8686
# Save the Model
87-
torch.save(net.state_dict(), 'model.pkl')
87+
torch.save(net.state_dict(), 'model.pkl')

0 commit comments

Comments
 (0)