KLDivLoss
class torch.nn.KLDivLoss(size_average=None, reduce=None, reduction='mean', log_target=False)
The Kullback-Leibler divergence loss.
For tensors of the same shape y_{\text{pred}},\ y_{\text{true}},
   where y_{\text{pred}} is the "input" and y_{\text{true}} is the
   "target", we define the pointwise KL-divergence as
  L(y_{\text{pred}},\ y_{\text{true}})     = y_{\text{true}} \cdot
  \log \frac{y_{\text{true}}}{y_{\text{pred}}}     =
  y_{\text{true}} \cdot (\log y_{\text{true}} - \log
  y_{\text{pred}})

To avoid underflow issues when computing this quantity, this loss
   expects the argument "input" in the log-space. The argument
   "target" may also be provided in the log-space if "log_target"=
   True.
To summarise, this function is roughly equivalent to computing
  if not log_target: # default
      loss_pointwise = target * (target.log() - input)
  else:
      loss_pointwise = target.exp() * (target - input)
