class_docstr: iCaRL Plugin.
  iCaRL uses nearest class exemplar classification to prevent
  forgetting to occur at the classification layer. The feature extractor
  is continually learned using replay and distillation. The exemplars
  used for replay and classification are selected through herding.
  This plugin does not use task identities.
class_docstr_tok: ["iCaRL","Plugin",".","iCaRL","uses","nearest","class","exemplar","classification","to","prevent","forgetting","to","occur","at","the","classification","layer",".","The","feature","extractor","is","continually","learned","using","replay","and","distillation",".","The","exemplars","used","for","replay","and","classification","are","selected","through","herding",".","This","plugin","does","not","use","task","identities","."]
docstr: :param memory_size: amount of patterns saved in the memory.
  :param buffer_transform: transform applied on buffer elements already
      modified by test_transform (if specified) before being used for
       replay
  :param fixed_memory: If True a memory of size memory_size is
      allocated and partitioned between samples from the observed
      experiences. If False every time a new class is observed
      memory_size samples of that class are added to the memory.
docstr_tok: [":","param","memory_size",":","amount","of","patterns","saved","in","the","memory",".",":","param","buffer_transform",":","transform","applied","on","buffer","elements","already","modified","by","test_transform","(","if","specified",")","before","being","used","for","replay",":","param","fixed_memory",":","If","True","a","memory","of","size","memory_size","is","allocated","and","partitioned","between","samples","from","the","observed","experiences",".","If","False","every","time","a","new","class","is","observed","memory_size","samples","of","that","class","are","added","to","the","memory","."]
code: def __init__(
      self, memory_size, buffer_transform=None, fixed_memory=True
  ):
      """
      :param memory_size: amount of patterns saved in the memory.
      :param buffer_transform: transform applied on buffer elements already
          modified by test_transform (if specified) before being used for
           replay
      :param fixed_memory: If True a memory of size memory_size is
          allocated and partitioned between samples from the observed
          experiences. If False every time a new class is observed
          memory_size samples of that class are added to the memory.
      """
      super().__init__()
  
      self.memory_size = memory_size
      self.buffer_transform = buffer_transform
      self.fixed_memory = fixed_memory
  
      self.x_memory = []
      self.y_memory = []
      self.order = []
  
      self.observed_classes = []
      self.class_means = {}
      self.embedding_size = None
      self.output_size = None
      self.input_size = None
  
imports: import itertools
  from typing import Callable, Optional, List, Union
  import torch
  from torch.optim import Optimizer
  from avalanche.benchmarks.utils import _make_taskaware_tensor_classification_dataset, _taskaware_classification_subset
  from math import ceil
  from avalanche.benchmarks.utils.utils import concat_datasets
  from avalanche.models import TrainEvalModel, NCMClassifier
  from avalanche.training.plugins import EvaluationPlugin
  from avalanche.training.plugins.evaluation import default_evaluator
  from avalanche.training.losses import ICaRLLossPlugin
  from avalanche.training.plugins.strategy_plugin import SupervisedPlugin
  from torch.nn import Module
  from torch.utils.data import DataLoader
  from avalanche.training.templates import SupervisedTemplate
label_desc: Use image node_id 1 to create a new _ICaRLPlugin object from inherited base classes: SupervisedPlugin with example: obj = _ICaRLPlugin(memory_size, buffer_transform, fixed_memory)