-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use convert_element_type instead of device_put_raw. #6400
Conversation
Hi - out of curiosity, what was the impetus for this change? I ask because this kind of change tends to have subtle unintented consequences, so I'd prefer to avoid it unless there is good reason. |
Also, this code was written this way for performance, so we'd want to check some benchmarks for any change! #3350 has some basic microbenchmarks for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great find, Parker! (See jax-dev chat thread for more discussion.)
I ran the simple |
… static shape value. For reference: jax-ml/jax#6400
For reference: jax-ml/jax#6400. PiperOrigin-RevId: 369466397
For reference: jax-ml/jax#6400. PiperOrigin-RevId: 369466397
For reference: jax-ml/jax#6400. PiperOrigin-RevId: 369471455
also add a test for not performing H2D transfers while tracing jnp.array
With jax-ml/jax#6400, jnp.array delays resolving the axis name until after tracing is complete. PiperOrigin-RevId: 370356687
With jax-ml/jax#6400, jnp.array delays resolving the axis name until after tracing is complete. PiperOrigin-RevId: 370356687
With jax-ml/jax#6400, jnp.array delays resolving the axis name until after tracing is complete. PiperOrigin-RevId: 370356687
With jax-ml/jax#6400, jnp.array delays resolving the axis name until after tracing is complete. PiperOrigin-RevId: 370798828
For reference: jax-ml/jax#6400. PiperOrigin-RevId: 372376815
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@googlebot I consent. |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
This PR changes `jax.numpy.array()` to avoid creating any on-device arrays during tracing. As a consequence, calls to `jnp.array()` in a traced context, such as `jax.jit` will always be staged into the trace. This change may break code that depends on the current (undocumented and unintentional) behavior of `jnp.array()` to perform shape or index calculations that must be known statically (at trace time). The workaround for such cases is to use classic NumPy to perform shape/index calculations. PiperOrigin-RevId: 395998020
This PR changes `jax.numpy.array()` to avoid creating any on-device arrays during tracing. As a consequence, calls to `jnp.array()` in a traced context, such as `jax.jit` will always be staged into the trace. This change may break code that depends on the current (undocumented and unintentional) behavior of `jnp.array()` to perform shape or index calculations that must be known statically (at trace time). The workaround for such cases is to use classic NumPy to perform shape/index calculations. PiperOrigin-RevId: 395998020
This PR changes `jax.numpy.array()` to avoid creating any on-device arrays during tracing. As a consequence, calls to `jnp.array()` in a traced context, such as `jax.jit` will always be staged into the trace. This change may break code that depends on the current (undocumented and unintentional) behavior of `jnp.array()` to perform shape or index calculations that must be known statically (at trace time). The workaround for such cases is to use classic NumPy to perform shape/index calculations. PiperOrigin-RevId: 398008511
This PR changes `jax.numpy.array()` to avoid creating any on-device arrays during tracing. As a consequence, calls to `jnp.array()` in a traced context, such as `jax.jit` will always be staged into the trace. This change may break code that depends on the current (undocumented and unintentional) behavior of `jnp.array()` to perform shape or index calculations that must be known statically (at trace time). The workaround for such cases is to use classic NumPy to perform shape/index calculations. PiperOrigin-RevId: 398008511
No description provided.