The code looks fine. Which PyTorch version are you using, since NLLLoss2d was merged to NLLLoss as far as I know.
Your model could return:
def forward(self, x):
    ...
    return F.log_softmax(x)

Or you could apply the function before calling criterion.