Your tensor looks like it is 1-hot encoded. The quickest is to take y.argmax(-1) but you might look into just providing the class indices.
Also, your tensor suspiciously looks like probabilities (summing to one and all). Note that CrossEntropyLoss expects logits, so if you have softmax at the end, you might drop that.
Best regards
Thomas