class_docstr: AutoEncoder style architecture to map between embeddings.
  
  This class implements an autoencoder style architecture between two
  embedding spaces. This consists of a single encoder and one or more decoder
  heads from the latent dimension to the output. Both the encoder and the
  decoders are implemented as MLPs. Optionally, a skip connection may be added
  from the input embedding space to each of the output embedding spaces.
  
  When calling this layer, the input is assumed to be a 2-dimensional tensor, of
  shape (batch_size, embed_dim). The output is a 3-dimensional tensor, of
  shape (batch_size, num_decoders, embed_dim) - one extra dimension for the
  varying number of decoder heads.
  
  Attributes:
    encoder: The MLP mapping from input embedding to latent dimension.
    decoders: A list of decoder MLPs, mapping from latent dimension to the
      various output spaces.
    skip_connection: Whether to add a skip connection from the input embedding
      space to each of the output embedding spaces.
class_docstr_tok: ["AutoEncoder","style","architecture","to","map","between","embeddings",".","This","class","implements","an","autoencoder","style","architecture","between","two","embedding","spaces",".","This","consists","of","a","single","encoder","and","one","or","more","decoder","heads","from","the","latent","dimension","to","the","output",".","Both","the","encoder","and","the","decoders","are","implemented","as","MLPs",".","Optionally",",","a","skip","connection","may","be","added","from","the","input","embedding","space","to","each","of","the","output","embedding","spaces",".","When","calling","this","layer",",","the","input","is","assumed","to","be","a","2-dimensional","tensor",",","of","shape","(","batch_size",",","embed_dim",")",".","The","output","is","a","3-dimensional","tensor",",","of","shape","(","batch_size",",","num_decoders",",","embed_dim",")","-","one","extra","dimension","for","the","varying","number","of","decoder","heads",".","Attributes",":","encoder",":","The","MLP","mapping","from","input","embedding","to","latent","dimension",".","decoders",":","A","list","of","decoder","MLPs",",","mapping","from","latent","dimension","to","the","various","output","spaces",".","skip_connection",":","Whether","to","add","a","skip","connection","from","the","input","embedding","space","to","each","of","the","output","embedding","spaces","."]
code: def __init__(
      self,
      mlp_sizes: Sequence[int],
      embed_dim: int,
      num_decoders: int = 1,
      weight_decay: float = 1e-4,
      skip_connection: bool = False,
  ):
      super().__init__()
      if len(mlp_sizes) % 2 == 0:
          raise ValueError(
              "In this, mlp_sizes must contain an odd number of"
              "elements. The middle one corresponds to the latent"
              "dimension of the autoencoder, 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.decoders = []
      for _ in range(num_decoders):
          decoder = MLPEmbeddingMapper(
              embed_dim, decoder_mlp_sizes, weight_decay
          )
          self.decoders.append(decoder)
  
      self.skip_connection = skip_connection
  
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 AutoEncoderEmbeddingMapper object from inherited base classes: EmbeddingMapper with example: obj = AutoEncoderEmbeddingMapper(mlp_sizes, embed_dim, num_decoders, weight_decay, skip_connection)