code: def test(loader):
      memory.eval()
      gnn.eval()
      link_pred.eval()
  
      torch.manual_seed(
          12345
      )  # Ensure deterministic sampling across epochs.
  
      aps, aucs = [], []
      for batch in loader:
          batch = batch.to(device)
  
          n_id, edge_index, e_id = neighbor_loader(batch.n_id)
          assoc[n_id] = torch.arange(n_id.size(0), device=device)
  
          z, last_update = memory(n_id)
          z = gnn(
              z,
              last_update,
              edge_index,
              data.t[e_id].to(device),
              data.msg[e_id].to(device),
          )
          pos_out = link_pred(z[assoc[batch.src]], z[assoc[batch.dst]])
          neg_out = link_pred(
              z[assoc[batch.src]], z[assoc[batch.neg_dst]]
          )
  
          y_pred = torch.cat([pos_out, neg_out], dim=0).sigmoid().cpu()
          y_true = torch.cat(
              [
                  torch.ones(pos_out.size(0)),
                  torch.zeros(neg_out.size(0)),
              ],
              dim=0,
          )
  
          aps.append(average_precision_score(y_true, y_pred))
          aucs.append(roc_auc_score(y_true, y_pred))
  
          memory.update_state(batch.src, batch.dst, batch.t, batch.msg)
          neighbor_loader.insert(batch.src, batch.dst)
      return float(torch.tensor(aps).mean()), float(
          torch.tensor(aucs).mean()
      )
  
file_path: pytorch_geometric/examples/tgn.py
imports: import os.path
  import torch
  from sklearn.metrics import average_precision_score, roc_auc_score
  from torch.nn import Linear
  from torch_geometric.datasets import JODIEDataset
  from torch_geometric.loader import TemporalDataLoader
  from torch_geometric.nn import TGNMemory, TransformerConv
  from torch_geometric.nn.models.tgn import IdentityMessage, LastAggregator, LastNeighborLoader
label_desc: Use image node_id 2 for calling a global function with example usage: test(loader) and returns: float,  float