def __init__(self, top_k: int):
        """
        Creates an instance of the standalone Top-k Accuracy metric.

        By default this metric in its initial state will return a value of 0.
        The metric can be updated by using the `update` method while
        the running top-k accuracy can be retrieved using the `result` method.

        :param top_k: integer number to define the value of k.
        """
        self._topk_acc_dict: Dict[int, Mean] = defaultdict(Mean)
        self.top_k: int = top_k

        self.__torchmetrics_requires_task = version.parse(
            torchmetrics.__version__
        ) >= version.parse("0.11.0")

        Creates an instance of the standalone Top-k Accuracy metric.

        By default this metric in its initial state will return a value of 0.
        The metric can be updated by using the `update` method while
        the running top-k accuracy can be retrieved using the `result` method.

        :param top_k: integer number to define the value of k.
        
avalanche/evaluation/metrics/topk_acc.py