class_docstr: Synaptic Intelligence plugin.
  
  This is the Synaptic Intelligence PyTorch implementation of the
  algorithm described in the paper
  "Continuous Learning in Single-Incremental-Task Scenarios"
  (https://arxiv.org/abs/1806.08568)
  
  The original implementation has been proposed in the paper
  "Continual Learning Through Synaptic Intelligence"
  (https://arxiv.org/abs/1703.04200).
  
  This plugin can be attached to existing strategies to achieve a
  regularization effect.
  
  This plugin will require the strategy `loss` field to be set before the
  `before_backward` callback is invoked. The loss Tensor will be updated to
  achieve the S.I. regularization effect.
docstr: Creates an instance of the Synaptic Intelligence plugin.
  
  :param si_lambda: Synaptic Intelligence lambda term.
      If list, one lambda for each experience. If the list has less
      elements than the number of experiences, last lambda will be
      used for the remaining experiences.
  :param eps: Synaptic Intelligence damping parameter.
  :param device: The device to use to run the S.I. experiences.
      Defaults to "as_strategy", which means that the `device` field of
      the strategy will be used. Using a different device may lead to a
      performance drop due to the required data transfer.
docstr_tok: ["Creates","an","instance","of","the","Synaptic","Intelligence","plugin",".",":","param","si_lambda",":","Synaptic","Intelligence","lambda","term",".","If","list",",","one","lambda","for","each","experience",".","If","the","list","has","less","elements","than","the","number","of","experiences",",","last","lambda","will","be","used","for","the","remaining","experiences",".",":","param","eps",":","Synaptic","Intelligence","damping","parameter",".",":","param","device",":","The","device","to","use","to","run","the","S.I",".","experiences",".","Defaults","to","``","as_strategy","''",",","which","means","that","the","`","device","`","field","of","the","strategy","will","be","used",".","Using","a","different","device","may","lead","to","a","performance","drop","due","to","the","required","data","transfer","."]
code: def __init__(
      self,
      si_lambda: Union[float, Sequence[float]],
      eps: float = 0.0000001,
      excluded_parameters: Optional[Sequence[str]] = None,
      device: Any = "as_strategy",
  ):
      """Creates an instance of the Synaptic Intelligence plugin.
  
      :param si_lambda: Synaptic Intelligence lambda term.
          If list, one lambda for each experience. If the list has less
          elements than the number of experiences, last lambda will be
          used for the remaining experiences.
      :param eps: Synaptic Intelligence damping parameter.
      :param device: The device to use to run the S.I. experiences.
          Defaults to "as_strategy", which means that the `device` field of
          the strategy will be used. Using a different device may lead to a
          performance drop due to the required data transfer.
      """
  
      super().__init__()
  
      if excluded_parameters is None:
          excluded_parameters = []
      self.si_lambda = (
          si_lambda
          if isinstance(si_lambda, (list, tuple))
          else [si_lambda]
      )
      self.eps: float = eps
      self.excluded_parameters: Set[str] = set(excluded_parameters)
      self.ewc_data: EwcDataType = (dict(), dict())
      """
          The first dictionary contains the params at loss minimum while the 
          second one contains the parameter importance.
          """
  
      self.syn_data: SynDataType = {
          "old_theta": dict(),
          "new_theta": dict(),
          "grad": dict(),
          "trajectory": dict(),
          "cum_trajectory": dict(),
      }
  
      self._device = device
  
imports: from fnmatch import fnmatch
  from typing import Optional, Sequence, Any, Set, List, Tuple, Dict, Union, TYPE_CHECKING
  import numpy
  import torch
  from torch import Tensor
  from torch.nn import Module
  from torch.nn.modules.batchnorm import _NormBase
  from .ewc import EwcDataType, ParamDict
  from avalanche.training.plugins.strategy_plugin import SupervisedPlugin
  from avalanche.training.utils import get_layers_and_params, ParamData
label_desc: Use image node_id 1 to create a new SynapticIntelligencePlugin object from inherited base classes: SupervisedPlugin with example: obj = SynapticIntelligencePlugin(si_lambda, eps, excluded_parameters, device)