laebl one-hot encoding rate calculation accuracy
import tensorflow as tf
y = tf.constant([[0, 0, 1],
[1, 0, 0]], dtype=tf.float32)
y_pred = tf.random_uniform(shape=(2, 3))
accuracy = tf.reduce_mean(tf.cast(tf.equal(tf.argmax(y, 1), tf.argmax(y_pred, 1)), dtype=tf.float32))
with tf.Session() as sess:
print(accuracy.eval())