nnflows module¶
Neural network as a flow
- class NNFlow(*args, **kwargs)[source]¶
Bases:
zunis.models.flows.backprop_jacobian_flows.general_backprop_j_flow.GeneralBackpropJacobianFlow
Flow defined as a neural network mapping R^d to R^d. Bijectivity is not guaranteed but likely: each linear layer can have rank >= d and each activation layer is bijective.
With weights taken randomly from any reasonable definition (flat Glorot, normal Glorot), the probability that the matrices are less than maximal rank is 0 so the transformation is nearly always bijective.
The layers are organized as follows: R^d -[Linear(d,dh), activation]-> R^dh -[(Linear(dh,dh),activation)*nh]-> R^dh -[Linear(dh,d)]-> R^d
Initializes internal Module state, shared by both nn.Module and ScriptModule.