@kullback_leibler.RegisterKL(Beta, Beta)<EOL>def _kl_beta_beta(d1, d2, name=None):
def delta(fn, is_property=True):<EOL><INDENT>fn1 = getattr(d1, fn)<EOL>fn2 = getattr(d2, fn)<EOL>return (fn2 - fn1) if is_property else (fn2() - fn1())<EOL><DEDENT>with tf.name_scope(name or "<STR_LIT>"):<EOL><INDENT>return (delta("<STR_LIT>", is_property=False) -<EOL>tf.math.digamma(d1.concentration1) * delta("<STR_LIT>") -<EOL>tf.math.digamma(d1.concentration0) * delta("<STR_LIT>") +<EOL>(tf.math.digamma(d1.total_concentration) *<EOL>delta("<STR_LIT>")))<EOL><DEDENT>
Calculate the batchwise KL divergence KL(d1 || d2) with d1 and d2 Beta.

    Args:
      d1: instance of a Beta distribution object.
      d2: instance of a Beta distribution object.
      name: (optional) Name to use for created operations.
        default is "kl_beta_beta".

    Returns:
      Batchwise KL(d1 || d2)