NormedConv1DLayer<T>
Layers · AiDotNet.NeuralNetworks.Layers
A 1-D convolution (or transposed convolution) with weight or spectral normalization, stride, dilation and groups —
PyTorch’s weight_norm(Conv1d(...)) / spectral_norm(Conv1d(...)) as GAN vocoders use them.
Inheritance: LayerBase<T> → NormedConv1DLayer<T>
Implements: IShapeContract
For Beginners
An ordinary convolution whose weights are kept at a controlled scale, which makes GAN training much more stable.
How It Works
The direction V is initialized as PyTorch’s default for the layer (U(−1/√fan_in, 1/√fan_in), with fan_in the input
channels per group times the kernel; for a transposed convolution the output channels per group times the kernel),
as is the bias. With weight normalization the per-output-channel norm g starts at ‖V‖ so W starts equal to V; with
spectral normalization the left singular-vector estimate u (a persistent buffer, as in PyTorch) is refined by one power
iteration on every training forward and W = V / (uᵀ V v). Input and output are [batch, channels, time].
Constructors
| Constructor | Summary |
|---|---|
NormedConv1DLayer(int inChannels, int outChannels, int kernelSize, int stride, int dilation, int groups, int padding, bool transposed, ConvolutionNormalization normalization, bool useBias, int outputPadding) |
Creates the layer. |
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<OutputAxisContract> OutputAxesFor(int inputRank) |
|
IReadOnlyList<Tensor<T>> GetTrainableParameters() |
Returns all trainable parameter tensors marked with [TrainableParameter]. |
IReadOnlyList<ValueTuple<string, Tensor<T>>> GetRegisteredBuffers() |
|
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). |