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 compute_ewc_loss(
      model,
      ewc_data: EwcDataType,
      excluded_parameters: Set[str],
      device,
      lambd=0.0,
  ):
      params = SynapticIntelligencePlugin.allowed_parameters(
          model, excluded_parameters
      )
  
      loss = None
      for name, param in params:
          weights = param.to(device).flatten()  # Flat, not detached
          ewc_data0 = ewc_data[0][name].data.to(
              device
          )  # Flat, detached
          ewc_data1 = ewc_data[1][name].data.to(
              device
          )  # Flat, detached
          syn_loss: Tensor = torch.dot(
              ewc_data1, (weights - ewc_data0) ** 2
          ) * (lambd / 2)
  
          if loss is None:
              loss = syn_loss
          else:
              loss += syn_loss
  
      return loss
  
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 14 for calling the SynapticIntelligencePlugin obj's underlying member method code with example usage: obj.compute_ewc_loss(model, ewc_data, excluded_parameters, device, lambd) and returns: loss