參考:numpy中的ravel()、flatten()、squeeze()的用法与区别
import numpy as np
ary = np.arange(12).reshape(3,4)
print(“ary:\n”,ary)
print(“ravel:\n”,ary.ravel())
print(“flatten:\n”,ary.flatten())
print(“reshape(-1):\n”,ary.reshape(-1))
print(‘ravel(“F”):\n’,ary.ravel(“F”))
推薦hahow線上學習python: https://igrape.net/30afN