code: def _get_ranking_metrics(self):
      dot_products = np.matmul(
          self.all_question_logits,
          np.transpose(self.all_context_logits),
      )
      inverse_sorted_indices = np.argsort(
          dot_products, axis=1
      )  # ascending
      positive_indices_per_question = self._get_positive_indices()
  
      num_questions = inverse_sorted_indices.shape[0]
      num_docs = inverse_sorted_indices.shape[1]
      rank_sum = 0
      reciprocal_rank_sum = 0
      # Sum up the rank of positive context in sorted scores for each question
      for i, pos_ctx_idx in enumerate(positive_indices_per_question):
          # Numpy returns a tuple of lists. So handle that.
          gold_idx = (
              inverse_sorted_indices[i] == pos_ctx_idx
          ).nonzero()[0][0]
          rank = num_docs - gold_idx
          rank_sum += rank
          reciprocal_rank_sum += 1.0 / rank
  
      average_rank = rank_sum / num_questions
      mean_reciprocal_rank = reciprocal_rank_sum / num_questions
  
      return average_rank, mean_reciprocal_rank
  
imports: from enum import Enum
  from typing import Any, Dict, List
  import numpy
  from pytext.common.constants import Stage
  from pytext.metric_reporters.channel import Channel, ConsoleChannel, FileChannel
  from pytext.metric_reporters.metric_reporter import MetricReporter
  from pytext.metrics.dense_retrieval_metrics import DenseRetrievalMetrics
label_desc: Use image node_id 9 for calling the DenseRetrievalMetricReporter obj's underlying member method code with example usage: obj._get_ranking_metrics() and returns: average_rank,  mean_reciprocal_rank