TimeDistributedLayer<T>

Layers ยท AiDotNet.NeuralNetworks.Layers

Represents a wrapper layer that applies an inner layer to each time step of a sequence independently.

Inheritance: LayerBase<T> โ†’ TimeDistributedLayer<T>

Implements: IShapeContract

For Beginners

This layer helps process sequences of data by applying the same operation to each step.

Think of it like an assembly line worker who performs the same task on each item that passes by:

  • You have a sequence of items (like frames in a video or words in a sentence)
  • You want to apply the same operation to each item independently
  • This layer automates that process while preserving the original sequence order

For example, if you have a video with 30 frames per second, and you want to detect objects in each frame:

  • A normal layer would need to process all frames together
  • This time distributed layer would apply your object detection layer to each frame separately
  • The result would be object detections for each frame, still organized as a sequence

This makes it much easier to work with sequential data like videos, sentences, or time series.

How It Works

A time distributed layer applies the same inner layer (and its operations) to each time step of a sequence independently. This is particularly useful for processing sequential data where the same transformation needs to be applied to each element in the sequence. The layer maintains the temporal structure of the data while allowing each time step to be processed by the inner layer.

Constructors

Constructor Summary
TimeDistributedLayer(LayerBase<T> innerLayer, IActivationFunction<T> activationFunction, int[] inputShape) Initializes a new instance of the TimeDistributedLayer class with vector activation function.
TimeDistributedLayer(LayerBase<T> innerLayer, IVectorActivationFunction<T> vectorActivationFunction, int[] inputShape) Initializes a new instance of the TimeDistributedLayer class with vector activation function.

Properties

Property Summary
bool SupportsTraining { get; }

Methods

Method Summary
IReadOnlyList<ILayer<T>> GetSubLayers()
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank)
void ClearGradients()
void ResetState() Resets the internal state of the layer and its inner layer.
void UpdateParameters(T learningRate) Updates the parameters of the inner layer.