Skip to content

Instantly share code, notes, and snippets.

@pvt-16
Created June 17, 2019 13:35
Show Gist options
  • Select an option

  • Save pvt-16/14ccfedc662d8cefd29b19ec758d6e5d to your computer and use it in GitHub Desktop.

Select an option

Save pvt-16/14ccfedc662d8cefd29b19ec758d6e5d to your computer and use it in GitHub Desktop.
Using the test data set for MNIST fashion example
correct = 0
total = 0
for images, labels in testloader:
# images = Variable(images.float())
flattened_images = images.view(images.shape[0],-1)
outputs = model(flattened_images)
_, predicted = torch.max(outputs.data, 1)
total += labels.size(0)
correct += (predicted == labels).sum()
print('Test Accuracy of the model on the 10000 test images: %.4f %%' % (100 * correct / total))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment