Accuracy metrics - Keras
https://keras.io/api/metrics/accuracy_metricsSparseCategoricalAccuracy class tf.keras.metrics.SparseCategoricalAccuracy( name="sparse_categorical_accuracy", dtype=None ) Calculates how often predictions match integer labels. acc = np.dot(sample_weight, np.equal(y_true, np.argmax(y_pred, axis=1)) You can provide logits of classes as y_pred, since argmax of logits and probabilities are same.