Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. >>> a = np.array([[[1,2,3],[4,5,6]]])
  2. >>> a
  3. array([[[1, 2, 3],
  4. [4, 5, 6]]])
  5. >>> a.shape
  6. (1, 2, 3)
  7.  
  8. >>> new_a
  9. array([[[1, 4]],
  10. [[2, 5]],
  11. [[3, 6]]])
  12.  
  13. >>> a.reshape((3,1,2))
  14. array([[[1, 2]],
  15. [[3, 4]],
  16. [[5, 6]]])
  17.  
  18. a.transpose(2,0,1)
  19.  
  20. In [347]: a
  21. Out[347]:
  22. array([[[1, 2, 3],
  23. [4, 5, 6]]])
  24.  
  25. In [348]: a.transpose(2,0,1)
  26. Out[348]:
  27. array([[[1, 4]],
  28.  
  29. [[2, 5]],
  30.  
  31. [[3, 6]]])
  32.  
  33. np.moveaxis(a,2,0)
  34.  
  35. np.rollaxis(a,2,0)
  36.  
  37. array.transpose(2,0,1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement