Estou tentando fazer uma rede neural de multi-classificação, o problema é que na hora de calcular a loss ocorre o seguinte erro
utilizo o otimizador: SGD
utilizo o calculador da loss: BCEWithLogitsLoss
--------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-62-2b30ec84cb8b> in <module>()
15
16
---> 17 loss = criterion(pred,rotulo)
18 epoch_loss.append(loss.cpu().data)
19
2 frames
/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py in binary_cross_entropy_with_logits(input, target, weight, size_average, reduce, reduction, pos_weight)
2431
2432 if not (target.size() == input.size()):
-> 2433 raise ValueError("Target size ({}) must be the same as input size ({})".format(target.size(), input.size()))
2434
2435 return torch.binary_cross_entropy_with_logits(input, target, weight, pos_weight, reduction_enum)
ValueError: Target size (torch.Size([20, 1])) must be the same as input size (torch.Size([20, 6]))