Hi @lima, nn.BCELoss 1 is designed for binary classification task. The prediction and label are both of shape (batch, ...).
In your case, you have 20 classes, which is a multi-class classification task. You can use nn.CrossEntropyLoss where the prediction is a float tensor of shape (batch, class, ...) and the label is a long tensor of shape (batch, ...).