Hi Srinath!



 YASJAY:

I want to implement cross entropy with softmax on logits with target of format [batchsize,C,H,W] where values are in the range [0,1).


Pytorch’s cross_entropy() takes targets that are integer class labels.
You can’t use so-called soft labels that are probabilities.
However, you can easily write your own version that does take soft
labels.  See this thread:

  
    
    
    Soft Cross Entropy Loss (TF has it does Pytorch have it) 
  
  
    softmax_cross_entropy_with_logits 
TF supports not needing to have hard labels for cross entropy loss: 
logits = [[4.0, 2.0, 1.0], [0.0, 5.0, 1.0]] labels = [[1.0, 0.0, 0.0], [0.0, 0.8, 0.2]] tf.nn.softmax_cross_entropy_with_logits(labels=labels, logits=logits) 
Can we do the same thing in Pytorch?
  


Best.
K. Frank