code: def correctness(dataset):
      group, name = dataset
      mat = loadmat(f"{name}.mat")["Problem"][0][0][2].tocsr()
      rowptr = torch.from_numpy(mat.indptr).to(args.device, torch.long)
      row = torch.from_numpy(mat.tocoo().row).to(
          args.device, torch.long
      )
      dim_size = rowptr.size(0) - 1
  
      for size in sizes:
          try:
              x = torch.randn((row.size(0), size), device=args.device)
              x = x.squeeze(-1) if size == 1 else x
  
              out1 = scatter(
                  x, row, dim=0, dim_size=dim_size, reduce="add"
              )
              out2 = segment_coo(
                  x, row, dim_size=dim_size, reduce="add"
              )
              out3 = segment_csr(x, rowptr, reduce="add")
  
              assert torch.allclose(out1, out2, atol=1e-4)
              assert torch.allclose(out1, out3, atol=1e-4)
  
              out1 = scatter(
                  x, row, dim=0, dim_size=dim_size, reduce="mean"
              )
              out2 = segment_coo(
                  x, row, dim_size=dim_size, reduce="mean"
              )
              out3 = segment_csr(x, rowptr, reduce="mean")
  
              assert torch.allclose(out1, out2, atol=1e-4)
              assert torch.allclose(out1, out3, atol=1e-4)
  
              out1 = scatter(
                  x, row, dim=0, dim_size=dim_size, reduce="min"
              )
              out2 = segment_coo(x, row, reduce="min")
              out3 = segment_csr(x, rowptr, reduce="min")
  
              assert torch.allclose(out1, out2, atol=1e-4)
              assert torch.allclose(out1, out3, atol=1e-4)
  
              out1 = scatter(
                  x, row, dim=0, dim_size=dim_size, reduce="max"
              )
              out2 = segment_coo(x, row, reduce="max")
              out3 = segment_csr(x, rowptr, reduce="max")
  
              assert torch.allclose(out1, out2, atol=1e-4)
              assert torch.allclose(out1, out3, atol=1e-4)
  
          except RuntimeError as e:
              if "out of memory" not in str(e):
                  raise RuntimeError(e)
              torch.cuda.empty_cache()
  
file_path: pytorch_scatter/benchmark/scatter_segment.py
imports: import time
  import os.path
  import itertools
  import argparse
  import wget
  import torch
  from scipy.io import loadmat
  from torch_scatter import scatter, segment_coo, segment_csr
label_desc: Use image node_id 3 for calling a global function with example usage: correctness(dataset) without return types