It seems your code uses nn.CrossEntropyLoss (a custom implementation?) at one point, which calls into F.log_softmax(input, dim).
The input seems to have a single dimension, while dim is set to 1, which will yield the error posted in my previous code snippet.
Check the activation tensor in your model and make sure it has the expected number of dimensions.
For a multi-class classification, your model output would have two dimensions as [batch_size, nb_classes].