import numpy as np cols = np.array([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10,11,12], [13,14,15,16]]) print(cols) print("\n") # reshape 默认按行填充 # 三维 表示 2个(2,4) w = cols.reshape(2, 2, 4) print(w) print("\n") # 四维 表示 1个(2,2,4) x = cols.reshape(1, 2, 2, 4) print(x) print("\n") # 五维 表示 1个(2,2,2,2) y = cols.reshape(1, 2, 2, 2, 2) print(y) print("\n") # 六维 表示 1个(2,2,1,2,2) z = cols.reshape(1, 2, 2, 1, 2, 2) print(z) print("\n")