I have a question.
is my code correct for accuracy of one label?
N, H, W = 2, 224, 224
nb_classes = 10
output = torch.randn(N, nb_classes, H, W)
preds = torch.argmax(output, 1)
labels = torch.randint(0, nb_classes, (N, H, W))
labels1 = labels.eq(5).float()
preds1 = preds.eq(5).float()
print(torch.sum(preds1 == labels1).float() / labels1.nelement())
>  tensor(0.8196)