nn.BCELoss can be applied with torch.sigmoid for a multi-label classification. Since you are using softmax, I assume you are working on a multi-class classification, and should probably stick to nn.CrossEntropyLoss. For this criterion, your shapes also seem to be wrong as described in my previous post.