Skip to content

Commit

Permalink
fix(examples) Fix quickstart-pytorch GPU RuntimeError (#4386)
Browse files Browse the repository at this point in the history
  • Loading branch information
zjh199683 authored Oct 28, 2024
1 parent 95443d5 commit 323e612
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions examples/quickstart-pytorch/pytorchexample/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def train(net, trainloader, valloader, epochs, learning_rate, device):

def test(net, testloader, device):
"""Validate the model on the test set."""
net.to(device) # move model to GPU if available
criterion = torch.nn.CrossEntropyLoss()
correct, loss = 0, 0.0
with torch.no_grad():
Expand Down

0 comments on commit 323e612

Please sign in to comment.