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 :

'mean': the weighted mean of the output is taken