Could you print the shape or words?
nn.Linear expects the input as a tensor of shape [batch_size, *, in_feautres].
Also, nn.NLLLoss expects a LongTensor as the target containing the class indices. It should therefore not be one-hot encoded.