Skip to content

Instantly share code, notes, and snippets.

@omarsar
Created August 19, 2018 03:15
Show Gist options
  • Save omarsar/4605530586c794660f86f545ae009da3 to your computer and use it in GitHub Desktop.
Save omarsar/4605530586c794660f86f545ae009da3 to your computer and use it in GitHub Desktop.
test_acc = 0.0
for i, data in enumerate(testloader, 0):
inputs, labels = data
inputs = inputs.view(-1, 28, 28)
outputs = model(inputs)
test_acc += get_accuracy(outputs, labels, BATCH_SIZE)
print('Test Accuracy: %.2f'%( test_acc/i))
### output
'''
Test Accuracy: 96.97
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment