How can I implement a weighted cross entropy loss in tensorflow using sparse_softmax_cross_entropy_with_logits
<p>I am starting to use tensorflow (coming from Caffe), and I am using the loss <code>sparse_softmax_cross_entropy_with_logits</code>. The function accepts labels like <code>0,1,...C-1</code> instead of onehot encodings. Now, I want to use a weighting depending on the class label; I know that this could be done maybe with a matrix multiplication if I use <code>softmax_cross_entropy_with_logits</code> (one hot encoding), Is there any way to do the same with <code>sparse_softmax_cross_entropy_with_logits</code>?</p>