code: def compute_recall(result_neighbors, ground_truth_neighbors) -> float:
      """Computes the recall of an approximate nearest neighbor search.
  
      Args:
        result_neighbors: int32 numpy array of the shape [num_queries,
          neighbors_per_query] where the values are the indices of the dataset.
        ground_truth_neighbors: int32 numpy array of with shape [num_queries,
          ground_truth_neighbors_per_query] where the values are the indices of the
          dataset.
  
      Returns:
        The recall.
      """
      assert (
          len(result_neighbors.shape) == 2
      ), "shape = [num_queries, neighbors_per_query]"
      assert (
          len(ground_truth_neighbors.shape) == 2
      ), "shape = [num_queries, ground_truth_neighbors_per_query]"
      assert (
          result_neighbors.shape[0] == ground_truth_neighbors.shape[0]
      )
      gt_sets = [set(np.asarray(x)) for x in ground_truth_neighbors]
      hits = sum(
          len([x for x in nn_per_q if x.item() in gt_sets[q]])
          for q, nn_per_q in enumerate(result_neighbors)
      )
      return hits / ground_truth_neighbors.size
  
file_path: jax/tests/ann_test.py
imports: from functools import partial
  import math
  from absl.testing import absltest
  import numpy
  import jax
  from jax import lax
  from jax._src import test_util
  from jax import config
label_desc: Use image node_id 1 for calling a global function with example usage: compute_recall(result_neighbors, ground_truth_neighbors) and returns: unknown