我想将张量列表转换为numpy数组/列表,然后将其求和并乘以历元数。我尝试使用MSE_for_all_epochs = sum(np.MSE_for_all_epochs),但收到以下错误消息:Traceback(最近一次呼叫最近): 文件“ train3_Eval.py”,行177 MSE_for_all_epochs = sum(np.MSE_for_all_epochs) AttributeError:模块'numpy'没有属性'MSE_for_all_epochs'
mean_test_error = mean_test_error.detach() / len(loader_test)
#store_MAE += mean_test_error
MAE_for_all_epochs.append(mean_test_error)
mse = math.sqrt(loss / len(loader_test))
#store_MSE +=mse
MSE_for_all_epochs.append(mse)
print("Test count error: %f" % mean_test_error)
print("MSE: %f" % mse)
MSE_for_all_epochs = sum(np.MSE_for_all_epochs)
MAE_for_all_epochs = sum(np.MAE_for_all_epochs)
print(MAE_for_all_epochs)
print(MSE_for_all_epochs)
model_mae= MSE_for_all_epochs / epoch
model_mse= MAE_for_all_epochs / epoch
print("Model MAE: %f" % model_mae)
print("Model MSE: %f" % model_mse)
模型输出如下:
tensor(1445.2251)
1602.6452224985646
Model MAE: 534.215074
Model MSE: 481.741699