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
Typing jit signature of readonly arrays inputs #4511
Labels
Comments
1 task
Thanks for the report. Unfortunately there's no short cut for specifying an array that is read only, the full In [1]: from numba import njit, types
In [2]: import numpy as np
In [3]: arr = np.array([1])
In [4]: arr.setflags(write=False)
In [5]: arr.flags
Out[5]:
C_CONTIGUOUS : True
F_CONTIGUOUS : True
OWNDATA : True
WRITEABLE : False
ALIGNED : True
WRITEBACKIFCOPY : False
UPDATEIFCOPY : False
In [6]: @njit((types.Array(types.int64, 1, 'C', readonly=True),)) # this is an int64, 1D, C order, read only array
...: def f(x):
...: return x
...:
In [7]: f(arr)
Out[7]: array([1])
In [8]: f.signatures
Out[8]: [(readonly array(int64, 1d, C),)] hope this helps. |
stuartarchibald
added
no action required
No action was needed to resolve.
question
Notes an issue as a question
labels
Sep 3, 2019
@mroeschke I will close this issue now as I believe this issue has been resolved. Thanks again for asking about this. |
Great, thanks for your response! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Reporting a bug
the change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).
to write one see http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports).
Is there a way to type the signature of readonly arrays? I did not find a way to specify readonly on the documentation page or StackOverflow (or maybe specifying array should work on readonly arrays as well?).
The text was updated successfully, but these errors were encountered: