code: def test(model, test_loader, dataset_name):
      evaluator = Evaluator(name=dataset_name)
      model.eval()
      xs = []
      y_true = []
      for i, batch in enumerate(test_loader):
          if i == 0:
              device = batch.x.device
          x = model(batch.x, batch.edge_index)[: batch.batch_size]
          xs.append(x.cpu())
          y_true.append(batch.y[: batch.batch_size].cpu())
  
      xs = [t.to(device) for t in xs]
      y_true = [t.to(device) for t in y_true]
      y_pred = torch.cat(xs, dim=0).argmax(dim=-1, keepdim=True)
      y_true = torch.cat(y_true, dim=0).unsqueeze(-1)
      test_acc = evaluator.eval(
          {
              "y_true": y_true,
              "y_pred": y_pred,
          }
      )["acc"]
      return test_acc
  
file_path: pytorch_geometric/examples/distributed/graphlearn_for_pytorch/dist_train_sage_supervised.py
imports: import argparse
  import os.path
  import time
  import graphlearn_torch
  import torch
  import torch.distributed
  import torch.nn.functional
  from ogb.nodeproppred import Evaluator
  from torch import Tensor
  from torch.nn.parallel import DistributedDataParallel
  from torch_geometric.nn import GraphSAGE
label_desc: Use image node_id 1 for calling a global function with example usage: test(model, test_loader, dataset_name) and returns: test_acc