Boolean array indexing is not compatible with static memory allocation
See original GitHub issueJAX is built on top of XLA which (currently) requires static memory allocation for operations. This means it is not possible to express operations like x[y]
where y
is a boolean, because the resulting array has value dependent size: https://data-apis.github.io/array-api/latest/API_specification/indexing.html#boolean-array-indexing
It’s definitely possible that the static memory allocation requirement could be relaxed in the future, but dynamic memory allocation is always going to be harder to implement in a performant way. For example, I would guess Numba also struggles with this sort of operation. I don’t think we should require it for array libraries implementing our standard, since it isn’t needed for the majority of array operations.
Issue Analytics
- State:
- Created 3 years ago
- Comments:19 (18 by maintainers)
Top Results From Across the Web
Memory overflow in numpy boolean array - python
Save this question. Show activity on this post. I am trying to create a large Boolean array (for a prime number sieve). I...
Read more >GPU Pro Tip: Fast Dynamic Indexing of Private Arrays in CUDA
This post covers best practices in dynamic indexing of per-thread private arrays in CUDA C++ programs, including explanation of the benefits ...
Read more >Indexing on ndarrays — NumPy v1.24 Manual
If there is only one Boolean array and no integer indexing array present, this is straightforward. Care must only be taken to make...
Read more >BooleanArrays (fastutil 8.5.9) - Unimi
A class providing static methods and objects that do useful things with type-specific arrays. In particular, the forceCapacity() , ensureCapacity() , grow() ...
Read more >Array (GNU Classpath 0.94-pre Documentation)
These are not to be confused with the classes java.lang.Boolean, java.lang. ... static boolean, getBoolean(Object array, int index).
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 FreeTop 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
Top GitHub Comments
The summary of a discussion we had a few days ago:
As this issue should be addressed (boolean indexing is optional and admonitions have been added to the specification), will close this out.
If additional discussion is necessary, we can either reopen this issue or open a new one.