Repository navigation
FEAT: allow single precision with the jax backend - #143
Merged
Merged
Conversation
set_backend gains enable_x64. True or False sets jax_enable_x64
explicitly. The default, None, enables 64-bit floats the first time the
jax backend is set, as before, and leaves the precision alone
afterwards, so a later set_backend("jax"), e.g., from a downstream
package, does not silently undo an explicit choice of single precision.
jax is now configured after the backend is imported, so a missing jax
still raises the usual ModuleNotFoundError.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #143 +/- ##
==========================================
+ Coverage 95.21% 95.25% +0.04%
==========================================
Files 14 14
Lines 940 948 +8
==========================================
+ Hits 895 903 +8
Misses 45 45
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
set_backendgains anenable_x64argument.TrueorFalsesetsjax_enable_x64explicitly.None, enables 64-bit floats the first time the jax backend is set, as now, and leaves the precision alone afterwards. A laterset_backend("jax"), e.g., from a downstream package, no longer silently undoes an explicit choice of single precision.ModuleNotFoundError.One behaviour change: previously every
set_backend("jax")re-enabled x64. Now only the first call does, unlessenable_x64=Trueis passed.On its own this mostly helps downstream packages that run in single precision. The densities themselves underflow below ~1e-38 in float32; the log-space evaluation in the follow-up PR (branch
log-space) handles that.Testing
test_set_backend_enable_x64: explicitTrue/False, and that a later default call keeps an explicit choice.🤖 Generated with Claude Code