GatedFusionLayer<T>

Layers · AiDotNet.NeuralNetworks.Layers

Gated fusion of two equally-wide feature streams, as used by ABINet’s fusion stage.

Inheritance: LayerBase<T> → GatedFusionLayer<T>

Implements: IShapeContract

For Beginners

Two components each produce a guess. Rather than averaging them or always trusting one, this learns a per-value dial: where the dial is near 1 it takes the first component’s answer, near 0 the second’s, and in between it blends them.

How It Works

Implements ABINet’s gated combination (Fang et al., CVPR 2021, arXiv:2103.06495 §3.4):

The gate is learned from BOTH streams jointly, then used to interpolate between them per position and per channel — so the model can lean on the visual reading where the image is clear and on the language model’s correction where it is not.

Input is the two streams concatenated along the last axis, [..., 2 * width], which keeps the layer inside the single-input ILayer contract. Output is [..., width].

Constructors

Constructor Summary
GatedFusionLayer(int width) Creates a gated fusion layer.

Properties

Property Summary
bool SupportsTraining { get; }

Methods

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