You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that there is a regression after the merging of #13163
We had the case in scikit-learn where the parameter p passed to np.random.choice is a view on a 2D C-contiguous array. In the previous version, p was surely contiguous in memory:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/tmp/tmp.py in <module>
3 p = np.repeat(np.array([[0.1, 0, 0.3, 0.6, 0]]).T, 3, axis=1)
4
----> 5 x = np.random.choice(5, 3, p=p[:, 1])
6print(x)
mtrand.pyx in numpy.random.mtrand.RandomState.choice()
ValueError: probabilities do not sum to 1
Numpy/Python version information:
In [12]: np.__version__Out[12]: '1.17.0.dev0+495de50'
The text was updated successfully, but these errors were encountered:
It seems that there is a regression after the merging of #13163
We had the case in scikit-learn where the parameter
p
passed tonp.random.choice
is a view on a 2D C-contiguous array. In the previous version,p
was surely contiguous in memory:numpy/numpy/random/mtrand/mtrand.pyx
Line 1135 in a306a62
This has changed with the following:
numpy/numpy/random/mtrand.pyx
Line 782 in afc6981
However, no flag enforcing the contiguity is passed. It implies a failure when computing the
kahan_sum
which expect a contiguous array.I assume that it should be possible to pass the
NPY_ARRAY_C_CONTIGUOUS
flag when calling thePyArray_FROM_OTF
function.Reproducing code example:
Error message:
Numpy/Python version information:
The text was updated successfully, but these errors were encountered: