class_docstr: Decorator to register a KL divergence implementation function.
  
  Usage:
  
  ```python
  @distributions.RegisterKL(distributions.Normal, distributions.Normal)
  def _kl_normal_mvn(norm_a, norm_b):
    # Return KL(norm_a || norm_b)
  ```
class_docstr_tok: ["Decorator","to","register","a","KL","divergence","implementation","function",".","Usage",":","``","`","python","@","distributions.RegisterKL","(","distributions.Normal",",","distributions.Normal",")","def","_kl_normal_mvn","(","norm_a",",","norm_b",")",":","#","Return","KL","(","norm_a","||","norm_b",")","``","`"]
docstr: Perform the KL registration.
  
  Args:
    kl_fn: The function to use for the KL divergence.
  
  Returns:
    kl_fn
  
  Raises:
    TypeError: if kl_fn is not a callable.
    ValueError: if a KL divergence function has already been registered for
      the given argument classes.
docstr_tok: ["Perform","the","KL","registration",".","Args",":","kl_fn",":","The","function","to","use","for","the","KL","divergence",".","Returns",":","kl_fn","Raises",":","TypeError",":","if","kl_fn","is","not","a","callable",".","ValueError",":","if","a","KL","divergence","function","has","already","been","registered","for","the","given","argument","classes","."]
code: def __call__(self, kl_fn):
      """Perform the KL registration.
  
      Args:
        kl_fn: The function to use for the KL divergence.
  
      Returns:
        kl_fn
  
      Raises:
        TypeError: if kl_fn is not a callable.
        ValueError: if a KL divergence function has already been registered for
          the given argument classes.
      """
      if not callable(kl_fn):
          raise TypeError(
              "kl_fn must be callable, received: %s" % kl_fn
          )
      if self._key in _DIVERGENCES:
          raise ValueError(
              "KL(%s || %s) has already been registered to: %s"
              % (
                  self._key[0].__name__,
                  self._key[1].__name__,
                  _DIVERGENCES[self._key],
              )
          )
      _DIVERGENCES[self._key] = kl_fn
      return kl_fn
  
file_path: probability/tensorflow_probability/python/distributions/kullback_leibler.py
imports: import inspect
  import six
  import tensorflow.compat.v2
  from tensorflow.python.util import tf_inspect
label_desc: Use image node_id 2 for calling the RegisterKL obj's underlying member method code with example usage: obj.__call__(kl_fn) and returns: kl_fn