Alpaca nn modules¶
-
class
alpaca.nn.
Module
(*args, **kwargs)[source]¶ The class links nn.Module with the alpaca Module abstraction by allowing us to copy nn.Module instance’s dictionary into this class instance. Additionally, the class introduces additional flags for the inference/uncertainty estimation modes.
-
instantiate_with_dropout_params
(module: torch.nn.modules.module.Module, dropout_rate: float = 0.0, dropout_mask: BaseMask = None) → alpaca.nn.Module[source]¶ Copies the instant nn.Module but also adding dropout_mask/dropout_rate parameters
-
ue_mode
() → alpaca.nn.Module[source]¶ Sets the alpaca.Module into the uncertainty estimaton mode. This will enable the dropout mask logic calculation with the dropout rate activated.
-
inf_mode
() → alpaca.nn.Module[source]¶ Sets the alpaca.Module into inference mode. This will disable dropout_rate and dropout_mask of the module.
-
-
class
alpaca.nn.
Dropout
(*args, dropout_rate: float = 0.0, dropout_mask: BaseMask = None, **kwargs)[source]¶ The subclass of nn.Dropout layer with the additional dropout_mask and dropout_rate parameterization
- Parameters
dropout_rate (float) – Dropout rate of the mask
dropout_mask ("BaseMask") – Base mask instance setting the type of mask of the module