I get from https://stackoverflow.com/a/57417883/6861378 what np.reshape(-1) does. It's reshaping it into 1D array. But what about (a,(-1,1))?
a_concat = np.reshape(a,(-1,1))
reshape(-1) is a line vector, when reshape(-1,1) is a column:
>>> import numpy as np
>>> a = np.linspace(1,6,6).reshape(2,3)
>>> a
array([[ 1., 2., 3.],
[ 4., 5., 6.]])
>>> a.shape
(2, 3)
>>> a.reshape(-1)
array([ 1., 2., 3., 4., 5., 6.])
>>> a.reshape(-1,1)
array([[ 1.],
[ 2.],
[ 3.],
[ 4.],
[ 5.],
[ 6.]])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With