nn.CrossEntropyLoss expects raw logits as the input as it internally calls F.log_softmax and nn.NLLLoss on the model output.
Just remove the self.softmax(out)) in your model’s forward and run it again.
Also some minor tips for your code:


Variables are deprecated since 0.4.0. You can just use tensors instead, you don’t have to warp them anymore.
Call the model directly as nn1(input_) instead of the forward() method, as this will make sure to properly register all hooks.