jax.scipy.special.kl_div

Contents

jax.scipy.special.kl_div#

jax.scipy.special.kl_div(p, q)[source]#

Elementwise function for computing Kullback-Leibler divergence.

LAX-backend implementation of scipy.special.kl_div().

Original docstring below.

\[\begin{split}\mathrm{kl\_div}(x, y) = \begin{cases} x \log(x / y) - x + y & x > 0, y > 0 \\ y & x = 0, y \ge 0 \\ \infty & \text{otherwise} \end{cases}\end{split}\]
Returns:

Values of the Kullback-Liebler divergence.

Return type:

scalar or ndarray

References

Parameters: