nami.processes.fm#

Classes

FlowMatching(field, base, solver, *[, t0, ...])

FlowMatchingProcess(field, base, solver, *)

class nami.processes.fm.FlowMatching(field, base, solver, *, t0=1.0, t1=0.0, event_ndim=None, validate_args=True)[source]#

Bases: LazyDistribution

Parameters:
forward(c=None)[source]#

Define 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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type:

FlowMatchingProcess

Parameters:

c (Tensor | None)

class nami.processes.fm.FlowMatchingProcess(field, base, solver, *, t0=1.0, t1=0.0, context=None, validate_args=True)[source]#

Bases: object

Parameters:
property base#
property batch_shape: tuple[int, ...]#
property event_shape: tuple[int, ...]#
property field#
log_prob(x, *, estimator=None)[source]#

Evaluate log-density via change of variables.

Callers should usually pass estimator=... unless the field implements call_and_divergence itself. We do not auto-select a divergence estimator here because the tradeoff is model-dependent: exact traces are deterministic but can be expensive, while Hutchinson-style estimators scale better but add stochasticity.

Return type:

Tensor

Parameters:

x (Tensor)

rsample(sample_shape=())[source]#
Return type:

Tensor

sample(sample_shape=())[source]#
Return type:

Tensor