class_docstr: Elastic Weight Consolidation (EWC) plugin.
  EWC computes importance of each weight at the end of training on current
  experience. During training on each minibatch, the loss is augmented
  with a penalty which keeps the value of the current weights close to the
  value they had on previous experiences in proportion to their importance
  on that experience. Importances are computed with an additional pass on the
  training set. This plugin does not use task identities.
docstr: Compute importances of parameters after each experience.
docstr_tok: ["Compute","importances","of","parameters","after","each","experience","."]
code: def after_training_exp(self, strategy, **kwargs):
      """
      Compute importances of parameters after each experience.
      """
      exp_counter = strategy.clock.train_exp_counter
      importances = self.compute_importances(
          strategy.model,
          strategy._criterion,
          strategy.optimizer,
          strategy.experience.dataset,
          strategy.device,
          strategy.train_mb_size,
          num_workers=kwargs.get("num_workers", 0),
      )
      self.update_importances(importances, exp_counter)
      self.saved_params[exp_counter] = copy_params_dict(strategy.model)
      # clear previous parameter values
      if exp_counter > 0 and (not self.keep_importance_data):
          del self.saved_params[exp_counter - 1]
  
file_path: avalanche/avalanche/training/plugins/ewc.py
imports: from collections import defaultdict
  from typing import Dict, Tuple, Union
  import warnings
  import itertools
  import torch
  from torch.utils.data import DataLoader
  from avalanche.models.utils import avalanche_forward
  from avalanche.training.plugins.strategy_plugin import SupervisedPlugin
  from avalanche.training.utils import copy_params_dict, zerolike_params_dict, ParamData
label_desc: Use image node_id 3 for calling the EWCPlugin obj's underlying member method code with example usage: obj.after_training_exp(strategy) without return types