code: def evaluate(model, labels, num_classes, dataloader, inv_target):
      model.eval()
      eval_logits = []
      eval_seeds = []
      with torch.no_grad():
          for input_nodes, output_nodes, blocks in dataloader:
              output_nodes = inv_target[output_nodes]
              for block in blocks:
                  block.edata["norm"] = dgl.norm_by_dst(
                      block
                  ).unsqueeze(1)
              logits = model(blocks)
              eval_logits.append(logits.cpu().detach())
              eval_seeds.append(output_nodes.cpu().detach())
      eval_logits = torch.cat(eval_logits)
      eval_seeds = torch.cat(eval_seeds)
      num_seeds = len(eval_seeds)
      loc_sum = accuracy(
          eval_logits.argmax(dim=1),
          labels[eval_seeds].cpu(),
          task="multiclass",
          num_classes=num_classes,
      ) * float(num_seeds)
      return torch.tensor([loc_sum.item(), float(num_seeds)])
  
file_path: dgl/examples/pytorch/rgcn/entity_sample_multi_gpu.py
imports: import argparse
  import os
  import dgl
  import torch
  import torch.distributed
  import torch.multiprocessing
  import torch.nn
  import torch.nn.functional
  from dgl.data.rdf import AIFBDataset, AMDataset, BGSDataset, MUTAGDataset
  from dgl.dataloading import DataLoader, MultiLayerNeighborSampler
  from dgl.nn.pytorch import RelGraphConv
  from torch.nn.parallel import DistributedDataParallel
  from torchmetrics.functional import accuracy
label_desc: Use image node_id 1 for calling a global function with example usage: evaluate(model, labels, num_classes, dataloader, inv_target) and returns: torch