changing jnp dtype #5784
Answered
by
jakevdp
backpropper
asked this question in
Q&A
changing jnp dtype
#5784
-
what is the recommended way to change the dtype in jnp array? I'm using something like this: |
Beta Was this translation helpful? Give feedback.
Answered by
jakevdp
Feb 19, 2021
Replies: 1 comment 2 replies
-
Using |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
backpropper
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using
jnp.asarray
with adtype
argument is fine; you can also usenew_jnp_arr = old_jnp_arr.astype(jnp.int32)
. Both approaches end up being implemented in terms of the same lower-leveljax.lax.convert_element_type
function.