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
So each time an empty array is initialized and then printed out, I think we should expect to see whatever the present value of x is to be added to each 'empty' index in the array? However, what actually occurs is this:
It appears that numpy continues to reference the last created 'empty' array even though we're calling the function five different times, so the values add cumulatively.
I think we should expect it to act similarly to np.zeros in that the values aren't added cumulatively, see below for an example.
Reproducing code example:
Expected Output
So each time an empty array is initialized and then printed out, I think we should expect to see whatever the present value of x is to be added to each 'empty' index in the array? However, what actually occurs is this:
Actual Output
It appears that numpy continues to reference the last created 'empty' array even though we're calling the function five different times, so the values add cumulatively.
I think we should expect it to act similarly to np.zeros in that the values aren't added cumulatively, see below for an example.
Output with np.zeros
Is this a bug? Or is this just the way that np.empty is supposed to act?
Numpy/Python version information:
1.15.1 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)]
The text was updated successfully, but these errors were encountered: