I tried the multilabel classifier training,but function loss.backwork can not
pass through. It throws the error as follows:
RunTimeerror: grad can be implicitly created only for scalar outputs
some of my code is as follows:
loss=criterion(pred,label)
where pred and label have shapes as: [batchsize,class_number]
criterion = nn.BCEWithLogitsLoss(weight=None, reduce=False)
I read from document that loss must is scalar, should I use only batchsize 1?
Could anybody help me?