You are currently calculating the max in the batch dimension, which seems to be wrong as you would usually compute the predictions by taking the argmax in the class dimension.
This should work:
output = model(data).squeeze() # output.shape == [12, 4]
preds = torch.argmax(output, dim=1) # preds.shape == [12]

I don’t think you need to unsqueeze and squeeze the tensors to calculate the accuracy and for a multi-class classification your target should also have the shape [batch_size==12].
PS: don’t use the .data attribute as it might yield unwanted side effects.