We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When reshaping, it's not always possible to return a view. In that case, NumPy makes a copy of the array to be reshaped, and then reshapes the copy.
In [1]: arr = np.arange(40).reshape(10, 4) In [2]: arr Out[2]: array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11], [12, 13, 14, 15], [16, 17, 18, 19], [20, 21, 22, 23], [24, 25, 26, 27], [28, 29, 30, 31], [32, 33, 34, 35], [36, 37, 38, 39]]) In [3]: arr.base Out[3]: array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39]) In [4]: arr[::3, ::2] Out[4]: array([[ 0, 2], [12, 14], [24, 26], [36, 38]]) In [5]: arr[::3, ::2].base Out[5]: array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39]) In [6]: arr[::3, ::2].reshape(-1) Out[6]: array([ 0, 2, 12, 14, 24, 26, 36, 38]) In [7]: arr[::3, ::2].reshape(-1).base Out[7]: array([[ 0, 2], [12, 14], [24, 26], [36, 38]]) In [8]: arr[::3, ::2].reshape(-1).base.base
The CopyNode would take a non-contiguous node and make a contiguous copy.
CopyNode
The text was updated successfully, but these errors were encountered:
ConcatenateNode
cb0fb2f
Successfully merging a pull request may close this issue.
When reshaping, it's not always possible to return a view. In that case, NumPy makes a copy of the array to be reshaped, and then reshapes the copy.
The
CopyNode
would take a non-contiguous node and make a contiguous copy.The text was updated successfully, but these errors were encountered: