VariancePredictorLayer<T>

Layers · AiDotNet.NeuralNetworks.Layers

The variance predictor of FastSpeech 2: a 2-layer 1D convolutional network, each layer followed by ReLU, layer normalization and dropout, then a linear projection.

Inheritance: LayerBase<T> → VariancePredictorLayer<T>

Implements: IShapeContract

For Beginners

A small network that reads the phoneme (or frame) features and guesses one number per position — how long the phoneme lasts, how high or loud it is.

How It Works

FastSpeech 2 (Ren et al. 2021, §2.3, Fig. 1c) uses this structure, with separate parameters, for its duration, pitch and energy predictors: “a 2-layer 1D-convolutional network with ReLU activation, each followed by the layer normalization and the dropout layer, and an extra linear layer to project the hidden states into the output sequence”. Appendix A: kernel 3, 256 filters for both layers, dropout 0.5.

Input [batch, time, hidden]; output [batch, time, outputSize] (1 for duration and energy, the number of CWT scales for the pitch spectrogram).

Constructors

Constructor Summary
VariancePredictorLayer(int inputSize, int filterSize, int outputSize, int kernelSize, double dropoutRate) Creates a variance predictor.

Properties

Property Summary
bool SupportsTraining { get; }
double DropoutRate { get; } Dropout probability.
int FilterSize { get; } Channels of both convolutions.
int InputSize { get; } Width of the incoming hidden sequence.
int KernelSize { get; } Kernel of both convolutions.
int OutputSize { get; } Values predicted per position.

Methods

Method Summary
IReadOnlyList<ILayer<T>> GetSubLayers()
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank) Derived from this type’s [TensorLayout] declarations.
Tensor<T> ForwardWithHidden(Tensor<T> input, Tensor<T> hidden) Runs the predictor and also returns the convolutional hidden sequence [batch, time, filterSize] that feeds the final projection.
void ResetState()