code: def test(predictor, x, split_edge, evaluator, batch_size):
      predictor.eval()
  
      def test_split(split):
          source = split_edge[split]["source_node"].to(x.device)
          target = split_edge[split]["target_node"].to(x.device)
          target_neg = split_edge[split]["target_node_neg"].to(x.device)
  
          pos_preds = []
          for perm in DataLoader(range(source.size(0)), batch_size):
              src, dst = source[perm], target[perm]
              pos_preds += [predictor(x[src], x[dst]).squeeze().cpu()]
          pos_pred = torch.cat(pos_preds, dim=0)
  
          neg_preds = []
          source = source.view(-1, 1).repeat(1, 1000).view(-1)
          target_neg = target_neg.view(-1)
          for perm in DataLoader(range(source.size(0)), batch_size):
              src, dst_neg = source[perm], target_neg[perm]
              neg_preds += [
                  predictor(x[src], x[dst_neg]).squeeze().cpu()
              ]
          neg_pred = torch.cat(neg_preds, dim=0).view(-1, 1000)
  
          return (
              evaluator.eval(
                  {
                      "y_pred_pos": pos_pred,
                      "y_pred_neg": neg_pred,
                  }
              )["mrr_list"]
              .mean()
              .item()
          )
  
      train_mrr = test_split("eval_train")
      valid_mrr = test_split("valid")
      test_mrr = test_split("test")
  
      return train_mrr, valid_mrr, test_mrr
  
file_path: ogb/examples/linkproppred/citation2/mlp.py
imports: import argparse
  import torch
  import torch.nn.functional
  from torch.utils.data import DataLoader
  from ogb.linkproppred import PygLinkPropPredDataset, Evaluator
  from logger import Logger
label_desc: Use image node_id 2 for calling a global function with example usage: test(predictor, x, split_edge, evaluator, batch_size) and returns: train_mrr,  valid_mrr,  test_mrr, evaluator