tfp.experimental.distributions.log_prob_ratio

Computes p.log_prob(x) - q.log_prob(y), numerically stably.

p A distribution instance.
x A tensor from the support of p.
q A distribution instance in the same family as p, with matching shape.
y A tensor from the support of q.
name Optional name for ops in this scope.
**kwargs Passed to the distribution's log_prob_ratio implementation.

lp_ratio log (p(x) / q(y)) = p.log_prob(x) - q.log_prob(y). In some cases this will be computed with better than naive numerical precision, e.g. by moving the difference inside of a sum reduction.