Normalizing Flow Module
- class maf.BatchNorm(input_size, momentum=0.9, eps=1e-05)[source]
Bases:
ModuleRealNVP BatchNorm layer
- forward(x, cond_y=None)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool
- class maf.FlowSequential(*args: Module)[source]
- class maf.FlowSequential(arg: OrderedDict[str, Module])
Bases:
SequentialContainer for layers of a normalizing flow
- forward(x, y)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class maf.LinearMaskedCoupling(input_size, hidden_size, n_hidden, mask, cond_label_size=None)[source]
Bases:
ModuleModified RealNVP Coupling Layers per the MAF paper
- forward(x, y=None)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool
- class maf.MADE(input_size, hidden_size, n_hidden, cond_label_size=None, activation='relu', input_order='sequential', input_degrees=None)[source]
Bases:
Module- property base_dist
- forward(x, y=None)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool
- class maf.MAF(n_blocks, input_size, hidden_size, n_hidden, cond_label_size=None, activation='relu', input_order='sequential', batch_norm=True)[source]
Bases:
Module- property base_dist
- forward(x, y=None)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool
- class maf.MaskedLinear(input_size, n_outputs, mask, cond_label_size=None)[source]
Bases:
LinearMADE building block layer
- extra_repr()[source]
Set the extra representation of the module
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(x, y=None)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- in_features: int
- out_features: int
- weight: Tensor
- class maf.RealNVP(n_blocks, input_size, hidden_size, n_hidden, cond_label_size=None, batch_norm=True)[source]
Bases:
Module- property base_dist
- forward(x, y=None)[source]
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- training: bool