code: def eval(model, device, loader, evaluator, arr_to_seq):
      model.eval()
      seq_ref_list = []
      seq_pred_list = []
  
      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_list = model(batch)
  
              mat = []
              for i in range(len(pred_list)):
                  mat.append(
                      torch.argmax(pred_list[i], dim=1).view(-1, 1)
                  )
              mat = torch.cat(mat, dim=1)
  
              seq_pred = [arr_to_seq(arr) for arr in mat]
  
              # PyG = 1.4.3
              # seq_ref = [batch.y[i][0] for i in range(len(batch.y))]
  
              # PyG >= 1.5.0
              seq_ref = [batch.y[i] for i in range(len(batch.y))]
  
              seq_ref_list.extend(seq_ref)
              seq_pred_list.extend(seq_pred)
  
      input_dict = {"seq_ref": seq_ref_list, "seq_pred": seq_pred_list}
  
      return evaluator.eval(input_dict)
  
file_path: ogb/examples/graphproppred/code2/main_pyg.py
imports: import torch
  from torch_geometric.loader import DataLoader
  import torch.optim
  import torch.nn.functional
  from torchvision import transforms
  from gnn import GNN
  from tqdm.auto import tqdm
  import argparse
  import time
  import numpy
  import pandas
  import os
  from ogb.graphproppred import PygGraphPropPredDataset, Evaluator
  from utils import ASTNodeEncoder, get_vocab_mapping
  from utils import augment_edge, encode_y_to_arr, decode_arr_to_seq
label_desc: Use image node_id 2 for calling a global function with example usage: eval(model, device, loader, evaluator, arr_to_seq) and returns: evaluator