Indexing bug with multiple index arrays
See original GitHub issueFrom the numpy docs:
import numpy as np
y = np.arange(35).reshape(5,7)
y[np.array([0,2,4]), np.array([0,1,2])]
yields array([ 0, 15, 30])
However this doesn’t work with jax:
import jax.numpy as np
y = np.reshape(np.arange(35), (5, 7))
y[np.array([0,2,4]), np.array([0,1,2])]
yields TypeError: No abstraction handler for type: <class 'tuple'>
Is this a bug, or am I misunderstanding jax’s intended capabilities?
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Bug (?) with numpy indexing - python - Stack Overflow
Purely integer array indexing When the index consists of as many integer arrays as the array being indexed has dimensions, the indexing is ......
Read more >17.1 Multiple Indexing | Stan User's Guide
The following is the simplest concrete example of multiple indexing with an array of integers; the ellipses stand for code defining the variables...
Read more >Bug #53838 :: Double Indexes in arrays / objects after cast
I don't understand this bug report. I see this in $_GET: Array ( [ang] => Array ( [1] => 79 [2] => 786...
Read more >MultiIndex / advanced indexing — pandas 1.5.2 documentation
Creating a MultiIndex (hierarchical index) object You can think of MultiIndex as an array of tuples where each tuple is unique. A MultiIndex...
Read more >How can I index multiple, nonsequential, nonlinearly spaced ...
How can I index multiple, nonsequential,... Learn more about indexing, nonlinear, array, basic MATLAB.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It’s a bug! We want to handle NumPy indexing exactly (except for boolean indexing, which we’ll add sooner or later but can’t be supported under
@jit
because it results in dynamic shapes).Thanks for raising this, and for the clear report.
Since we can’t repro the issue, and since we have a test checked in for it that passes, I’m going to close this issue as fixed. Please re-open if you run into it again!