code: def test(loader):
      model.eval()
  
      ious, categories = [], []
      y_map = torch.empty(
          loader.dataset.num_classes, device=device
      ).long()
      for data in loader:
          data = data.to(device)
          outs = model(data.x, data.pos, data.batch, data.ptr)
  
          sizes = (data.ptr[1:] - data.ptr[:-1]).tolist()
          for out, y, category in zip(
              outs.split(sizes),
              data.y.split(sizes),
              data.category.tolist(),
          ):
              category = list(ShapeNet.seg_classes.keys())[category]
              part = ShapeNet.seg_classes[category]
              part = torch.tensor(part, device=device)
  
              y_map[part] = torch.arange(part.size(0), device=device)
  
              iou = jaccard_index(
                  out[:, part].argmax(dim=-1),
                  y_map[y],
                  num_classes=part.size(0),
                  absent_score=1.0,
              )
              ious.append(iou)
  
          categories.append(data.category)
  
      iou = torch.tensor(ious, device=device)
      category = torch.cat(categories, dim=0)
  
      mean_iou = scatter(
          iou, category, reduce="mean"
      )  # Per-category IoU.
      return float(mean_iou.mean())
  
imports: import os.path
  import torch
  import torch.nn.functional
  from randlanet_classification import DilatedResidualBlock, SharedMLP, decimate
  from torch.nn import Linear
  from torchmetrics.functional import jaccard_index
  from tqdm import tqdm
  import torch_geometric.transforms
  from torch_geometric.datasets import ShapeNet
  from torch_geometric.loader import DataLoader
  from torch_geometric.nn import knn_interpolate
  from torch_geometric.typing import WITH_TORCH_CLUSTER
  from torch_geometric.utils import scatter
label_desc: Use image node_id 2 for calling a global function with example usage: test(loader) and returns: float