MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / compute_accuracy

Function compute_accuracy

tensorflow/examples/tf2_showcase/mnist.py:131–135  ·  view source on GitHub ↗
(logits, labels)

Source from the content-addressed store, hash-verified

129
130
131def compute_accuracy(logits, labels):
132 predictions = tf.argmax(logits, axis=1, output_type=tf.int64)
133 labels = tf.cast(labels, tf.int64)
134 return tf.reduce_mean(
135 tf.cast(tf.equal(predictions, labels), dtype=tf.float32))
136
137
138# TODO(brianklee): Enable @tf.function on the training loop when zip, enumerate

Callers 2

trainFunction · 0.85
import_and_evalFunction · 0.85

Calls 4

argmaxMethod · 0.80
reduce_meanMethod · 0.80
equalMethod · 0.80
castMethod · 0.45

Tested by

no test coverage detected