Skip to content

Instantly share code, notes, and snippets.

@khuangaf
Created May 30, 2019 15:40
Show Gist options
  • Save khuangaf/ea628505838ebffb3a82286be5368969 to your computer and use it in GitHub Desktop.
Save khuangaf/ea628505838ebffb3a82286be5368969 to your computer and use it in GitHub Desktop.
def evaluate(loader):
model.eval()
predictions = []
labels = []
with torch.no_grad():
for data in loader:
data = data.to(device)
pred = model(data).detach().cpu().numpy()
label = data.y.detach().cpu().numpy()
predictions.append(pred)
labels.append(label)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment