Disable backpropagation into labels
@@ -20,6 +20,7 @@ def _softmax_cross_entropy(logits, labels, label_smoothing, mode):
if mode == tf.estimator.ModeKeys.TRAIN and label_smoothing > 0.0:
smoothed_labels = _smooth_one_hot_labels(logits, labels, label_smoothing)
if hasattr(tf.nn, "softmax_cross_entropy_with_logits_v2"):
+ smoothed_labels = tf.stop_gradient(smoothed_labels)
cross_entropy_fn = tf.nn.softmax_cross_entropy_with_logits_v2
else:
cross_entropy_fn = tf.nn.softmax_cross_entropy_with_logits
