TransitionLayer<T>
Layers · AiDotNet.NeuralNetworks.Layers
Implements a Transition Layer from the DenseNet architecture.
Inheritance: LayerBase<T> → TransitionLayer<T>
Implements: IShapeContract
For Beginners
The transition layer acts as a “bottleneck” between dense blocks.
Its purposes:
- Reduce feature map channels (compression): Dense blocks produce many channels
- Reduce spatial size (pooling): Helps control computational cost
- Improve model compactness without sacrificing accuracy
The compression factor (theta) controls how much to reduce channels. theta=0.5 means halving the channels at each transition.
How It Works
A Transition Layer is placed between Dense Blocks to reduce the number of feature maps and spatial dimensions. It performs:
- Batch Normalization
- 1x1 Convolution (channel reduction by compression factor)
- 2x2 Average Pooling with stride 2 (spatial dimension halving)
Architecture:
Where theta is the compression factor (default: 0.5).
Constructors
| Constructor | Summary |
|---|---|
TransitionLayer(double compressionFactor) |
Lazy ctor — input depth/height/width come from the first Forward call (OnFirstForward); only the channel-compression factor is required at construction. |
TransitionLayer(double compressionFactor, bool convolutionBias) |
Lazy ctor with the 1x1 projection’s bias stated. |
Properties
| Property | Summary |
|---|---|
bool SupportsTraining { get; } |
Gets a value indicating whether this layer supports training. |
int OutputChannels { get; set; } |
Gets the number of output channels. |
Methods
| Method | Summary |
|---|---|
IReadOnlyList<ILayer<T>> GetSubLayers() |
|
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank) |
|
void ClearGradients() |
|
void ResetState() |
Resets the internal state of the layer. |
void UpdateParameters(T learningRate) |
Updates the parameters of all sub-layers. |