class_docstr: Categorical probability distribution
docstr: kl
docstr_tok: ["kl"]
code: def kl(self, other):
      """kl"""
      a0 = self.logits - tf.reduce_max(
          self.logits, axis=-1, keepdims=True
      )
      a1 = other.logits - tf.reduce_max(
          other.logits, axis=-1, keepdims=True
      )
      ea0 = tf.exp(a0)
      ea1 = tf.exp(a1)
      z0 = tf.reduce_sum(ea0, axis=-1, keepdims=True)
      z1 = tf.reduce_sum(ea1, axis=-1, keepdims=True)
      p0 = ea0 / z0
      return tf.reduce_sum(
          p0 * (a0 - tf.log(z0) - a1 + tf.log(z1)), axis=-1
      )
  
imports: import tensorflow.compat.v1
  from .util import fc
label_desc: Use image node_id 6 for calling the CategoricalPd obj's underlying member method code with example usage: obj.kl(other) and returns: tf