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
I encountered an error when i use the numpy.take function.
test : 2D array (20000x128) with double values
P: integer vector 128 values in the range of [0...127] none are the same.
if i execute the following code everything works fine and as intended, no error. np.take(test, P, axis=1, mode='raise', out=test)
if i execute np.take(test, P, axis=1, mode='wrap', out=test)
my output should be the same as in the other code, since i do not have any out-of-bounds indices. However, the output is different. Values are scrambled and appear multiple times although they are all different.
if executed as test = np.take(test, P, axis=1, mode='wrap') the output is correct.
same for: mode = 'clip'
numpy version 1.12.1
python version 2.7.13
The text was updated successfully, but these errors were encountered:
You are working on the array in place in those two modes, while the raise mode works on a copy (I guess as a trick to be consistent on error, even though there are other corner cases where we can't guarantee this too).
I think this issue is open elsewhere, don't know what the discussion result was there. If you don't want it to be in-place (which will cause this), you need to work on a copy anyway, so using the out keyword has no real use in any case if out is the same as the input (or has overlap with it).
I suppose we could add an overlap guard here, or so, since we started doing that for ufuncs, and a bit other things now.
I encountered an error when i use the numpy.take function.
test : 2D array (20000x128) with double values
P: integer vector 128 values in the range of [0...127] none are the same.
if i execute the following code everything works fine and as intended, no error.
np.take(test, P, axis=1, mode='raise', out=test)
if i execute
np.take(test, P, axis=1, mode='wrap', out=test)
my output should be the same as in the other code, since i do not have any out-of-bounds indices. However, the output is different. Values are scrambled and appear multiple times although they are all different.
if executed as
test = np.take(test, P, axis=1, mode='wrap')
the output is correct.same for: mode = 'clip'
numpy version 1.12.1
python version 2.7.13
The text was updated successfully, but these errors were encountered: