code: def validate(
      model: torch.nn.Module, loader, device, curr_epoch, total_epochs
  ):
      model.eval()
  
      tt_loss = 0.0
      correct = 0.0
      num_graphs = 0
      num_batchs = len(loader)
  
      for batch in loader:
          batch_graphs, batch_labels = batch
          num_graphs += batch_labels.size(0)
          batch_graphs = batch_graphs.to(device)
          batch_labels = batch_labels.long().to(device)
          out, l1, l2 = model(batch_graphs, batch_graphs.ndata["feat"])
          tt_loss += compute_loss(
              out,
              batch_labels,
              l1,
              l2,
              curr_epoch,
              total_epochs,
              device,
          ).item()
          pred = out.argmax(dim=1)
          correct += pred.eq(batch_labels).sum().item()
  
      return correct / num_graphs, tt_loss / num_batchs
  
file_path: dgl/examples/pytorch/gxn/main_early_stop.py
imports: import json
  import os
  from datetime import datetime
  from time import time
  import dgl
  import torch
  import torch.nn.functional
  from data_preprocess import degree_as_feature, node_label_as_feature
  from dgl.data import LegacyTUDataset
  from dgl.dataloading import GraphDataLoader
  from networks import GraphClassifier
  from torch import Tensor
  from torch.utils.data import random_split
  from utils import get_stats, parse_args
label_desc: Use image node_id 4 for calling a global function with example usage: validate(model, loader, device, curr_epoch, total_epochs) and returns: unknown,  unknown