Created
December 30, 2021 21:17
-
-
Save GitHubEmploy/4a05c6158305eeccea1f90372750bb49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with torch.no_grad(): | |
correct = 0 | |
total = 0 | |
for images, labels in test_loader: | |
images = images.to(device) | |
labels = labels.to(device) | |
outputs = model(images) | |
_, predicted = torch.max(outputs.data, 1) | |
total += labels.size(0) | |
correct += (predicted == labels).sum().item() | |
print('Accuracy of the network on the MNIST test images: {} %'.format(100 * correct / total)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment