SequenceLastLayer<T>
Layers ยท AiDotNet.NeuralNetworks.Layers
A layer that extracts the last timestep from a sequence.
Inheritance: LayerBase<T> โ SequenceLastLayer<T>
Implements: IShapeContract
For Beginners
When processing sequences (like sentences or time series), recurrent layers output a value for each timestep. For tasks like classification, we often only need the final output (after seeing the whole sequence). This layer extracts just that last output.
How It Works
This layer is used after recurrent layers (RNN, LSTM, GRU) when the task requires a single output from the entire sequence, such as sequence classification.
Constructors
| Constructor | Summary |
|---|---|
SequenceLastLayer(int featureSize) |
Initializes a new SequenceLastLayer. |
Properties
| Property | Summary |
|---|---|
bool SupportsGpuTraining { get; } |
|
bool SupportsTraining { get; } |
Gets a value indicating whether this layer supports training. |
Methods
| Method | Summary |
|---|---|
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank) |
|
void ResetState() |
Reset state is a no-op since this layer maintains no state between forward passes. |