code: def timing(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
      avg_row_len = row.size(0) / dim_size
  
      def select(x):
          return x.index_select(0, row)
  
      def gather(x):
          return x.gather(0, row.view(-1, 1).expand(-1, x.size(1)))
  
      def gat_coo(x):
          return gather_coo(x, row)
  
      def gat_csr(x):
          return gather_csr(x, rowptr)
  
      t1, t2, t3, t4 = [], [], [], []
      for size in sizes:
          try:
              x = torch.randn((dim_size, size), device=args.device)
  
              t1 += [time_func(select, x)]
              t2 += [time_func(gather, x)]
              t3 += [time_func(gat_coo, x)]
              t4 += [time_func(gat_csr, x)]
  
              del x
  
          except RuntimeError as e:
              if "out of memory" not in str(e):
                  raise RuntimeError(e)
              torch.cuda.empty_cache()
              for t in (t1, t2, t3, t4):
                  t.append(float("inf"))
  
      ts = torch.tensor([t1, t2, t3, t4])
      winner = torch.zeros_like(ts, dtype=torch.bool)
      winner[ts.argmin(dim=0), torch.arange(len(sizes))] = 1
      winner = winner.tolist()
  
      name = f"{group}/{name}"
      print(f"{bold(name)} (avg row length: {avg_row_len:.2f}):")
      print("\t".join(["       "] + [f"{size:>5}" for size in sizes]))
      print(
          "\t".join(
              [bold("SELECT ")]
              + [bold(f"{t:.5f}", f) for t, f in zip(t1, winner[0])]
          )
      )
      print(
          "\t".join(
              [bold("GAT    ")]
              + [bold(f"{t:.5f}", f) for t, f in zip(t2, winner[1])]
          )
      )
      print(
          "\t".join(
              [bold("GAT_COO")]
              + [bold(f"{t:.5f}", f) for t, f in zip(t3, winner[2])]
          )
      )
      print(
          "\t".join(
              [bold("GAT_CSR")]
              + [bold(f"{t:.5f}", f) for t, f in zip(t4, winner[3])]
          )
      )
      print()
  
file_path: pytorch_scatter/benchmark/gather.py
imports: import time
  import itertools
  import argparse
  import torch
  from scipy.io import loadmat
  from torch_scatter import gather_coo, gather_csr
  from scatter_segment import short_rows, long_rows, download, bold
label_desc: Use image node_id 3 for calling a global function with example usage: timing(dataset) and returns: x, x, gather_coo, gather_csr