torch.argmax returns only the indices for the max values.
If you want to get the values and indices returned, you could use torch.max().
However, since you are deleting the first return value, I assume you only care about the indices, so
pred = torch.argmax(y, dim=1)

should work.
PS: Don’t use the .data attribute, as it might yield unwanted side effects.