class_docstr: Meter to calculate top-k precision for single-label or multi-label
  image classification task. Note, ties are resolved randomly.
class_docstr_tok: ["Meter","to","calculate","top-k","precision","for","single-label","or","multi-label","image","classification","task",".","Note",",","ties","are","resolved","randomly","."]
docstr: args:
      topk: list of int `k` values.
docstr_tok: ["args",":","topk",":","list","of","int","`","k","`","values","."]
code: def __init__(self, topk):
      """
      args:
          topk: list of int `k` values.
      """
      super().__init__()
  
      assert isinstance(topk, Sequence), "topk must be a sequence"
      assert len(topk) > 0, "topk list should have at least one element"
      assert [
          is_pos_int(x) for x in topk
      ], "each value in topk must be >= 1"
  
      self._topk = topk
  
      # _total_* variables store running, in-sync totals for the
      # metrics. These should not be communicated / summed.
      self._total_correct_predictions_k = None
      self._total_sample_count = None
  
      # _curr_* variables store counts since the last sync. Only
      # these should be summed across workers and they are reset
      # after each communication
      self._curr_correct_predictions_k = None
      self._curr_sample_count = None
  
      # Initialize all values properly
      self.reset()
  
file_path: ClassyVision/classy_vision/meters/precision_meter.py
imports: from typing import Any, Dict, Sequence
  import torch
  from classy_vision.generic.distributed_util import all_reduce_sum
  from classy_vision.generic.util import is_pos_int, maybe_convert_to_one_hot
  from classy_vision.meters import ClassyMeter
  from .None import register_meter
label_desc: Use image node_id 1 to create a new PrecisionAtKMeter object from inherited base classes: ClassyMeter with example: obj = PrecisionAtKMeter(topk)