def activate_task(self, task_id: int):
        """Activates a task-specific subset of PackNet.

        When `task_id` is the active task, the active task can be trained using
        the remaining capacity. Otherwise, all parameters are frozen and
        the active task cannot be trained.

        This function can only be called when PackNet is in the `State.EVAL`,
        `State.TRAINING`, or `State.POST_PRUNE` state. Moving PackNet to the
        `State.EVAL` state if the `task_id` is not the active task. Otherwise,
        PackNet remains in the same state.

        :param task_id: The task to activate. Must be between 0 and the number
            of tasks seen so far.
        """
        if not (0 <= task_id <= self.task_count):
            raise ValueError(
                f"`task_id` must be between 0 and {self.task_count}, " f"got {task_id}"
            )
        if task_id != self.task_count:
            next_state = self.State.EVAL
        elif self.state == self.State.POST_PRUNE:
            next_state = self.State.POST_PRUNE
        else:
            next_state = self.State.TRAINING
        # Stop if the task is already active
        if task_id == self.active_task and self.state == next_state:
            return

        self._state_guard(
            self.activate_task.__name__,
            [self.State.EVAL, self.State.TRAINING],
            next_state,
        )
        self._activate_task(task_id)
        self._active_task.fill_(task_id)
Activates a task-specific subset of PackNet.

        When `task_id` is the active task, the active task can be trained using
        the remaining capacity. Otherwise, all parameters are frozen and
        the active task cannot be trained.

        This function can only be called when PackNet is in the `State.EVAL`,
        `State.TRAINING`, or `State.POST_PRUNE` state. Moving PackNet to the
        `State.EVAL` state if the `task_id` is not the active task. Otherwise,
        PackNet remains in the same state.

        :param task_id: The task to activate. Must be between 0 and the number
            of tasks seen so far.
        
avalanche/models/packnet.py