ptrblck:

However, nn.NLLLoss (and nn.CrossEntropyLoss) expect a model output in the shape [batch_size, nb_classes, *] and a target in [batch_size, *] containing class indices in the range [0, nb_classes-1].


Thank you for the response, it helps a lot.