RepViTBlockLayer<T>
Layers · AiDotNet.NeuralNetworks.Layers
Implements the token mixer and channel mixer from a RepViT block.
Inheritance: LayerBase<T> → RepViTBlockLayer<T>
Implements: IShapeContract
For Beginners
This layer first mixes nearby image pixels and then mixes feature channels. The residual path preserves the input features while the new transformations learn.
How It Works
The training graph follows the authors’ reference implementation: a re-parameterizable depthwise token mixer, optional squeeze-and-excitation, then a residual two-layer pointwise channel mixer with GELU. Re-parameterization is an inference optimization and does not change the training graph represented here.
Reference: Ao Wang et al., RepViT: Revisiting Mobile CNN From ViT Perspective, 2023, arXiv:2307.09283.
Constructors
| Constructor | Summary |
|---|---|
RepViTBlockLayer(int inChannels, int outChannels, int stride, bool useSE) |
Creates one RepViT block for known input and output channel widths. |
Properties
| Property | Summary |
|---|---|
bool SupportsTraining { get; } |
Methods
| Method | Summary |
|---|---|
IReadOnlyList<ILayer<T>> GetSubLayers() |
|
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank) |
|
void ClearGradients() |
|
void ResetState() |
|
void UpdateParameters(T learningRate) |