class_docstr: The ExpertGate algorithm is a dynamic architecture algorithm.
  For every new task, it trains an autoencoder to reconstruct input data
  and then trains an AlexNet classifier. Prior to AlexNet training,
  the algorithm searches through existing autoencoders, if there are any,
  to find the most related autoencoder and select the expert associated
  to that autoencoder. The new expert is then fine-tuned or trained using
  Learning without Forgetting (LwF) based on the most related previous expert.
class_docstr_tok: ["The","ExpertGate","algorithm","is","a","dynamic","architecture","algorithm",".","For","every","new","task",",","it","trains","an","autoencoder","to","reconstruct","input","data","and","then","trains","an","AlexNet","classifier",".","Prior","to","AlexNet","training",",","the","algorithm","searches","through","existing","autoencoders",",","if","there","are","any",",","to","find","the","most","related","autoencoder","and","select","the","expert","associated","to","that","autoencoder",".","The","new","expert","is","then","fine-tuned","or","trained","using","Learning","without","Forgetting","(","LwF",")","based","on","the","most","related","previous","expert","."]
code: def __init__(self):
      super().__init__()
      # Hyperparameters for LwF plugin
      # Obtained from the ExpertGate paper
      self.alpha = 0.01
      self.temp = 2
  
      # Initialize instance of the LwF plugin
      self.lwf_plugin = LwFPlugin(self.alpha, self.temp)
  
imports: from collections import OrderedDict
  import warnings
  import torch
  from torch.nn import Module, CrossEntropyLoss
  from torch.optim import Optimizer, SGD, Adam
  from torch.nn.functional import log_softmax
  from typing import Optional, List
  from avalanche.models.expert_gate import ExpertAutoencoder, ExpertModel, ExpertGate
  from avalanche.models.dynamic_optimizers import reset_optimizer
  from avalanche.training.supervised import AETraining
  from avalanche.training.templates import SupervisedTemplate
  from avalanche.training.plugins import SupervisedPlugin, EvaluationPlugin, LwFPlugin
  from avalanche.training.plugins.evaluation import default_evaluator
label_desc: Use image node_id 1 to create a new _ExpertGatePlugin object from inherited base classes: SupervisedPlugin with example: obj = _ExpertGatePlugin()