code: def timed(fn):
      if not cpu:
          start = torch.cuda.Event(enable_timing=True)
          end = torch.cuda.Event(enable_timing=True)
          start.record()
          result = fn()
          end.record()
          torch.cuda.synchronize()
          return result, start.elapsed_time(end) / 1000
      else:
          # measure process time between start and end
          start = time.process_time()
          result = fn()
          end = time.process_time()
          return result, end - start
  
file_path: bert-ultrafast/benchmark_pytorch/main.py
imports: import torch
  import warnings
  import sqlite3
  from moe import MoENetwork
  from fff import FF
  from fff import FFF
  from fff import FFF_Sparse
  import time
  import argparse
  import torch._dynamo
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: timed(fn) and returns: result,  unknown, result,  unknown