FlowMapModel<T>
Models & Types · AiDotNet.Diffusion.FastGeneration
FlowMap model for one-step generation via flow-map learning.
Inheritance: DiffusionModelBase<T> → LatentDiffusionModelBase<T> → FlowMapModel<T>
For Beginners
Standard flow models learn “how to move” from noise to images and need multiple small steps. FlowMap learns “where to go” directly — given a noise pattern, it outputs the final image location in one step. It’s like learning the destination directly instead of learning turn-by-turn directions.
How It Works
FlowMap directly learns the transport map from noise to data distribution rather than learning the velocity field and integrating it. This bypasses the need for ODE solving entirely, enabling true one-step generation from any flow-matching model. Uses a flow-map reparameterization that enables stable training.
Reference: “FlowMap: Learning to Generate High-Quality Samples with a Single Step”, 2024
Example
var options = new DiffusionModelOptions<float> { LatentChannels = 4, DefaultInferenceSteps = 1 };
var noise = Tensor<float>.CreateRandom(new[] { 1, 4, 64, 64 });
var trainX = Tensor<float>.CreateRandom(4, 8);
var trainY = Tensor<float>.CreateRandom(4, 2);
var result = new AiModelBuilder<float, Tensor<float>, Tensor<float>>()
.ConfigureModel(new FlowMapModel<float>(options: options))
.Build(trainX, trainY);
var generated = result.Predict(noise);
Constructors
| Constructor | Summary |
|---|---|
FlowMapModel(NeuralNetworkArchitecture<T> architecture, DiffusionModelOptions<T> options, INoiseScheduler<T> scheduler, UNetNoisePredictor<T> predictor, StandardVAE<T> vae, IConditioningModule<T> conditioner, int? seed) |
Initializes a new FlowMap model. |
Properties
| Property | Summary |
|---|---|
IConditioningModule<T> Conditioner { get; } |
|
INoisePredictor<T> NoisePredictor { get; } |
|
IVAEModel<T> VAE { get; } |
|
int LatentChannels { get; } |
Methods
| Method | Summary |
|---|---|
ModelMetadata<T> GetModelMetadata() |