MSE loss #官方示例 from sklearn.metrics import mean_squared_error y_true = [[0.5, 1],[-1, 1],[7, -6]] y_pred = [[0, 2],[-1, 2],[8, -5]] mean_squared_error(y_true, y_pred) #0.708 验证 import numpy as np A = np.array(y_true) B = np.array(y_pred) mse = (np.square(A - B)).mean(axis=None) mse 结果如下