Google I/O returns May 18-20! Reserve space and build your schedule Register now


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.

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.