-
I would like to reinterpret a jax array of dtype This part of the code is performance critical and I want to avoid copies as much as I could. Is there another API that actually returns a reinterpreted view? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi - thanks for the question! This is working as intended. Two JAX arrays can never share the same memory, and so there is no way for Keep in mind, however, that within a |
Beta Was this translation helpful? Give feedback.
Hi - thanks for the question! This is working as intended. Two JAX arrays can never share the same memory, and so there is no way for
view
to produce a second array that shares the same memory as the first.Keep in mind, however, that within a
jit
context this restriction is lifted, and the compiler can (and generally will) choose a more memory-efficient approach when it is possible to do so without violating the semantics of the original program.