jax.scipy.special.kl_div#

jax.scipy.special.kl_div(p, q)[原始碼]#

Kullback-Leibler 散度。

scipy.special.kl_div 的 JAX 實作。

\[\begin{split} \mathrm{kl\_div}(p, q) = \begin{cases} p\log(p/q)-p+q & p>0,q>0\\ q & p=0,q\ge 0\\ \infty & \mathrm{otherwise} \end{cases}\end{split}\]
參數:
  • p (ArrayLike) – 類陣列,實數值。

  • q (ArrayLike) – 類陣列,實數值。

回傳:

KL 散度值的陣列

回傳型別:

Array