title: Passing weights to cross entropy loss
body: <p>I am trying to assign different weights to different classes, so I have modified my loss criterion as such:</p>
  
  <p>I had to convert the weight tensor to double <code>torch.DoubleTensor(weight)</code> since my <code>model</code> is already moved to <code>double()</code>. Am I doing it correctly ?</p>
  
  <pre><code>weights = [0.4,0.8,1.0]
  
  class_weights = torch.DoubleTensor(weights).cuda()
  
  criterion = nn.CrossEntropyLoss(weight=class_weights)
  </code></pre>