x = np.zeros((2,3,4))
基本用法:
x.reshape(2,3,2,2)
(2,3,4)的3度变成(2,3,2,2)的4维。
x.reshape(-1) 返回x直接展开成一维的数组,但x不变。和x.reshape(1,-1)等价。
x的元素总数为2*3*4=24,那么 x.reshape(n,-1)返回x展开成(n,24/n) 的数组。
x.reshape(-1,n) 返回x展开成(24/n,n) 的数组。
x.reshape(n1,n2, -1) 返回x展开成(n1, n2, 24/(n1*n2)) 的数组。