No out of bounds check during advanced array indexing
See original GitHub issueNumba ignores any indices that are out of bounds for a given array shape. This behavior is present in both basic and advanced indexing.
import numpy as np
import numba
@numba.njit
def something():
arr = np.ones((3,3))
arr[100] = 0
arr[:, np.array([2,3,5,100])] = 0
return arr
print(something()) # Does not raise error, ignores the out of bound indices completely.
print(something.py_func()) # Raises out of bounds error
Not sure if we should be considering this as a bug or a feature 😃
Should be easily fixed by adding a bounds check during indexing during function runtime.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Array Index Out Of Bounds Exception in Java - GeeksforGeeks
The ArrayIndexOutOfBoundsException is a Runtime Exception thrown only at runtime. The Java Compiler does not check for this error during the ...
Read more >Advanced indexing - managing out of bounds behaviour
I am trying to solve the issue of determining the out of bounds behaviour for indexing arrays. For the prior question see: How...
Read more >How to Fix the Array Index Out Of Bounds Excepiton in Java
The ArrayIndexOutOfBoundsException is a runtime exception in Java that occurs when an array is accessed with an illegal index.
Read more >4. Index Out of Bounds - Safe C++ [Book] - O'Reilly
The checks for an index out of bounds are performed inside the index(row, col) function, separately for row and column numbers, and in...
Read more >Question about safety when accessing an array out of bounds
You've just given an example of a runtime check. It doesn't ensure the index is in bounds at compile time; it simply ensures...
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
@kc611 suggest adding:
see if that helps?
Thank you that was exactly what I was looking for.