With the following code:
s = torch.softmax(torch.randn(100), dim=0)
d = torch.zeros(100)
d[43] = 1
loss = torch.nn.KLDivLoss()
loss(s,d)
And somehow this returns a negative value, why is it and how am I supposed to fix it?
Thank you.