Skip to content

Instantly share code, notes, and snippets.

@ethanyanjiali
Last active March 14, 2020 21:15
Show Gist options
  • Save ethanyanjiali/a0ee15922ec029fc8cabd979f249294d to your computer and use it in GitHub Desktop.
Save ethanyanjiali/a0ee15922ec029fc8cabd979f249294d to your computer and use it in GitHub Desktop.
HG Loss
# vanilla version
loss += tf.math.reduce_mean(tf.math.square(labels - output))
# improved version
weights = tf.cast(labels > 0, dtype=tf.float32) * 81 + 1
loss += tf.math.reduce_mean(tf.math.square(labels - output) * weights)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment