What is the difference between flatten and ravel functions in numpy? 两者的功能是一致的,将多维数组降为一维,但是两者的区别是返回拷贝还是返回视图,np.flatten(0返回一份拷贝,对拷贝所做修改不会影响原始矩阵,而np.ravel()返回的是视图,修改时会影响原始矩阵 import numpy as np a = np.array([[1 , 2] , [3 , 4]]) b = a.flatten() print('b:…