docstr: 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.
docstr_tok: ["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","."]
code: def compute_recall(self, result_neighbors, ground_truth_neighbors):
      """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.
      """
      self.assertLen(result_neighbors.shape, 2)
      self.assertLen(ground_truth_neighbors.shape, 2)
      self.assertEqual(
          result_neighbors.shape[0], ground_truth_neighbors.shape[0]
      )
      gt_sets = [set(np.asarray(x)) for x in ground_truth_neighbors]
  
      def hits_per_q(q, nn_per_q):
          return len(
              list(x for x in nn_per_q if x.item() in gt_sets[q])
          )
  
      hits = sum(
          hits_per_q(q, nn_per_q)
          for q, nn_per_q in enumerate(result_neighbors)
      )
      return hits / ground_truth_neighbors.size
  
imports: import itertools
  from absl.testing import parameterized
  import numpy
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager.def_function import function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 2 for calling the ApproxTopkTest obj's underlying member method code with example usage: obj.compute_recall(result_neighbors, ground_truth_neighbors) and returns: unknown, len