code: def _test_recall_at_k_metric(self, metric, value):
      sample = Sample()
      predicted = dict()
  
      first_dimension = 10
      second_dimension = 100  # second dim MUST be 100
      sample.targets = torch.ones(first_dimension, second_dimension)
      predicted["scores"] = torch.ones(
          first_dimension, second_dimension
      )
  
      for i in range(first_dimension):
          for j in range(second_dimension):
              # sample = [[0, 1, 2, ..., 99], [0, 1, ..., 99], ...]
              sample.targets[i][j] = j
              if j == second_dimension - 1 and i != 0:
                  # changes last value or 'chosen candidate'
                  # to a lower rank as i increases
                  # predicted = [[0, 2, 4, ..., 198], [0, 2, ..., 196, 191],
                  # [0, ..., 196, 189], [0, ..., 196, 187], ...]
                  predicted["scores"][i][j] = j * 2 - 1 - (i + 2) * 2
              else:
                  # predicted = [[0, 2, 4, ..., 198], [0, 2, ...], ...]
                  predicted["scores"][i][j] = j * 2
  
      self.assertAlmostEqual(metric.calculate(sample, predicted), value)
  
imports: import os
  import unittest
  import mmf.modules.metrics
  import torch
  from mmf.common.registry import registry
  from mmf.common.sample import Sample
  from mmf.datasets.processors import CaptionProcessor
  from mmf.utils.configuration import load_yaml
label_desc: Use image node_id 5 for calling the TestModuleMetrics obj's underlying member method code with example usage: obj._test_recall_at_k_metric(metric, value) without return types