Skip to content

Instantly share code, notes, and snippets.

@mikaem
Last active January 22, 2016 14:59
Show Gist options
  • Save mikaem/7ade09597b9a77d68bbe to your computer and use it in GitHub Desktop.
Save mikaem/7ade09597b9a77d68bbe to your computer and use it in GitHub Desktop.
from numpy import *
a = zeros((2,3,4,5))
b = rollaxis(a, 3)
a[:] = 1
print b.shape, b[0,0,0,0]
@mikaem
Copy link
Author

mikaem commented Jan 22, 2016

Running code leads to:
[1] run test_rollaxis
(5, 2, 3, 4) 1.0

In other words b is a view of the a array

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment