How can I make a KeyArray hashable under the new system? #17407
-
I have some code: def hashable(x: Any) -> Hashable:
if is_dataclass(x):
return astuple(x)
if isinstance(x, KeyArray):
return tuple(x.unsafe_raw_array().tolist())
... Is there a way to make this work under Jax's new |
Beta Was this translation helpful? Give feedback.
Answered by
jakevdp
Sep 1, 2023
Replies: 1 comment 2 replies
-
Rather than |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
NeilGirdhar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rather than
isinstance(x, KeyArray)
, you can useissubdtype(x.dtype, dtypes.prng_key)
. See #17297 for some discussion.