Something like this should work:
N = 5
nb_classes = 10
h, w = 24, 24
output = torch.randn(N, nb_classes, h, w)
target = torch.randint(0, nb_classes, (N, h, w))

pred = torch.argmax(output, 1)
acc = (pred == target).float().mean()