numpy array inconsistency
See original GitHub issueReporting a bug
- I have tried using the latest released version of Numba (most recent is visible in the change log (https://github.com/numba/numba/blob/main/CHANGE_LOG).
- I have included a self contained code sample to reproduce the problem. i.e. it’s possible to run as ‘python bug.py’.
The following function works fine outside of numba:
def myfun():
y=np.zeros(10)
y[0]=np.array([3])
return y
However it fails with numba, as shown here:
@jit(nopython=True)
def myfun():
y=np.zeros(10)
y[0]=np.array([3])
return y
But can be made to work using:
@jit(nopython=True)
def myfun():
y=np.zeros(10)
y[0]=np.array([3])[0]
return y
This is awkward behaviour - would be nice if it could be solved. Thanks!
(I am using python 3.10 in conda, with numpy v 1.21.2 and numba v 0.55.0 which is the latest version available in conda). Use the following import statements:
import numpy as np
from numba import jit
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
python 3.x - numpy arrays are inconsistent - Stack Overflow
I've figured it out. My dataset had data points that weren't exactly 520 in length, so numpy was unable to create a 2d...
Read more >Dunder Data - Found a rare inconsistency with numpy You ...
Found a rare inconsistency with numpy You can convert a float array containing missing values to int. missing value replaced with smallest possible...
Read more >scipy.cluster.hierarchy.maxinconsts — SciPy v1.9.3 Manual
The inconsistency matrix. ... A monotonic (n-1) -sized numpy array of doubles. ... from scipy.cluster.hierarchy import median, inconsistent, maxinconsts ...
Read more >Inconsistent manual computing of cumsumming a array in ...
[Solved]-Inconsistent manual computing of cumsumming a array in Python-numpy ... x is symmetric, but the cumsum is not. ... The first column is...
Read more >Writing custom array containers — NumPy v1.25.dev0 Manual
!= self._N: ... raise TypeError("inconsistent sizes") ...
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

@amireson I have labelled it accordingly until such a time as a champion appears to fix it.
Further note. I think a way to write this that will work for any dimension single value array is using
np.take: