class_docstr: The expert autoencoder that determines which expert classifier to select
  for the incoming data.
class_docstr_tok: ["The","expert","autoencoder","that","determines","which","expert","classifier","to","select","for","the","incoming","data","."]
docstr: :param shape: shape of the input layer
  :param latent_dim: size of the autoencoder's latent dimension
  :param device: gpu or cpu
  :param arch: the architecture to use from torchvision.models,
  defaults to "alexnet"
  :param pretrained_flag: determines if torchvision model is pre-trained,
  defaults to True
  :param output_layer_name: output layer of the feature backbone,
  defaults to "features"
docstr_tok: [":","param","shape",":","shape","of","the","input","layer",":","param","latent_dim",":","size","of","the","autoencoder","'s","latent","dimension",":","param","device",":","gpu","or","cpu",":","param","arch",":","the","architecture","to","use","from","torchvision.models",",","defaults","to","``","alexnet","''",":","param","pretrained_flag",":","determines","if","torchvision","model","is","pre-trained",",","defaults","to","True",":","param","output_layer_name",":","output","layer","of","the","feature","backbone",",","defaults","to","``","features","''"]
code: def __init__(
      self,
      shape,
      latent_dim,
      device,
      arch="alexnet",
      pretrained_flag=True,
      output_layer_name="features",
  ):
      """
      :param shape: shape of the input layer
      :param latent_dim: size of the autoencoder's latent dimension
      :param device: gpu or cpu
      :param arch: the architecture to use from torchvision.models,
      defaults to "alexnet"
      :param pretrained_flag: determines if torchvision model is pre-trained,
      defaults to True
      :param output_layer_name: output layer of the feature backbone,
      defaults to "features"
      """
  
      super().__init__()
  
      # Select pretrained AlexNet for preprocessing input
      base_template = models.__dict__[arch](
          weights=(
              "AlexNet_Weights.IMAGENET1K_V1"
              if pretrained_flag
              else "AlexNet_Weights.NONE"
          )
      ).to(device)
  
      self.feature_module = FeatureExtractorBackbone(
          base_template, output_layer_name
      )
  
      self.feature_module.to(device)
  
      self.shape = shape
      self.device = device
  
      # Freeze the feature module
      for param in self.feature_module.parameters():
          param.requires_grad = False
  
      # Flatten input
      # Encoder Linear -> ReLU
      flattened_size = torch.Size(shape).numel()
      self.encoder = nn.Sequential(
          Flatten(), nn.Linear(flattened_size, latent_dim), nn.ReLU()
      ).to(device)
  
      # Decoder Linear -> Sigmoid
      self.decoder = nn.Sequential(
          nn.Linear(latent_dim, flattened_size), nn.Sigmoid()
      ).to(device)
  
imports: from collections import OrderedDict
  from copy import deepcopy
  import torch
  import torch.nn
  import torch.nn.functional
  from torch import sigmoid
  from torch.nn.functional import mse_loss, softmax
  from torchvision import transforms
  import torchvision.models
  from .utils import FeatureExtractorBackbone
  from avalanche.models import MultiTaskModule
  from avalanche.models.utils import Flatten
  from avalanche.benchmarks.scenarios.generic_scenario import CLExperience
label_desc: Use image node_id 1 to create a new ExpertAutoencoder object from inherited base classes: nn with example: obj = ExpertAutoencoder(shape, latent_dim, device, arch, pretrained_flag, output_layer_name)