Skip to content

re: usage and typing of array I/O with NumPy exports #28889

Answered by jakevdp
nicholasjng asked this question in Q&A
Discussion options

You must be logged in to vote

jax.numpy.frombuffer will always return JAX arrays. jax.numpy.load will return JAX arrays from .npy files, but not from .npz files. This is because the object returned by np.load when passed a .npz file is a non-trivial lazy view of the buffers on disk, and there was no easy way to hook into this in order to make it return JAX arrays. It's something that could probably be addressed with some effort if it were important, but nobody has told us before now that it's important.

Also, NumPy's array serialization formats (.npy, .npz) are not particularly well-suited for JAX, because they pre-suppose the particular set of dtypes that NumPy supports, and so there's no way to specify bfloat16 or o…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nicholasjng
Comment options

Answer selected by nicholasjng
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants