Created
April 1, 2021 21:12
-
-
Save bkaankuguoglu/5e51d3882f628ef77645cb303117168a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def evaluate(self, test_loader, batch_size=1, n_features=1): | |
with torch.no_grad(): | |
predictions = [] | |
values = [] | |
for x_test, y_test in test_loader: | |
x_test = x_test.view([batch_size, -1, n_features]).to(device) | |
y_test = y_test.to(device) | |
self.model.eval() | |
yhat = self.model(x_test) | |
predictions.append(yhat.to(device).detach().numpy()) | |
values.append(y_test.to(device).detach().numpy()) | |
return predictions, values |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment