alibi.models.pytorch.autoencoder module

This module contains a Pytorch general implementation of an autoencoder, by combining the encoder and the decoder module. In addition it provides an implementation of a heterogeneous autoencoder which includes a type checking of the output.

class alibi.models.pytorch.autoencoder.AE(encoder, decoder, **kwargs)[source]

Bases: alibi.models.pytorch.model.Model

Autoencoder. Standard autoencoder architecture. The model is composed from two submodules, the encoder and the decoder. The forward pass consist of passing the input to the encoder, obtain the input embedding and pass the embedding through the decoder. The abstraction can be used for multiple data modalities.

__init__(encoder, decoder, **kwargs)[source]

Constructor. Combine encoder and decoder in AE.

Parameters
  • encoder (Module) – Encoder network

  • decoder (Module) – Decoder network

forward(x)[source]
class alibi.models.pytorch.autoencoder.HeAE(encoder, decoder, **kwargs)[source]

Bases: alibi.models.pytorch.autoencoder.AE

Heterogeneous autoencoder. The model follows the standard autoencoder architecture and includes and additional type check to ensure that the output of the model is a list of tensors. For more details, see alibi.models.pytorch.autoencoder.AE.

__init__(encoder, decoder, **kwargs)[source]

Constructor. Combine encoder and decoder in HeAE.

Parameters
  • encoder (Module) – Encoder network.

  • decoder (Module) – Decoder network.

forward(x)[source]
Return type

List[Tensor]