error = torch.abs(preds - targets).sum().data squared_error = ((preds - targets)*(preds - targets)).sum().data runnning_mae += error runnning_mse += squared_error
mse = math.sqrt(running_mselen(loader_test)) mae = running_maelen(loader_test)