Commit fa85b07
committed
Fix JAX AdvancedIncSubtensor crashing on a 0d update
set_subtensor(x[idx_vector], 1.0) raises AttributeError: 'float' object has
no attribute 'shape' under the JAX backend. The update input is a 0d
TensorType, so _check_runtime_broadcast_of_vector_index is entitled to a
value with a .shape, but jax_typify downgrades 0d arrays to Python scalars
before the op ever sees them.
Coerce y back to an array at the dispatch, which is the layer that knows it
is handing linker values to a check written against arrays. The .item() in
jax_typify is load-bearing for dispatches that need a static Python scalar
(axis/shape/loop-bound arguments), so it is left alone.1 parent a85bc78 commit fa85b07
2 files changed
Lines changed: 27 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
63 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
64 | 70 | | |
65 | 71 | | |
66 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
228 | 248 | | |
229 | 249 | | |
230 | 250 | | |
| |||
0 commit comments