question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Indexing bug with multiple index arrays

See original GitHub issue

From 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:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mattjjcommented, Jan 11, 2019

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.

0reactions
mattjjcommented, Jan 15, 2019

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found