@kullback_leibler.RegisterKL(Categorical, Categorical)<EOL>def _kl_categorical_categorical(a, b, name=None):
with tf.name_scope(name or "<STR_LIT>"):<EOL><INDENT>delta_log_probs1 = (tf.nn.log_softmax(a.logits) -<EOL>tf.nn.log_softmax(b.logits))<EOL>return tf.reduce_sum(<EOL>input_tensor=tf.nn.softmax(a.logits) * delta_log_probs1, axis=-<NUM_LIT:1>)<EOL><DEDENT>
Calculate the batched KL divergence KL(a || b) with a and b Categorical.

    Args:
      a: instance of a Categorical distribution object.
      b: instance of a Categorical distribution object.
      name: (optional) Name to use for created operations.
        default is "kl_categorical_categorical".

    Returns:
      Batchwise KL(a || b)