class_docstr: The Top-k Accuracy metric. This is a standalone metric.
  It is defined using torchmetrics.functional accuracy with top_k
class_docstr_tok: ["The","Top-k","Accuracy","metric",".","This","is","a","standalone","metric",".","It","is","defined","using","torchmetrics.functional","accuracy","with","top_k"]
docstr: Retrieves the running top-k accuracy.
  
  Calling this method will not change the internal state of the metric.
  
  :param task_label: if None, return the entire dictionary of accuracies
      for each task. Otherwise return the dictionary
  
  :return: A dictionary `{task_label: topk_accuracy}`, where the accuracy
      is a float value between 0 and 1.
docstr_tok: ["Retrieves","the","running","top-k","accuracy",".","Calling","this","method","will","not","change","the","internal","state","of","the","metric",".",":","param","task_label",":","if","None",",","return","the","entire","dictionary","of","accuracies","for","each","task",".","Otherwise","return","the","dictionary",":","return",":","A","dictionary","`","{","task_label",":","topk_accuracy","}","`",",","where","the","accuracy","is","a","float","value","between","0","and","1","."]
code: def result_task_label(self, task_label: int) -> Dict[int, float]:
      """
      Retrieves the running top-k accuracy.
  
      Calling this method will not change the internal state of the metric.
  
      :param task_label: if None, return the entire dictionary of accuracies
          for each task. Otherwise return the dictionary
  
      :return: A dictionary `{task_label: topk_accuracy}`, where the accuracy
          is a float value between 0 and 1.
      """
      assert task_label is not None
      return {task_label: self._topk_acc_dict[task_label].result()}
  
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 4 for calling the TopkAccuracy obj's underlying member method code with example usage: obj.result_task_label(task_label) and returns: dict