F.nll_loss expects a target in the shape [batch_size] containing class indices in the range [0, nb_classes-1] for a multi-class classification use case.
It seems you are passing the target as a FloatTensor, so transform it via target = target.long() and make sure the shape and values are as described before.