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","."]
code: def set_classy_state(self, state):
      assert (
          self.name == state["name"]
      ), "State name {state_name} does not match meter name {obj_name}".format(
          state_name=state["name"], obj_name=self.name
      )
      assert (
          self._topk == state["top_k"]
      ), "top-k of state {state_k} does not match object's top-k {obj_k}".format(
          state_k=state["top_k"], obj_k=self._topk
      )
  
      # Restore the state -- correct_predictions and sample_count.
      self.reset()
      self._total_correct_predictions_k = state[
          "total_correct_predictions"
      ].clone()
      self._total_sample_count = state["total_sample_count"].clone()
      self._curr_correct_predictions_k = state[
          "curr_correct_predictions_k"
      ].clone()
      self._curr_sample_count = state["curr_sample_count"].clone()
  
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 7 for calling the PrecisionAtKMeter obj's underlying member method code with example usage: obj.set_classy_state(state) without return types