AffineCouplingFlowLayer<T>

Layers · AiDotNet.NeuralNetworks.Layers

An affine coupling layer with a WaveNet-like transform network (WaveGlow; Glow-TTS §3.3): the first half of the channels passes through and parameterizes a shift and log-scale applied to the second half.

Inheritance: LayerBase<T> → AffineCouplingFlowLayer<T>

Implements: IInvertibleFlowStep<T>, IShapeContract

For Beginners

Half of the data decides how to stretch and shift the other half, which keeps the step exactly reversible however complicated the deciding network is.

How It Works

Reference implementation attentions.CouplingBlock and modules.WN: x₀, x₁ = split(x); h = start(x₀) (weight-normalized 1×1 convolution); layers gated layers a = tanh(u) ⊙ σ(v) with [u; v] = Dropout(conv_i(h)) (weight-normalized, kernel kernelSize, dilation rate^i), each feeding a residual and a skip output through a weight- normalized 1×1 convolution (the last only a skip); [m; s] = end(Σ skips), an ordinary 1×1 convolution started at zero so the layer starts as the identity; z₁ = m + e^s ⊙ x₁, log-determinant Σ s.

Constructors

Constructor Summary
AffineCouplingFlowLayer(int channels, int hidden, int kernelSize, int dilationRate, int layers, double dropoutRate) Creates the coupling 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<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].
ValueTuple<Tensor<T>, Tensor<T>> Transform(Tensor<T> input, bool reverse)
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).