ResidualDenseBlock<T>
Layers · AiDotNet.NeuralNetworks.Layers
Residual Dense Block (RDB) as used in ESRGAN and Real-ESRGAN generators.
Inheritance: LayerBase<T> → ResidualDenseBlock<T>
Implements: IShapeContract
For Beginners
This block is the building block of ESRGAN’s generator. It combines ideas from DenseNet (dense connections) and ResNet (residual learning):
- Dense connections: Each conv layer can see ALL previous features
- Local residual: The block’s output is added to its input (helps training)
- Residual scaling: The residual is scaled by 0.2 (prevents instability)
- LeakyReLU: Uses LeakyReLU(0.2) instead of ReLU (better gradients)
- No batch norm: ESRGAN generator doesn’t use batch normalization
The default parameters (64 features, 32 growth, 0.2 scale) are from the paper.
How It Works
This implements the Residual Dense Block from the ESRGAN paper (Wang et al., 2018). It differs from DenseNet’s Dense Block by using LeakyReLU, no batch normalization, and a local residual connection with scaling.
The architecture consists of 5 convolutional layers with dense connections:
Reference: Wang et al., “ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks”,
ECCV 2018 Workshops. https://arxiv.org/abs/1809.00219
Constructors
| Constructor | Summary |
|---|---|
ResidualDenseBlock(int numFeatures, int growthChannels, double residualScale) |
Initializes a new Residual Dense Block. |
Properties
| Property | Summary |
|---|---|
bool SupportsTraining { get; } |
|
double ResidualScale { get; } |
Gets the residual scaling factor. |
int GrowthChannels { get; } |
Gets the growth channels (intermediate conv output channels). |
int NumFeatures { get; } |
Gets the number of feature channels. |
Methods
| Method | Summary |
|---|---|
IReadOnlyList<ILayer<T>> GetSubLayers() |
|
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank) |
|
void ClearGradients() |
|
void ResetState() |
|
void UpdateParameters(T learningRate) |