ARDiffusionModel<T>
Models & Types · AiDotNet.Diffusion.FastGeneration
AR-Diffusion model combining autoregressive and diffusion generation in latent space.
Inheritance: DiffusionModelBase<T> → LatentDiffusionModelBase<T> → ARDiffusionModel<T>
For Beginners
AR-Diffusion generates images like reading a book — left to right, top to bottom. But instead of picking discrete tokens (like words), it uses diffusion to generate continuous patches. This gives it the best of both worlds: the structured generation of autoregressive models and the smooth outputs of diffusion.
How It Works
AR-Diffusion generates image tokens autoregressively (left-to-right, top-to-bottom) but applies diffusion to each token’s continuous representation. This combines the sequential coherence of autoregressive models with the continuous-space flexibility of diffusion, enabling high-quality generation with natural spatial ordering.
Example
// Create an AR-Diffusion model for autoregressive latent diffusion
var options = new DiffusionModelOptions<float> { LatentChannels = 8, DefaultInferenceSteps = 20 };
var noise = Tensor<float>.CreateRandom(new[] { 1, 8, 32, 32 });
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 ARDiffusionModel<float>(options: options))
.Build(trainX, trainY);
var generated = result.Predict(noise);
Constructors
| Constructor | Summary |
|---|---|
ARDiffusionModel(NeuralNetworkArchitecture<T> architecture, DiffusionModelOptions<T> options, INoiseScheduler<T> scheduler, SiTPredictor<T> predictor, StandardVAE<T> vae, IConditioningModule<T> conditioner, int? seed) |
Properties
| Property | Summary |
|---|---|
IConditioningModule<T> Conditioner { get; } |
|
INoisePredictor<T> NoisePredictor { get; } |
|
IVAEModel<T> VAE { get; } |
|
int LatentChannels { get; } |
Methods
| Method | Summary |
|---|---|
ModelMetadata<T> GetModelMetadata() |