Skip to content

Chain Bijector¤

distreqx.bijectors.Chain(distreqx.bijectors.AbstractFwdLogDetJacBijector, distreqx.bijectors.AbstractInvLogDetJacBijector) ¤

Composition of a sequence of bijectors into a single bijector.

Bijectors are composable: if f and g are bijectors, then g o f is also a bijector. Given a sequence of bijectors [f1, ..., fN], this class implements the bijector defined by fN o ... o f1.

Bijectors are applied in reverse order

Given a sequence [f, g], the Chain bijector computes f(g(x)), not g(f(x)). This matches the mathematical convention for function composition but may be counterintuitive when building layers sequentially.

Example

layers = []
layers.append(f)
layers.append(g)
bijector = distreqx.Chain(layers)
y = bijector.forward(x)  # y = f(g(x))
__init__(bijectors: Sequence) ¤

Initializes a Chain bijector.

Arguments:

  • bijectors: a sequence of bijectors to be composed into one. Each bijector can be a distreqx bijector or a callable to be wrapped by Lambda. The sequence must contain at least one bijector.