ReconstructionLayer<T>
Layers · AiDotNet.NeuralNetworks.Layers
Represents a reconstruction layer that uses multiple fully connected layers to transform inputs into outputs.
Inheritance: LayerBase<T> → ReconstructionLayer<T>
Implements: IShapeContract
For Beginners
This layer works like a mini-network within your neural network.
Think of the ReconstructionLayer as a specialized team of artists:
- The first artist (first fully connected layer) makes a rough sketch
- The second artist (second fully connected layer) adds details to the sketch
- The third artist (third fully connected layer) finalizes the artwork
In an autoencoder network (a common use for this layer):
- Earlier layers compress your data into a compact form (like squeezing information)
- This reconstruction layer carefully expands that compact form back to the original size
- It learns how to restore information that was “squeezed out” during compression
For example, if you’re building an image autoencoder, this layer would help transform the compressed representation back into an image that looks like the original.
By using three layers instead of just one, this layer can learn more sophisticated patterns for reconstructing the data.
How It Works
The ReconstructionLayer is a composite layer that consists of three fully connected layers in sequence. It is typically used in autoencoders or similar architectures to reconstruct the original input from a compressed representation. The layer provides a deeper transformation path through multiple hidden layers, allowing it to learn more complex reconstruction functions than a single layer could.
Constructors
| Constructor | Summary |
|---|---|
ReconstructionLayer(int inputDimension, int hidden1Dimension, int hidden2Dimension, int outputDimension, IActivationFunction<T> hiddenActivation, IActivationFunction<T> outputActivation) |
Initializes a new instance of the ReconstructionLayer class with vector activation functions. |
ReconstructionLayer(int inputDimension, int hidden1Dimension, int hidden2Dimension, int outputDimension, IVectorActivationFunction<T> hiddenVectorActivation, IVectorActivationFunction<T> outputVectorActivation) |
Initializes a new instance of the ReconstructionLayer class with vector activation functions. |
Properties
| Property | Summary |
|---|---|
bool IsShapeResolved { get; } |
ReconstructionLayer’s own InputShape/OutputShape are concrete from construction, so the base IsShapeResolved returns true immediately — but its three lazy FullyConnectedLayer sub-layers have unallocated weight tensors until the first… |
bool SupportsTraining { get; } |
Gets a value indicating whether this layer supports training. |
Methods
| Method | Summary |
|---|---|
IReadOnlyList<ILayer<T>> GetSubLayers() |
|
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank) |
|
void ClearGradients() |
|
void ResetState() |
Resets the internal state of the reconstruction layer. |
void UpdateParameters(T learningRate) |
Updates the parameters of the reconstruction layer using the calculated gradients. |