(logits, labels)
| 129 | |
| 130 | |
| 131 | def 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 |
no test coverage detected