docstr: - correct_index: shape (num_eval_triplets, )
  - pred_top10: shape (num_eval_triplets, 10)
docstr_tok: ["-","correct_index",":","shape","(","num_eval_triplets",",",")","-","pred_top10",":","shape","(","num_eval_triplets",",","10",")"]
code: def _calculate_mrr(self, correct_index, pred_top10):
      """
      - correct_index: shape (num_eval_triplets, )
      - pred_top10: shape (num_eval_triplets, 10)
      """
      # extract indices where correct_index is within top10
      tmp = torch.nonzero(
          correct_index.view(-1, 1) == pred_top10, as_tuple=False
      )
  
      # reciprocal rank
      # if rank is larger than 10, then set the reciprocal rank to 0.
      rr = torch.zeros(len(correct_index)).to(tmp.device)
      rr[tmp[:, 0]] = 1.0 / (tmp[:, 1].float() + 1.0)
  
      # mean reciprocal rank
      return float(rr.mean().item())
  
imports: from typing import Optional, Union, Dict
  import os
  import shutil
  import os.path
  import torch
  import numpy
  import pandas
  from ogb.utils.url import decide_download, download_url, extract_zip, makedirs
label_desc: Use image node_id 2 for calling the WikiKG90MEvaluator obj's underlying member method code with example usage: obj._calculate_mrr(correct_index, pred_top10) and returns: float