nami.fields.velocity#
Classes
|
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:
VectorFieldMLP velocity field for flow matching.
Supports unconditional and conditional workflows. When
condition_dimis non-zero the field expects a context vectorcconcatenated to the input; otherwisecshould beNone. 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.
- 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.