class_docstr: Embeddings mapping based on a Variational AutoEncoder (VAE).
  
  This class generates clean embeddings from the obfuscated ones using a VAE.
  More specifically, the encoder architecture generates a mean and a log
  variance for the latent normal distribution, the components of which are
  uncorrelated. These are then used to generate samples for the decoder.
  
  Both the encoder and decoder architectures are based on MLPs.
  
  Attributes:
    encoder: VAE encoder, defined as an MLP.
    decoder: VAE decoder, defined as an MLP.
    encoder_mean: Layer encoding the mean of the latent normal distribution.
    encoder_logvar: Layer encoding the log variance of the latent normal
      distribution.
class_docstr_tok: ["Embeddings","mapping","based","on","a","Variational","AutoEncoder","(","VAE",")",".","This","class","generates","clean","embeddings","from","the","obfuscated","ones","using","a","VAE",".","More","specifically",",","the","encoder","architecture","generates","a","mean","and","a","log","variance","for","the","latent","normal","distribution",",","the","components","of","which","are","uncorrelated",".","These","are","then","used","to","generate","samples","for","the","decoder",".","Both","the","encoder","and","decoder","architectures","are","based","on","MLPs",".","Attributes",":","encoder",":","VAE","encoder",",","defined","as","an","MLP",".","decoder",":","VAE","decoder",",","defined","as","an","MLP",".","encoder_mean",":","Layer","encoding","the","mean","of","the","latent","normal","distribution",".","encoder_logvar",":","Layer","encoding","the","log","variance","of","the","latent","normal","distribution","."]
code: def __init__(
      self,
      mlp_sizes: Sequence[int],
      embed_dim: int,
      weight_decay: float = 1e-4,
  ):
      super().__init__()
  
      if len(mlp_sizes) % 2 == 0:
          raise ValueError(
              "In the case of VAE, mlp_sizes must contain an odd"
              "number of elements. The middle one corresponds to the"
              "latent dimension of the VAE, and the rest to the sizes"
              "of the encoder and the decoder (first half and second"
              "half, respectively)."
          )
  
      num_layers_encoder = len(mlp_sizes) // 2
      encoder_mlp_sizes = mlp_sizes[:num_layers_encoder]
      latent_dim = mlp_sizes[num_layers_encoder]
      decoder_mlp_sizes = mlp_sizes[num_layers_encoder + 1 :]
  
      self.encoder = MLPEmbeddingMapper(
          latent_dim, encoder_mlp_sizes, weight_decay
      )
      self.decoder = MLPEmbeddingMapper(
          embed_dim, decoder_mlp_sizes, weight_decay
      )
  
      self.encoder_mean = tf.keras.layers.Dense(
          latent_dim,
          activation="relu",
          kernel_regularizer=tf.keras.regularizers.l2(weight_decay),
          bias_regularizer=tf.keras.regularizers.l2(weight_decay),
          name="encoder_mean",
      )
  
      self.encoder_logvar = tf.keras.layers.Dense(
          latent_dim,
          activation="relu",
          kernel_regularizer=tf.keras.regularizers.l2(weight_decay),
          bias_regularizer=tf.keras.regularizers.l2(weight_decay),
          name="encoder_logvar",
      )
  
imports: import abc
  from typing import Union, Tuple, Sequence, Optional
  import tensorflow
  import tensorflow_hub
label_desc: Use image node_id 1 to create a new VAEEmbeddingMapper object from inherited base classes: EmbeddingMapper with example: obj = VAEEmbeddingMapper(mlp_sizes, embed_dim, weight_decay)