nami.fields.velocity#

Classes

VelocityField(dim, *[, condition_dim, ...])

MLP velocity field for flow matching.

class nami.fields.velocity.VelocityField(dim, *, condition_dim=0, hidden=256, layers=3, activation='silu', dropout=0.0, layer_norm=False)[source]#

Bases: VectorField

MLP velocity field for flow matching.

Supports unconditional and conditional workflows. When condition_dim is non-zero the field expects a context vector c concatenated to the input; otherwise c should be None. Conditioning is handled by the process layer via lazy binding. This field simply receives whatever context the process passes through.

Parameters:
  • dim (int | tuple[int, ...]) – Data dimensionality or event shape.

  • condition_dim (int) – Conditioning vector dimensionality (0 for unconditional).

  • hidden (int) – Hidden layer width.

  • layers (int) – Number of hidden layers.

  • activation (str) – Activation function (‘silu’, ‘relu’, ‘gelu’, ‘tanh’).

  • dropout (float) – Dropout probability (0 disables).

  • layer_norm (bool) – Whether to apply layer normalisation in hidden layers.

property event_ndim: int#
forward(x, t, 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:

Tensor

Parameters: