Skip to content

Fix for change to jax.Array.__contains__ - #5404

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_897742632
Apr 10, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
test_897742632

Conversation

@copybara-service

Copy link
Copy Markdown

Fix for change to jax.Array.__contains__

In jax-ml/jax#36655 JAX updates the implementation of jax.Array.__contains__, which makes val in array more efficient.

As part of this, JAX will become more strict in what types it allows; e.g. string in array will raise an error rather than returning False.

This update future-proofs code in preparation for this change.

@copybara-service
copybara-service Bot force-pushed the test_897742632 branch 2 times, most recently from 666f421 to 5adabe5 Compare April 10, 2026 18:04
In jax-ml/jax#36655 JAX updates the implementation of `jax.Array.__contains__`, which makes `val in array` more efficient.

As part of this, JAX will become more strict in what types it allows; e.g. `string in array` will raise an error rather than returning `False`.

This update future-proofs code in preparation for this change.

PiperOrigin-RevId: 897791321
@copybara-service
copybara-service Bot merged commit 64aa65a into main Apr 10, 2026
@copybara-service
copybara-service Bot deleted the test_897742632 branch April 10, 2026 18:18
aalquwayfili added a commit to aalquwayfili/flax that referenced this pull request Oct 11, 2026
google#5404 guarded the `OVERWRITE_WITH_GRADIENT in params` check in `create`,
but `apply_gradients` does the same check twice. With an array JAX now
raises `TypeError: Array.__contains__: unsupported operand type
<class 'str'>`, so use the same guard there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants