fl4health.model_bases.autoencoders_base module¶
- class AbstractAe(encoder, decoder)[source]¶
Bases:
Module
,ABC
- __init__(encoder, decoder)[source]¶
The base class for all autoencoder based models. To define this model, we need to define the structure of the encoder and the decoder modules. This type of model should have the capability to encode data using the encoder module and decode the output of the encoder using the decoder module.
- abstract forward(input)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses. :rtype:
Tensor
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class BasicAe(encoder, decoder)[source]¶
Bases:
AbstractAe
- forward(input)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses. :rtype:
Tensor
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class ConditionalVae(encoder, decoder, unpack_input_condition=None)[source]¶
Bases:
AbstractAe
- __init__(encoder, decoder, unpack_input_condition=None)[source]¶
Conditional Variational Auto-Encoder model.
- Parameters:
encoder (nn.Module) – The encoder used to map input to latent space.
decoder (nn.Module) – The decoder used to reconstruct the input using a vector in latent space.
unpack_input_condition (Callable | None, optional) – For unpacking the input and condition tensors.
- forward(input)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses. :rtype:
Tensor
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class VariationalAe(encoder, decoder)[source]¶
Bases:
AbstractAe
- __init__(encoder, decoder)[source]¶
Variational Auto-Encoder model base class.
- Parameters:
encoder (nn.Module) – Encoder module defined by the user.
decoder (nn.Module) – Decoder module defined by the user.
- forward(input)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses. :rtype:
Tensor
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.