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.
code: def before_backward(self, strategy: "SupervisedTemplate", **kwargs):
      super().before_backward(strategy, **kwargs)
  
      exp_id = strategy.clock.train_exp_counter
      try:
          si_lamb = self.si_lambda[exp_id]
      except (
          IndexError
      ):  # less than one lambda per experience, take last
          si_lamb = self.si_lambda[-1]
  
      syn_loss = SynapticIntelligencePlugin.compute_ewc_loss(
          strategy.model,
          self.ewc_data,
          self.excluded_parameters,
          lambd=si_lamb,
          device=self.device(strategy),
      )
  
      if syn_loss is not None:
          strategy.loss += syn_loss.to(strategy.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 3 for calling the SynapticIntelligencePlugin obj's underlying member method code with example usage: obj.before_backward(strategy) without return types