Skip to content

Commit

Permalink
comments 1
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-vaselli committed Sep 30, 2023
1 parent 4934a85 commit 4bcc21d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions nflows/transforms/splines/rational_quadratic.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def rational_quadratic_spline(

# Correcting for floating-point errors in the discriminant calculation.
# The float_precision_mask identifies elements where the discriminant is essentially zero,
# compared to the magnitude of b.pow(2),
# but appears nonzero due to machine precision limitations.
# Threshold values (1e-8 and 1e-6) are heuristic-based to manage numerical stability.
float_precision_mask = (torch.abs(discriminant) / (b.pow(2) + 1e-8)) < 1e-6
Expand Down

0 comments on commit 4bcc21d

Please sign in to comment.