I assume that preds are the class predictions created via e.g. torch.argmax(outputs, 1).
Also, it seems that your target is one-hot encoded.
If that’s the case, you should get the class indices via:
labels = torch.argmax(labels, 1)

Note, that the usage of .data is discouraged, as it might have unwanted side effects.