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

Method kl_div

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

Source from the content-addressed store, hash-verified

2406 return torch.linalg.eigh(a)
2407
2408 def kl_div(self, p, q, mass=False, eps=1e-16):
2409 value = torch.sum(p * torch.log(p / q + eps))
2410 if mass:
2411 value = value + torch.sum(q - p)
2412 return value
2413
2414 def isfinite(self, a):
2415 return torch.isfinite(a)

Callers

nothing calls this directly

Calls 2

sumMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected