-
In pure numpy, In jax numpy, This is because My (possibly incorrect) understanding is that I'm wondering if this is intended behaviour, or if there is a bug here? If the former, then perhaps there should be an explanation in the jax documentation that, unlike in numpy, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Thanks for the question! This is an intended departure from numpy's API: in most places JAX does not silently convert iterables to arrays, because this can hide performance issues. If you'd like to append a tuple to an array, you can call tup = (3, 4)
jnp.append(jnp.array([1, 2]), jnp.array(tup)) I think we should add a note about this to the Sharp Bits documentation. |
Beta Was this translation helpful? Give feedback.
Thanks for the question! This is an intended departure from numpy's API: in most places JAX does not silently convert iterables to arrays, because this can hide performance issues.
If you'd like to append a tuple to an array, you can call
jnp.asarray
explicitly; e.g.I think we should add a note about this to the Sharp Bits documentation.