class_docstr: Experience generative replay plugin.
  
  Updates the current mbatch of a strategy before training an experience
  by sampling a generator model and concatenating the replay data to the
  current batch.
  
  In this version of the plugin the number of replay samples is
  increased with each new experience. Another way to implempent
  the algorithm is by weighting the loss function and give more
  importance to the replayed data as the number of experiences
  increases. This will be implemented as an option for the user soon.
  
  :param generator_strategy: In case the plugin is applied to a non-generative
   model (e.g. a simple classifier), this should contain an Avalanche strategy
   for a model that implements a 'generate' method
   (see avalanche.models.generator.Generator). Defaults to None.
  :param untrained_solver: if True we assume this is the beginning of
      a continual learning task and add replay data only from the second
      experience onwards, otherwise we sample and add generative replay data
      before training the first experience. Default to True.
  :param replay_size: The user can specify the batch size of replays that
      should be added to each data batch. By default each data batch will be
      matched with replays of the same number.
  :param increasing_replay_size: If set to True, each experience this will
      double the amount of replay data added to each data batch. The effect
      will be that the older experiences will gradually increase in importance
      to the final loss.
docstr: Init.
docstr_tok: ["Init","."]
code: def __init__(
      self,
      generator_strategy=None,
      untrained_solver: bool = True,
      replay_size: Optional[int] = None,
      increasing_replay_size: bool = False,
  ):
      """
      Init.
      """
      super().__init__()
      self.generator_strategy = generator_strategy
      if self.generator_strategy:
          self.generator = generator_strategy.model
      else:
          self.generator = None
      self.untrained_solver = untrained_solver
      self.model_is_generator = False
      self.replay_size = replay_size
      self.increasing_replay_size = increasing_replay_size
  
file_path: avalanche/avalanche/training/plugins/generative_replay.py
imports: from copy import deepcopy
  from typing import Optional
  from avalanche.core import SupervisedPlugin
  import torch
label_desc: Use image node_id 1 to create a new GenerativeReplayPlugin object from inherited base classes: SupervisedPlugin with example: obj = GenerativeReplayPlugin(generator_strategy, untrained_solver, replay_size, increasing_replay_size)