ConvNeXtV2Block<T>
Layers · AiDotNet.NeuralNetworks.Layers
A ConvNeXt v2 block: depth-wise convolution, layer norm, point-wise expansion, GELU, Global Response Normalization (GRN), point-wise projection, and a residual connection.
Inheritance: LayerBase<T> → ConvNeXtV2Block<T>
Implements: IShapeContract
How It Works
ConvNeXt v2 (Woo et al., 2023) adds GRN to the v1 block. GRN normalizes each channel by its global response relative to the mean response across channels, which increases contrast and selectivity between channels — it is the distinguishing element of v2, so a v1 block with GRN omitted is a different architecture.
GRN: for channel c with per-channel L2 response G_c over the
sequence axis,
Shapes: operates on [B, S, C], i.e. channels-last, so the point-wise
convolutions are ordinary dense projections over the channel axis.
Gradient tracking: every operation goes through IEngine, so the tape
records the block — including GRN — without any manual backward.
Constructors
| Constructor | Summary |
|---|---|
ConvNeXtV2Block(int channels, int intermediateChannels, int kernelSize) |
Initializes a new ConvNeXt v2 block. |
Properties
| Property | Summary |
|---|---|
bool SupportsTraining { get; } |
Methods
| Method | Summary |
|---|---|
Dictionary<string, string> GetParameterRoles() |
Returns parameter roles for per-role optimizer configuration (e.g., weight decay exemption for biases). |
IReadOnlyList<ILayer<T>> GetSubLayers() |
|
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank) |
Derived from this type’s [TensorLayout] declarations. |
IReadOnlyList<Tensor<T>> GetTrainableParameters() |
Returns all trainable parameter tensors marked with [TrainableParameter]. |
void ResetState() |
|
void SetTrainableParameters(IReadOnlyList<Tensor<T>> parameters) |
Replaces trainable parameter tensors (e.g., with ParameterBuffer views). |
void ZeroGrad() |
Clears all gradient fields discovered by convention ({paramName}Gradient). |