code: def run_test(ir, inputs, *, warmup_runs=10, test_runs=20) -> float:
      graph, _ = load_graph_and_inputs(ir)
      for _ in range(warmup_runs):
          graph(*inputs)
  
      is_cpu = None
      for input in inputs:
          if isinstance(input, torch.Tensor):
              is_cpu = input.device.type == "cpu"
              break
      assert is_cpu is not None
  
      out = (
          time_cpu(graph, inputs, test_runs)
          if is_cpu
          else time_cuda(graph, inputs, test_runs)
      )
      return out
  
file_path: pytorch/torch/utils/jit/log_extract.py
imports: from contextlib import contextmanager
  from typing import Any, List, Tuple, cast
  import random
  import torch
  import time
  from torch.utils.benchmark import Timer
label_desc: Use image node_id 6 for calling a global function with example usage: run_test(ir, inputs) and returns: out