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

Method kl_div

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

Source from the content-addressed store, hash-verified

2832 return cp.linalg.eigh(a)
2833
2834 def kl_div(self, p, q, mass=False, eps=1e-16):
2835 value = cp.sum(p * cp.log(p / q + eps))
2836 if mass:
2837 value = value + cp.sum(q - p)
2838 return value
2839
2840 def isfinite(self, a):
2841 return cp.isfinite(a)

Callers

nothing calls this directly

Calls 2

sumMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected