code: def time_func(func, x):
      try:
          if torch.cuda.is_available():
              torch.cuda.synchronize()
          t = time.perf_counter()
  
          if not args.with_backward:
              with torch.no_grad():
                  for _ in range(iters):
                      func(x)
          else:
              x = x.requires_grad_()
              for _ in range(iters):
                  out = func(x)
                  torch.autograd.grad(out, x, out, only_inputs=True)
  
          if torch.cuda.is_available():
              torch.cuda.synchronize()
          return time.perf_counter() - t
      except RuntimeError as e:
          if "out of memory" not in str(e):
              raise RuntimeError(e)
          torch.cuda.empty_cache()
          return float("inf")
  
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 2 for calling a global function with example usage: time_func(func, x) and returns: unknown, float