Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
input = tf.placeholder(tf.float32, shape=(None, 28, 28, 1), name="input")
labels = tf.placeholder(tf.float32, shape=(None, 10), name="labels")
...
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=logits, labels=labels), name="cost")
...
predictions = tf.nn.softmax(logits, name="predictions")
correct_prediction = tf.equal(tf.argmax(labels, 1), tf.argmax(predictions, 1))
accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32), name="accuracy")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment