class_docstr: A plugin calling PackNet's pruning and freezing procedures at the
  appropriate times. This plugin can only be used with `PackNet` models.
class_docstr_tok: ["A","plugin","calling","PackNet","'s","pruning","and","freezing","procedures","at","the","appropriate","times",".","This","plugin","can","only","be","used","with","`","PackNet","`","models","."]
docstr: The PackNetPlugin calls PackNet's pruning and freezing procedures at
  the appropriate times.
  
  :param post_prune_epochs: The number of epochs to finetune the model
      after pruning the parameters. Must be less than the number of
      training epochs.
  :param prune_proportion: The proportion of parameters to prune
      during each task. Can be a float, a list of floats, or a function
      that takes the task id and returns a float. Each value must be
      between 0 and 1.
docstr_tok: ["The","PackNetPlugin","calls","PackNet","'s","pruning","and","freezing","procedures","at","the","appropriate","times",".",":","param","post_prune_epochs",":","The","number","of","epochs","to","finetune","the","model","after","pruning","the","parameters",".","Must","be","less","than","the","number","of","training","epochs",".",":","param","prune_proportion",":","The","proportion","of","parameters","to","prune","during","each","task",".","Can","be","a","float",",","a","list","of","floats",",","or","a","function","that","takes","the","task","id","and","returns","a","float",".","Each","value","must","be","between","0","and","1","."]
code: def __init__(
      self,
      post_prune_epochs: int,
      prune_proportion: t.Union[
          float, t.Callable[[int], float], t.List[float]
      ] = 0.5,
  ):
      """The PackNetPlugin calls PackNet's pruning and freezing procedures at
      the appropriate times.
  
      :param post_prune_epochs: The number of epochs to finetune the model
          after pruning the parameters. Must be less than the number of
          training epochs.
      :param prune_proportion: The proportion of parameters to prune
          during each task. Can be a float, a list of floats, or a function
          that takes the task id and returns a float. Each value must be
          between 0 and 1.
      """
      super().__init__()
      self.post_prune_epochs = post_prune_epochs
      self.total_epochs: Union[int, None] = None
      self.prune_proportion: t.Callable[[int], float] = prune_proportion
  
      if isinstance(prune_proportion, float):
          assert 0 <= self.prune_proportion <= 1, (
              f"`prune_proportion` must be between 0 and 1, got "
              f"{self.prune_proportion}"
          )
          self.prune_proportion = lambda _: prune_proportion
      elif isinstance(prune_proportion, list):
          assert all(0 <= x <= 1 for x in prune_proportion), (
              "all values in `prune_proportion` must be between 0 and 1,"
              f" got {prune_proportion}"
          )
          self.prune_proportion = lambda i: prune_proportion[i]
      else:
          self.prune_proportion = 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 1 to create a new PackNetPlugin object from inherited base classes: BaseSGDPlugin with example: obj = PackNetPlugin(post_prune_epochs, prune_proportion)