MCPcopy Create free account
hub / github.com/PythonOT/POT / kl_div

Method kl_div

ot/backend.py:1851–1855  ·  view source on GitHub ↗
(self, p, q, mass=False, eps=1e-16)

Source from the content-addressed store, hash-verified

1849 return jnp.linalg.eigh(a)
1850
1851 def kl_div(self, p, q, mass=False, eps=1e-16):
1852 value = jnp.sum(p * jnp.log(p / q + eps))
1853 if mass:
1854 value = value + jnp.sum(q - p)
1855 return value
1856
1857 def isfinite(self, a):
1858 return jnp.isfinite(a)

Callers

nothing calls this directly

Calls 2

sumMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected