BidirectionalRecurrentLayer<T>

Layers · AiDotNet.NeuralNetworks.Layers

A bidirectional recurrent layer whose forward and backward outputs are concatenated: [time, 2 · hidden], the convention of PyTorch’s bidirectional=True LSTM and GRU.

Inheritance: LayerBase<T> → BidirectionalRecurrentLayer<T>

Implements: IShapeContract

For Beginners

Reads a sequence both left-to-right and right-to-left, so every position knows about what came before and after it.

How It Works

One recurrent layer reads the sequence forwards, a second reads it reversed and its output is reversed back; both outputs are concatenated per position. BidirectionalLayer adds or stacks the two directions instead. The input width is declared, so a restored layer sizes both directions before any forward.

Input [time, input] or [batch, time, input]; output [.., time, 2 · hidden].

Constructors

Constructor Summary
BidirectionalRecurrentLayer(int inputSize, int hiddenSize, RecurrentCellType cell) Creates the layer.

Properties

Property Summary
bool SupportsTraining { get; }
int OutputSize { get; } Width of the output (both directions).

Methods

Method Summary
IReadOnlyList<ILayer<T>> GetSubLayers()
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank)
void ResetState()