Reject masked JAX norm axes - #4983
Closed
FlorianPfaff wants to merge 2 commits into
Closed
Conversation
Contributor
✅MegaLinter analysis: Success
Notices📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining See detailed reports in MegaLinter artifacts Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining
|
Owner
Author
|
Closing as low value. This adds masked-array semantics to a JAX batched-solve path, but masked arrays are not part of the normal JAX/PyRecEst array contract. Supporting them here in isolation would create an inconsistent API without broader end-to-end masked-array support. |
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.

What changed
Root cause
The JAX
linalg.normcompatibility layer normalizes list and tuple axes entry by entry. For a masked NumPy scalar such asnp.ma.array(1, mask=True),operator.index()exposes the hidden payload. Consequently,axis=[np.ma.array(1, mask=True)]was silently normalized to(1,)and the norm was evaluated along axis 1 instead of rejecting a missing axis value.Direct masked arrays could also leak backend-specific
ValueErrors during JAX conversion rather than producing the documented axis validation error.Impact
Missing or masked configuration can no longer become a real norm axis through its hidden payload. Callers now receive a deterministic
TypeErrorfor all genuinely masked axis forms.Validation
1produced[5.0, 13.0]TypeError[5.0, 13.0]main, limited to 4 source lines and one focused regression fileGitHub Actions will run the repository's full supported backend and Python-version matrix.