Hello everyone,
How can I use KL divergence loss instead of MSE loss for regression? Let’s say in a batch of 30 samples we have 30 ground truth labels. In the case of MSE utilization, the mean square of these 30 labels would be calculated and backpropagated to the layers. Now I want to fit a gaussian or a GMM to the 30 labels and get the KL divergence between the true and the predicted distribution and use it as the loss function of the network. How can I do so with Pytorch tensors?