In torch.nn.KLDivLoss, when I set “reduction = mean”, I receive this warning:
UserWarning: reduction: ‘mean’ divides the total loss by both the batch size and the support size.‘batchmean’ divides only by the batch size, and aligns with the KL div math definition.‘mean’ will be changed to behave the same as ‘batchmean’ in the next major release.
warnings.warn(“reduction: ‘mean’ divides the total loss by both the batch size and the support size.”
Thank you for your reply. Does this “mean” reduction in KLDivLoss is equal to the functionality of “mean” in CrossentropyLoss as well?
In the documentation for torch.nn.CrossEntropyLoss it has mentioned :
hi, @InnovArul , i also met this warning in computing kl loss, do i need to set the reduction to ‘none’ to avoid this warning? or just ignore it? which is the right way?