Is it the correct way to calculate cross_entropy
xf1994 opened this issue · comments
xf1994 commented
In your implementation of Angleloss, the cross_entropy is calculated as:
logpt = F.log_softmax(output)
logpt = logpt.gather(1,target)
logpt = logpt.view(-1)
pt = Variable(logpt.data.exp())
loss = -1 * (1-pt)**self.gamma * logpt
loss = loss.mean()
It seems you only calculate the entropy of the target samples. Others are not calculated.