Solved by richard in post #2 
              
              
                Not really, no. KLDivLoss currently only supports getting the derivative of the input. 
Please feel free to submit a feature request and/or a PR if you’d like to fix it: https://github.com/pytorch/pytorch