[1] -1 in np.reshape
- row 나 column의 개수를 강조할때 사용가능함
import numpy as np
a = np.arange(12)
b = a.reshape((2,-1)) # 처음 것을 fix하면 뒤는 자동적으로 결정됨
c = a.reshape((3,-1))
d = a.reshape((4,-1))
e = a.reshape((6,-1))
print(b.shape, c.shape, d.shape, e.shape)
b = a.reshape((-1,2))
c = a.reshape((-1,3))
d = a.reshape((-1,4))
e = a.reshape((-1,6))
print(b.shape, c.shape, d.shape, e.shape)
a = np.arange(24)
b = a.reshape((2,3,-1))
c = a.reshape((2,-1,4))
d = a.reshape((-1,3,4))
a = np.random.randint(0, 10, size = (2,2))
print(a)
row_vector = a.reshape(1,-1)
col_vector = a.reshape(-1, 1)
print(row_vector.shape, col_vector.shape)