LayerCheckpointState<T>

Models & Types · AiDotNet.Diffusion.Memory

State for layer-based gradient checkpointing.

Constructors

Constructor Summary
LayerCheckpointState()

Properties

Property Summary
IReadOnlyList<ILayer<T>> Layers { get; set; } The layers used in forward pass.
Tensor<T> FinalOutput { get; set; } Final output from forward pass.

Methods

Method Summary
Tensor<T> GetActivation(int layerIndex) Gets a recomputed activation if available.
Tensor<T> GetCheckpoint(int layerIndex) Gets a checkpoint if available.
bool HasActivation(int layerIndex) Checks if an activation exists.
bool HasCheckpoint(int layerIndex) Checks if a checkpoint exists.
void Clear() Clears all stored state to free memory.
void SaveActivation(int layerIndex, Tensor<T> activation) Saves a recomputed activation.
void SaveCheckpoint(int layerIndex, Tensor<T> activation) Saves a checkpoint at the given layer index.