class_docstr: A PackNet module that has a weight and bias. This can be used to wrap
  many PyTorch modules such as `nn.Linear`, `nn.Conv2d` and `nn.ConvTranspose2d`
class_docstr_tok: ["A","PackNet","module","that","has","a","weight","and","bias",".","This","can","be","used","to","wrap","many","PyTorch","modules","such","as","`","nn.Linear","`",",","`","nn.Conv2d","`","and","`","nn.ConvTranspose2d","`"]
code: def __init__(self, wrappee: nn.Module) -> None:
      super().__init__()
      self.wrappee: nn.Module = wrappee
      # The following attributes are used to check that the wrappee is
      # compatible
      if not hasattr(wrappee, "weight") or not isinstance(
          wrappee.weight, nn.Parameter
      ):
          raise ValueError(f"weight must be defined in {wrappee}")
      self.has_bias = hasattr(wrappee, "bias") and isinstance(
          wrappee.weight, nn.Parameter
      )
  
      self.PRUNED_CODE: Tensor
      """Value used to code for a pruned weight, during the post-pruning phase"""
      self.register_buffer(
          "PRUNED_CODE", torch.tensor(255, dtype=torch.int)
      )
  
      self.task_index: Tensor
      """Tracks which task each weight belongs to. Of the same shape as the
          weight tensor."""
      self.register_buffer(
          "task_index",
          torch.ones_like(self.wrappee.weight).byte()
          * self._task_count,
      )
  
      self.visible_mask: Tensor
      """Mask of weights that are visible. Can be computed from `task_index`"""
      self.register_buffer(
          "visible_mask",
          torch.ones_like(self.task_index, dtype=torch.bool),
      )
  
      self.unfrozen_mask: Tensor
      """Mask of weights that are mutable. Can be computed from `task_index`"""
      self.register_buffer(
          "unfrozen_mask",
          torch.ones_like(self.task_index, dtype=torch.bool),
      )
  
      wrappee.weight.register_hook(self._remove_gradient_hook)
  
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 WeightAndBiasPackNetModule object from inherited base classes: PackNetModule with example: obj = WeightAndBiasPackNetModule(wrappee)