class_docstr: Defines the interface for implementing PackNet compatible PyTorch modules.
  
  The core idea of PackNet is to build a single network containing multiple
  task-specific subsets. Each subset builds on the previous subset and
  therefore shares parameters with the previous subset. But only the
  parameters not shared with the previous subset are mutable. This allows
  PackNet to isolate parameters for each task.
  
  Caution should be taken when optimizers with momentum are used, since they
  can cause parameters to be modified even when no gradient exists.
  
  PackNet has internal state that changes its behaviour and this class is
  responsible for ensuring that no invalid state transitions occur. When
  an invalid state transition occurs a `StateError` is thrown.
class_docstr_tok: ["Defines","the","interface","for","implementing","PackNet","compatible","PyTorch","modules",".","The","core","idea","of","PackNet","is","to","build","a","single","network","containing","multiple","task-specific","subsets",".","Each","subset","builds","on","the","previous","subset","and","therefore","shares","parameters","with","the","previous","subset",".","But","only","the","parameters","not","shared","with","the","previous","subset","are","mutable",".","This","allows","PackNet","to","isolate","parameters","for","each","task",".","Caution","should","be","taken","when","optimizers","with","momentum","are","used",",","since","they","can","cause","parameters","to","be","modified","even","when","no","gradient","exists",".","PackNet","has","internal","state","that","changes","its","behaviour","and","this","class","is","responsible","for","ensuring","that","no","invalid","state","transitions","occur",".","When","an","invalid","state","transition","occurs","a","`","StateError","`","is","thrown","."]
docstr: Prune a proportion of the unfrozen parameters from the module.
  
  The pruned parameters will be reused for the next task, while the
  remaining will be fine-tuned further on the current task, in the
  post-pruning phase.
  
  Prune may only be called when PackNet is in the `State.TRAINING` state.
  Prune will move PackNet to the `State.POST_PRUNE` state.
  
  :param prune_proportion: A proportion of the prunable parameters to
      prune. Must be between 0 and 1.
docstr_tok: ["Prune","a","proportion","of","the","unfrozen","parameters","from","the","module",".","The","pruned","parameters","will","be","reused","for","the","next","task",",","while","the","remaining","will","be","fine-tuned","further","on","the","current","task",",","in","the","post-pruning","phase",".","Prune","may","only","be","called","when","PackNet","is","in","the","`","State.TRAINING","`","state",".","Prune","will","move","PackNet","to","the","`","State.POST_PRUNE","`","state",".",":","param","prune_proportion",":","A","proportion","of","the","prunable","parameters","to","prune",".","Must","be","between","0","and","1","."]
code: def prune(self, prune_proportion: float):
      """Prune a proportion of the unfrozen parameters from the module.
  
      The pruned parameters will be reused for the next task, while the
      remaining will be fine-tuned further on the current task, in the
      post-pruning phase.
  
      Prune may only be called when PackNet is in the `State.TRAINING` state.
      Prune will move PackNet to the `State.POST_PRUNE` state.
  
      :param prune_proportion: A proportion of the prunable parameters to
          prune. Must be between 0 and 1.
      """
      if not 0 <= prune_proportion <= 1:
          raise ValueError(
              f"`prune_proportion` must be between 0 and 1, got "
              f"{prune_proportion}"
          )
      self._state_guard(
          self.prune.__name__,
          [self.State.TRAINING],
          self.State.POST_PRUNE,
      )
      self._prune(prune_proportion)
  
imports: import typing
  import torch
  import torch.nn
  from torch import Tensor
  from torch.nn import functional
  from abc import ABC, abstractmethod
  from enum import Enum
  from avalanche.core import BaseSGDPlugin, Template
  from avalanche.models.dynamic_modules import MultiTaskModule
  from avalanche.models.simple_mlp import SimpleMLP
  from typing import Union
  from avalanche.training.templates.base_sgd import BaseSGDTemplate
label_desc: Use image node_id 2 for calling the PackNetModule obj's underlying member method code with example usage: obj.prune(prune_proportion) without return types