<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.21.0/tensorflow/python/ops/distributions/kullback_leibler.py#L161-L210) |

Decorator to register a KL divergence implementation function.

    tf.compat.v1.distributions.RegisterKL(
        dist_cls_a, dist_cls_b
    )

#### Usage:

@distributions.RegisterKL(distributions.Normal, distributions.Normal)
def _kl_normal_mvn(norm_a, norm_b):
# Return KL(norm_a \|\| norm_b)

<br />

<br />

<br />

| ## Args ||
|---|---|
| `dist_cls_a` | the class of the first argument of the KL divergence. |
| `dist_cls_b` | the class of the second argument of the KL divergence. |

<br />

## Methods

### `__call__`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.21.0/tensorflow/python/ops/distributions/kullback_leibler.py#L189-L210)

    __call__(
        kl_fn
    )

Perform the KL registration.

<br />

<br />

<br />

| Args ||
|---|---|
| `kl_fn` | The function to use for the KL divergence. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| kl_fn ||

<br />

<br />

<br />

<br />

| Raises ||
|---|---|
| `TypeError` | if kl_fn is not a callable. |
| `ValueError` | if a KL divergence function has already been registered for the given argument classes. |

<br />