# How to set class weights for imbalanced classes in Tensorflow? [closed]

Do we have an equivalence for the following question, but with tensorflow : How to set class weights for imbalanced classes in Keras? ??

• Please ask a self-contained question, so we don't have to click on some link to understand what you are asking, and so we don't have to guess what you are asking. – D.W. Jun 2 '18 at 17:15

There's a function that does it automatically: tf.contrib.losses.softmax_cross_entropy(logits, onehot_labels, weight=weight)