class_docstr: Gradient Episodic Memory Plugin.
  GEM projects the gradient on the current minibatch by using an external
  episodic memory of patterns from previous experiences. The gradient on
  the current minibatch is projected so that the dot product with all the
  reference gradients of previous tasks remains positive.
  This plugin does not use task identities.
docstr: :param patterns_per_experience: number of patterns per experience in the
      memory.
  :param memory_strength: offset to add to the projection direction
      in order to favour backward transfer (gamma in original paper).
docstr_tok: [":","param","patterns_per_experience",":","number","of","patterns","per","experience","in","the","memory",".",":","param","memory_strength",":","offset","to","add","to","the","projection","direction","in","order","to","favour","backward","transfer","(","gamma","in","original","paper",")","."]
code: def __init__(
      self, patterns_per_experience: int, memory_strength: float
  ):
      """
      :param patterns_per_experience: number of patterns per experience in the
          memory.
      :param memory_strength: offset to add to the projection direction
          in order to favour backward transfer (gamma in original paper).
      """
  
      super().__init__()
  
      self.patterns_per_experience = int(patterns_per_experience)
      self.memory_strength = memory_strength
  
      self.memory_x: Dict[int, Tensor] = dict()
      self.memory_y: Dict[int, Tensor] = dict()
      self.memory_tid: Dict[int, Tensor] = dict()
  
      self.G: Tensor = torch.empty(0)
  
file_path: avalanche/avalanche/training/plugins/gem.py
imports: from typing import Dict
  import numpy
  import quadprog
  import torch
  from torch import Tensor
  from torch.utils.data import DataLoader
  from avalanche.models import avalanche_forward
  from avalanche.training.plugins.strategy_plugin import SupervisedPlugin
label_desc: Use image node_id 1 to create a new GEMPlugin object from inherited base classes: SupervisedPlugin with example: obj = GEMPlugin(patterns_per_experience, memory_strength)