Normalising Flow Layers#
Classes#
- class SplineFlow(transforms, hidden_features, net_out, shapes, *, context=False, features=None, factor=None, **kwargs)[source]#
Bases:
BaseLayerNeural spline flow layer constructor.
Should only be used as the last layer in the network as it does not return a Tensor.
- Attributes:
Generates a neural spline flow (NSF) for use in BaseNetwork
Adds attributes of name (‘flow’), optimiser (Adam), and scheduler (ReduceLROnPlateau)
- Parameters:
- transforms
int Number of transforms
- hidden_features
list[int] Number of features in each of the hidden layers
- net_out
list[int] Shape of the network’s output
- shapes
Shapes Shape of the outputs from each layer
- contextbool,
Optional If the output from the previous layer should be used to condition the normalising flow, default = False
- features
int|NoneType,Optional Dimensions of the probability distribution, if factor is provided, features will not be used
- factor
float|NoneType,Optional Output features is equal to the factor of the network’s output, will be used if provided, else features will be used
- **kwargs
Leftover parameters to pass to base layer for checking
- transforms
- forward(x, *_, **__)[source]#
Forward pass of the neural spline flow layer
- Parameters:
- x
Tensor Input tensor with shape (N,…) and type float, where N is the batch size
- x
- Returns:
NormalizingFlowNormalising flow distribution