Repository navigation
Fix truncate/untruncate for Reactant - #37
Merged
Merged
Conversation
Member
Author
|
Ah, ffs, this is in #34. Edit: OK, this PR is slightly cleaner (and hanldes both Truncate and Untruncate) and has more tests. |
penelopeysm
commented
Nov 21, 2026
| @@ -91,7 +94,7 @@ function with_logabsdet_jacobian(u::Untruncate, x::Number) | |||
| # | |||
| # That's a failure with Enzyme.jacobian rather than Enzyme.gradient, so it's unlikely | |||
| # that it will really be hit in practice. But it's still worth being careful here | |||
Member
Author
There was a problem hiding this comment.
This looks irrelevant as the upstream fix has already landed?
Member
Author
There was a problem hiding this comment.
Claude says it works fine now on 1.10. I'll let CI be the arbiter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We tested the correctness quite thoroughly for
bijector(x)where x is a traced array / number, but we didn't cover the case wherebijectoris itself traced.For Truncate/Untruncate, this hit a problem because
if isfinite(lower)would error iflowerwas a traced number (and thenisfinite(lower)would be a traced bool).The fix for this is to just add
@tracebefore the if. That means that we pick up ReactantCore as a dep, which is fine.The newly added tests fail (for Truncate/Untruncate) before the code change, and pass now. For Exp and Log they always passed, but I figured we should test it for good measure.
Closes #36