Deep Learning, Machine Learning, Artificial Intelligence, Loss Function, Neural Networks.
respectively. The torch.nn.KLDivLoss module is used to compute the KL divergence loss between p and q. The reduction parameter is set to 'batchmean' to compute the mean loss over the batch. Note that p and q should be probabilities and sum up to 1 along the last dimension. The torch.log function is