class_docstr: The minibatch plugin top-k accuracy metric.
  This metric only works at training time.
  
  This metric computes the average top-k accuracy over patterns
  from a single minibatch.
  It reports the result after each iteration.
class_docstr_tok: ["The","minibatch","plugin","top-k","accuracy","metric",".","This","metric","only","works","at","training","time",".","This","metric","computes","the","average","top-k","accuracy","over","patterns","from","a","single","minibatch",".","It","reports","the","result","after","each","iteration","."]
docstr: Creates an instance of the MinibatchTopkAccuracy metric.
docstr_tok: ["Creates","an","instance","of","the","MinibatchTopkAccuracy","metric","."]
code: def __init__(self, top_k):
      """
      Creates an instance of the MinibatchTopkAccuracy metric.
      """
      super(MinibatchTopkAccuracy, self).__init__(
          reset_at="iteration",
          emit_at="iteration",
          mode="train",
          top_k=top_k,
      )
      self.top_k = top_k
  
imports: from typing import TYPE_CHECKING, List, Union, Dict
  import torch
  from torch import Tensor
  import torchmetrics
  from torchmetrics.functional import accuracy
  from avalanche.evaluation import Metric, GenericPluginMetric
  from avalanche.evaluation.metrics.mean import Mean
  from avalanche.evaluation.metric_utils import phase_and_task
  from collections import defaultdict
  from packaging import version
label_desc: Use image node_id 1 to create a new MinibatchTopkAccuracy object from inherited base classes: TopkAccuracyPluginMetric with example: obj = MinibatchTopkAccuracy(top_k)