Skip to content

fix_reverse_out_bound_quadratic_spline #3140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pyro/distributions/transforms/spline.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ def _monotonic_rational_spline(
c = -input_delta * (inputs - input_cumheights)

discriminant = b.pow(2) - 4 * a * c
# Make sure outside_interval input can be reversed as identity.
discriminant = discriminant.masked_fill(outside_interval_mask, 0)
assert (discriminant >= 0).all()

root = (2 * c) / (-b - torch.sqrt(discriminant))
Expand Down