There are a few issues in your code:

If you use nn.CrossEntropyLoss, you don’t need to call nn.Softmax on your model output, as the loss function will internally call nn.LogSoftmax and nn.NLLLoss. Just remove the self.softmax layer from your model.
Your model currently outputs two tensors, i.e. self.softmax(y) and x. I’m not sure, why you need x in the output, but you should pass output[0] to `criterion (after removing the softmax of course).

Variables are deprecated since PyTorch 0.4.0. You can just use tensors in the latest stable release.