class_docstr: Meter to calculate recall@k.
  
  Supports multi-target and multiple output. A list of recall meters is
  constructed and each output has a meter associated. Note RecallAtK is different
  than vanilla Recall.
  
  Example:
      target = [0 1 0 1 0]  # Correct classes are 1, 3
  
      pred = [0.06, 0.41, 0.04, 0.39, 0.1]  # Top-1 prediction is 1, top-3 is 1, 3, 0
  
      Recall@1: 1 correct / 2 total labels = 0.5
      Recall@3: 2 correct / 2 total labels = 1.0
  
  Args:
      num_meters: number of meters and hence we have same number of outputs
      topk_values: list of int `k` values. Example: [1, 5]
      meter_names: list of str indicating the name of meter. Usually corresponds
                   to the output layer name.
class_docstr_tok: ["Meter","to","calculate","recall","@","k.","Supports","multi-target","and","multiple","output",".","A","list","of","recall","meters","is","constructed","and","each","output","has","a","meter","associated",".","Note","RecallAtK","is","different","than","vanilla","Recall",".","Example",":","target","=","[","0","1","0","1","0","]","#","Correct","classes","are","1",",","3","pred","=","[","0.06",",","0.41",",","0.04",",","0.39",",","0.1","]","#","Top-1","prediction","is","1",",","top-3","is","1",",","3",",","0","Recall","@","1",":","1","correct","\/","2","total","labels","=","0.5","Recall","@","3",":","2","correct","\/","2","total","labels","=","1.0","Args",":","num_meters",":","number","of","meters","and","hence","we","have","same","number","of","outputs","topk_values",":","list","of","int","`","k","`","values",".","Example",":","[","1",",","5","]","meter_names",":","list","of","str","indicating","the","name","of","meter",".","Usually","corresponds","to","the","output","layer","name","."]
docstr: Value of the meter globally synced. For each output, all the top-k values are
  returned. If there are several meters attached to the same layer
  name, a list of top-k values will be returned for that layer name meter.
docstr_tok: ["Value","of","the","meter","globally","synced",".","For","each","output",",","all","the","top-k","values","are","returned",".","If","there","are","several","meters","attached","to","the","same","layer","name",",","a","list","of","top-k","values","will","be","returned","for","that","layer","name","meter","."]
code: def value(self):
      """
      Value of the meter globally synced. For each output, all the top-k values are
      returned. If there are several meters attached to the same layer
      name, a list of top-k values will be returned for that layer name meter.
      """
      val_dict = {}
      for ind, meter in enumerate(self._meters):
          meter_val = meter.value
          val_dict[ind] = {}
          val_dict[ind]["val"] = meter_val
      # also create dict w.r.t top-k
      output_dict = {}
      for k in self._topk_values:
          top_k_str = f"top_{k}"
          output_dict[top_k_str] = {}
          for ind in range(len(self._meters)):
              meter_name = (
                  self._meter_names[ind]
                  if (len(self._meter_names) > 0)
                  else ind
              )
              val = 100.0 * round(
                  float(val_dict[ind]["val"][top_k_str]), 6
              )
              # we could have several meters with the same name. We append the result
              # to the dict.
              if meter_name not in output_dict[top_k_str]:
                  output_dict[top_k_str][meter_name] = [val]
              else:
                  output_dict[top_k_str][meter_name].append(val)
      for topk in output_dict:
          for k in output_dict[topk]:
              if len(output_dict[topk][k]) == 1:
                  output_dict[topk][k] = output_dict[topk][k][0]
      return output_dict
  
file_path: vissl/vissl/meters/recall_at_k_list_meter.py
imports: import pprint
  from typing import List, Union
  import torch
  from classy_vision.generic.util import is_pos_int
  from classy_vision.meters import ClassyMeter, RecallAtKMeter, register_meter
  from vissl.config import AttrDict
label_desc: Use image node_id 4 for calling the RecallAtKListMeter obj's underlying member method code with example usage: obj.value() and returns: output_dict