Computes p.ildj(x, ndims) - q.idlj(y, ndims)
, numerically stably.
tfp.experimental.bijectors.inverse_log_det_jacobian_ratio(
p, x, q, y, event_ndims, use_kahan_sum=True
)
Args |
p
|
A bijector instance.
|
x
|
A tensor from the support of p.forward .
|
q
|
A bijector instance of the same type as p , with matching shape.
|
y
|
A tensor from the support of q.forward .
|
event_ndims
|
The number of right-hand dimensions comprising the event shapes
of x and y .
|
use_kahan_sum
|
When True , the reduction of any remaining event_ndims
beyond the minimum is done using Kahan summation. This requires statically
known ranks.
|
Returns |
ildj_ratio
|
log ((abs o det o jac p^-1)(x) / (abs o det o jac q^-1)(y)) ,
i.e. in TFP code, p.inverse_log_det_jacobian(x, event_ndims) -
q.inverse_log_det_jacobian(y, event_ndims) . In some cases
this will be computed with better than naive numerical precision, e.g. by
moving differences inside of a sum reduction.
|