Solved by Abhilash_Srivastava in post #3 
              
              
                I was able to exactly align the loss values for KL-divergence and cross-entropy. See the code below: 
a = torch.randint(10, (2, 5))
b = torch.Tensor([[0., 0., 0., 1., 0.], [0., 0., 1., 0., 0.]])
target = torch.Tensor([3, 2]).type(torch.LongTensor)

print('a', a)
print('b', b)

a_log_soft = F.log_sof…