NoiseSchedulerBase<T>
Base Classes · AiDotNet.Diffusion.Schedulers
Base class for diffusion model noise schedulers providing common functionality.
Implements: INoiseScheduler<T>
Known derived types: ConsistencyModelScheduler<T>, DDIMScheduler<T>, DDPMScheduler<T>, DEISMultistepScheduler<T>, DPMSolverMultistepScheduler<T>, DPMSolverSDEScheduler<T>, DPMSolverSinglestepScheduler<T>, DPMSolverV3Scheduler<T>, DiscretizedRFScheduler<T>, EulerAncestralDiscreteScheduler<T>, EulerDiscreteScheduler<T>, ExFMScheduler<T>, FlowDPMSolverScheduler<T>, FlowMatchingScheduler<T>, HeunDiscreteScheduler<T>, HybridODESDEScheduler<T>, LCMScheduler<T>, LMSDiscreteScheduler<T>, PNDMScheduler<T>, PeRFlowScheduler<T>, RectifiedFlowScheduler<T>, SASolverScheduler<T>, StochasticInterpolantScheduler<T>, UniPCScheduler<T>, VariationalRFScheduler<T>
For Beginners
This is the foundation that all noise schedulers build upon. It handles the common math and state management that every scheduler needs:
- Computing the noise schedule (how much noise at each step)
- Tracking the current state for saving/loading
- Adding noise during training
Specific schedulers like DDIM, PNDM, and DPM-Solver extend this base to implement their unique denoising strategies.
How It Works
This abstract base class implements the common behavior for all noise schedulers, including beta schedule computation, alpha cumulative product calculation, noise addition, and state management for checkpointing.
Note: This class was renamed from StepSchedulerBase to NoiseSchedulerBase to avoid confusion with learning rate schedulers. Noise schedulers are specific to diffusion models.
Properties
| Property | Summary |
|---|---|
SchedulerConfig<T> Config { get; } |
Gets the configuration options for the scheduler. |
int TrainTimesteps { get; } |
|
int[] Timesteps { get; } |
Methods
| Method | Summary |
|---|---|
Dictionary<string, object> GetState() |
|
T GetAlphaCumulativeProduct(int timestep) |
|
Tensor<T> AddNoiseBatched(Tensor<T> cleanBatch, Tensor<T> noiseBatch, int[] timesteps) |
Batched forward-diffusion (industry-standard batching, HuggingFace diffusers / DDPM reference): applies a distinct timestep to each batch element instead of a single timestep to the whole batch. |
Vector<T> AddNoise(Vector<T> originalSample, Vector<T> noise, int timestep) |
|
Vector<T> Step(Vector<T> modelOutput, int timestep, Vector<T> sample, T eta, Vector<T> noise) |
|
void LoadState(Dictionary<string, object> state) |
|
void SetTimesteps(int inferenceSteps) |