general_backprop_j_flow module

This module implements an abstract class for flows defined as the application of a differentiable pytorch function on an input point. In train mode, the last entry of the input is the logarithm of the inverse PDF at that point.

class GeneralBackpropJacobianFlow(*args, **kwargs)[source]

Bases: zunis.models.flows.general_flow.GeneralFlow

Abstract class for a flow defined as a general differentiable Pytorch function This implements the universal transform_and_compute_jacobian behavior: y = flow(x), - log(j(y)) = - log(j(x)) + log(det(dy_i/dx_j)) The jacobian is computed naively by using autograd.

Initializes internal Module state, shared by both nn.Module and ScriptModule.

flow(x)[source]

For a backprop_flow, the transformation is just a pytorch module

training: bool[source]
transform_and_compute_jacobian(xj)[source]

Compute the flow transformation and its Jacobian using pytorch.autograd