Created
July 16, 2018 19:00
-
-
Save risenW/a7086a6af81e0d949f998016630e3b6e to your computer and use it in GitHub Desktop.
Code for Sparse softmax cross entropy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
y_pred = tf.constant([[1., -3., 10.]]) | |
sparse_target_dist = tf.constant([2]) #true value is in the second position of the sparse tensor | |
sparse_x_entropy = tf.nn.sparse_softmax_cross_entropy_with_logits(labels= sparse_target_dist, logits=y_pred) | |
print(sess.run(sparse_x_entropy)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment