class_docstr: Learning Without Forgetting.
  
  The method applies knowledge distilllation to mitigate forgetting.
  The teacher is the model checkpoint after the last experience.
docstr: :param alpha: distillation hyperparameter. It can be either a float
          number or a list containing alpha for each experience.
  :param temperature: softmax temperature for distillation
docstr_tok: [":","param","alpha",":","distillation","hyperparameter",".","It","can","be","either","a","float","number","or","a","list","containing","alpha","for","each","experience",".",":","param","temperature",":","softmax","temperature","for","distillation"]
code: def __init__(self, alpha=1, temperature=2):
      """
      :param alpha: distillation hyperparameter. It can be either a float
              number or a list containing alpha for each experience.
      :param temperature: softmax temperature for distillation
      """
      self.alpha = alpha
      self.temperature = temperature
      self.prev_model = None
      self.expcount = 0
      # count number of experiences (used to increase alpha)
      self.prev_classes_by_task = defaultdict(set)
      """ In Avalanche, targets of different experiences are not ordered. 
          As a result, some units may be allocated even though their 
          corresponding class has never been seen by the model.
          Knowledge distillation uses only units corresponding
          to old classes. 
          """
  
imports: import copy
  from collections import defaultdict
  from typing import List
  import torch
  import torch.nn.functional
  from avalanche.models import MultiTaskModule, avalanche_forward
label_desc: Use image node_id 1 to create a new LearningWithoutForgetting object from inherited base classes: RegularizationMethod with example: obj = LearningWithoutForgetting(alpha, temperature)