Skip to content

Instantly share code, notes, and snippets.

@tobiolabode
Created October 21, 2020 18:04
class_correct = list(0. for i in range(10))
class_total = list(0. for i in range(10))
with torch.no_grad():
for data in testloader:
images, labels = data
outputs = net_debug(images)
_, predicted = torch.max(outputs, 1)
c = (predicted == labels).squeeze()
for i in range(1):
print(labels)
label = labels[i]
class_correct[label] += c.item()
class_total[label] += 1
for i in range(2):
print('Accuracy of %5s : %2d %%' % (
classes[i], 100 * class_correct[i] / class_total[i]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment