ConvLSTMLayer<T>

Layers · AiDotNet.NeuralNetworks.Layers

Implements a Convolutional Long Short-Term Memory (ConvLSTM) layer for processing sequential spatial data.

Inheritance: LayerBase<T> → ConvLSTMLayer<T>

Implements: IShapeContract

For Beginners

ConvLSTM is like a smart video analyzer that remembers spatial patterns over time.

Imagine you’re watching a video of clouds moving across the sky:

  1. ConvLSTM looks at each frame (like a photo) in the video sequence
  2. It remembers important spatial features (like cloud shapes) from previous frames
  3. It uses this memory to predict how these features might change in future frames

This layer is particularly good at:

  • Predicting what might happen next in a video
  • Analyzing patterns in weather maps over time
  • Understanding how spatial arrangements change in a sequence

Unlike simpler layers that treat each frame independently, ConvLSTM connects the dots between frames, making it powerful for tasks involving moving images or changing spatial data.

How It Works

ConvLSTM combines convolutional operations with LSTM (Long Short-Term Memory) to handle spatial-temporal data. It’s particularly useful for tasks involving sequences of images or spatial data, such as video prediction, weather forecasting, and spatiotemporal sequence prediction.

Key features of ConvLSTM:

  • Maintains spatial information throughout the processing
  • Captures both spatial and temporal dependencies
  • Uses convolutional operations instead of matrix multiplications in the LSTM cell
  • Suitable for data with both spatial and temporal structure

Constructors

Constructor Summary
ConvLSTMLayer(int[] inputShape, int kernelSize, int filters, int padding, int strides, IActivationFunction<T> activationFunction) Initializes a new instance of the ConvLSTMLayer class with a vector activation function.
ConvLSTMLayer(int[] inputShape, int kernelSize, int filters, int padding, int strides, IVectorActivationFunction<T> vectorActivationFunction) Initializes a new instance of the ConvLSTMLayer class with a vector activation function.

Properties

Property Summary
bool SupportsGpuTraining { get; } Gets a value indicating whether this layer supports GPU training.
bool SupportsTraining { get; } The computation engine (CPU or GPU) for vectorized operations.

Methods

Method Summary
Dictionary<string, string> GetParameterRoles() Returns parameter roles for per-role optimizer configuration (e.g., weight decay exemption for biases).
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank)
IReadOnlyList<Tensor<T>> GetTrainableParameters() Returns all trainable parameter tensors marked with [TrainableParameter].
void ClearGradients()
void ResetState() Resets the internal state of the ConvLSTM layer.
void SetTrainableParameters(IReadOnlyList<Tensor<T>> parameters) Replaces trainable parameter tensors (e.g., with ParameterBuffer views).
void UpdateParameters(T learningRate) Updates all trainable parameters of the layer using the computed gradients and specified learning rate.
void UpdateParametersGpu(IGpuOptimizerConfig config) GPU-resident parameter update with polymorphic optimizer support.
void ZeroGrad() Clears all gradient fields discovered by convention ({paramName}Gradient).