Hi ptrblack,
thank you for your quick answer.
I am getting the shape of [batch_size, nb_classes], which is (10,5). The problem is with y_train (10,1).
Pls disregard for now this line:
“and I get same values over iterations” - I assume firstly the training has to start working, because the loss seems to get unreal values, thus the loss seems more less the same over 10 epochs and the results do not get better.
Anyway, when I use the squeezed y_train, I get (batch size 10, 5 classes):
tensor([2, 2, 0, 4, 1, 3, 2, 1, 1, 1])
torch.Size([10])
I tried eventually to adjust the logits after applying sigmoid into same shape by applying:
output = model(x_train)
output = torch.argmax(output, dim=-1)
and I get strange values:
tensor([1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
torch.Size([10])
Having same shapes finally, I tried to apply BCELoss, bot no success.
But my wish is to get the crossEntropy working at last, I do not know if I have to convert my y_train vector to one-hot encoding somehow for cross-entropy to see it properly?
On the other hand, I have read somewhere, that NLL recognizes 1D vector of labels and matches it with output layer (after applying logSoftmax, 5 classes as ouput), is it true? It does not work for me either…
Pls let me know if something is not clear.
Cheers,
Marek