Let's say I have a row vector of the shape (1, 256). I want to transform it into a column vector of the shape (256, 1) instead. How would you do it in Numpy?
We can simply use the reshape functionality of numpy:
a=np.array([[1,2,3,4]]) a: array([[1, 2, 3, 4]]) a.shape (1,4) b=a.reshape(-1,1) b: array([[1], [2], [3], [4]]) b.shape (4,1)
1.4m articles
1.4m replys
5 comments
57.0k users