title: pytorch cross-entropy-loss weights not working
body: <p>I was playing around with some code and and it behaved differently than what i expected. So i dumbed it down to a minimally working example:</p>
  <pre><code>import torch
  
  test_act = torch.tensor([[2.,0.]])
  test_target = torch.tensor([0])
  
  loss_function_test = torch.nn.CrossEntropyLoss()
  loss_test = loss_function_test(test_act, test_target)
  print(loss_test)
  &gt; tensor(0.1269)
  
  weights=torch.tensor([0.1,0.5])
  loss_function_test = torch.nn.CrossEntropyLoss(weight=weights)
  loss_test = loss_function_test(test_act, test_target)
  print(loss_test)
  &gt; tensor(0.1269)
  </code></pre>
  <p>As you can see the outputs are the same regardless if there are weights present or not. But i would expect the second output to be 0.0127</p>
  <p>Is there some normalization going on that I dont know about? Or is it possibly bugged?</p>