Commit c847a41
Use
Why? JAX has always lowered `jnp.empty` to `jnp.zeros`, because in early versions of XLA there was no way to create an uninitialized buffer. In a future JAX release, `jnp.empty` will lower to `jax.lax.empty`, which creates an uninitialized buffer. This is closer to the intent of `jnp.empty`, and can lead to more efficient code when the author knows that initializing the array is not required.
These problematic uses were detected by temporarily making `jnp.empty` return `NaN` (for float & complex dtypes) or the maximum value (for int and bool dtypes), and running global presubmit tests.
PiperOrigin-RevId: 900691452jnp.zeros rather than jnp.empty in places where values are important.1 parent 413c164 commit c847a41
1 file changed
Lines changed: 1 addition & 1 deletion
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
0 commit comments