Skip to content

Instantly share code, notes, and snippets.

def softmax_cross_entropy_with_variance(onehot_labels, logits, variance,
simulations=100, scope=None):
"""Compute a cross-entropy loss with the aleatoric uncertainty."""
with tf.name_scope(scope, 'softmax_cross_entropy_loss_with_variance',
[logits, onehot_labels, variance]):
onehot_labels = tf.cast(onehot_labels, logits.dtype)
onehot_labels = tf.stop_gradient(onehot_labels)
samples_shape = tf.concat([tf.shape(logits), [simulations]], axis=0)

Keybase proof

I hereby claim:

  • I am master on github.
  • I am oleg_smirnov (https://keybase.io/oleg_smirnov) on keybase.
  • I have a public key whose fingerprint is EA30 8024 20E2 7578 2553 32EA F6C1 8AA6 7D9C F4EF

To claim this, I am signing this object: