code: def distance_ratio_measure(I, R, D_GT, metric):
      sum_of_R = np.sum(np.where(I >= 0, R, 0))
      sum_of_D_GT = np.sum(np.where(I >= 0, D_GT, 0))
      if metric == faiss.METRIC_INNER_PRODUCT:
          return (sum_of_R / sum_of_D_GT).item()
      elif metric == faiss.METRIC_L2:
          return (sum_of_D_GT / sum_of_R).item()
      else:
          raise RuntimeError(f"unknown metric {metric}")
  
file_path: faiss/benchs/bench_fw/utils.py
imports: from time import perf_counter
  import logging
  from multiprocessing.pool import ThreadPool
  import numpy
  import faiss
  import functools
label_desc: Use image node_id 4 for calling a global function with example usage: distance_ratio_measure(I, R, D_GT, metric) and returns: unknown, unknown