Apply to speak at TensorFlow World. Deadline April 23rd. Propose talk



  • tf.contrib.gan.eval.classifier_metrics.classifier_score
  • tf.contrib.gan.eval.classifier_score

Defined in tensorflow/contrib/gan/python/eval/python/

Classifier score for evaluating a conditional generative model.

This is based on the Inception Score, but for an arbitrary classifier.

This technique is described in detail in In summary, this function calculates

exp( E[ KL(p(y|x) || p(y)) ] )

which captures how different the network's classification prediction is from the prior distribution over classes.

NOTE: This function consumes images, computes their logits, and then computes the classifier score. If you would like to precompute many logits for large batches, use classifier_score_from_logits(), which this method also uses.


  • images: Images to calculate the classifier score for.
  • classifier_fn: A function that takes images and produces logits based on a classifier.
  • num_batches: Number of batches to split generated_images in to in order to efficiently run them through the classifier network.


The classifier score. A floating-point scalar of the same type as the output of classifier_fn.