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)
  
          with torch.no_grad():
              pred = model(batch).view(
                  -1,
              )
  
          y_true.append(batch.y.view(pred.shape).detach().cpu())
          y_pred.append(pred.detach().cpu())
  
      y_true = torch.cat(y_true, dim=0)
      y_pred = torch.cat(y_pred, dim=0)
  
      input_dict = {"y_true": y_true, "y_pred": y_pred}
  
      return evaluator.eval(input_dict)["mae"]
  
file_path: ogb/examples/lsc/pcqm4m-v2/main_gnn.py
imports: import torch
  from torch_geometric.loader import DataLoader
  import torch.optim
  import torch.nn.functional
  from torch.utils.tensorboard import SummaryWriter
  from torch.optim.lr_scheduler import StepLR
  from gnn import GNN
  import os
  from tqdm.auto import tqdm
  import argparse
  import time
  import numpy
  import random
  from ogb.lsc import PygPCQM4Mv2Dataset, PCQM4Mv2Evaluator
label_desc: Use image node_id 2 for calling a global function with example usage: eval(model, device, loader, evaluator) and returns: evaluator