code: def eval(model, device, loader, evaluator):
      model.eval()
      y_true = []
      y_pred = []
  
      for step, batch in enumerate(tqdm(loader, desc="Iteration")):
          batch = batch.to(device)
  
          if batch.x.shape[0] == 1:
              pass
          else:
              with torch.no_grad():
                  pred = model(batch)
  
              y_true.append(batch.y.view(pred.shape).detach().cpu())
              y_pred.append(pred.detach().cpu())
  
      y_true = torch.cat(y_true, dim=0).numpy()
      y_pred = torch.cat(y_pred, dim=0).numpy()
  
      input_dict = {"y_true": y_true, "y_pred": y_pred}
  
      return evaluator.eval(input_dict)
  
file_path: ogb/examples/graphproppred/mol/main_pyg.py
imports: import torch
  from torch_geometric.loader import DataLoader
  import torch.optim
  import torch.nn.functional
  from gnn import GNN
  from tqdm import tqdm
  import argparse
  import time
  import numpy
  from ogb.graphproppred import PygGraphPropPredDataset, Evaluator
label_desc: Use image node_id 2 for calling a global function with example usage: eval(model, device, loader, evaluator) and returns: evaluator