-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
np.median doesn't support read-only arrays #3070
Comments
It seems that problem is with .flatten() method, that is used by np.median. First of all the following snippet produces the same error import numpy as np
from numba import jit
@jit(nopython=True)
def flatten_and_change(arr):
result = arr.flatten()
result[0]=1
return result
x = np.random.random(100)
x.setflags(write=False)
flatten_and_change(x)
And second, I just can't return flattened array (maybe this should be considered as separate bug) import numpy as np
from numba import jit
@jit(nopython=True)
def flatten(arr):
return arr.flatten()
x = np.random.random(100)
x.setflags(write=False)
flatten(x)
|
Thanks for the report. I think #3070 (comment) is an oversight and a bug. For the second example (returning flattened array), I can't reproduce on 0.39rc1, I think 24df695 (#2668) fixed it? |
np.median implementation in Numba doesn't support read-only arrays, while non-jitted version does. When I launch the snippet below
I got an error
My setup:
The text was updated successfully, but these errors were encountered: