The most common cause for this mistake is that you have labels starting at 1.
For example with 10 classes you would have 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10 as labels.
However to use Crossentropy and NLL loss, your labels have to start at 0,so you would have to shift all labels by one to get labels from [0-9].
Is that your case?