LogVarianceLayer<T>

Layers · AiDotNet.NeuralNetworks.Layers

Represents a layer that computes the logarithm of variance along a specified axis in the input tensor.

Inheritance: LayerBase<T> → LogVarianceLayer<T>

Implements: IShapeContract

For Beginners

This layer measures how much the values in your data spread out from their average (variance), and then takes the logarithm of that spread.

Think of it like measuring how consistent or varied your data is:

  • Low values mean the data points are very similar to each other
  • High values mean the data points vary widely

For example, if you have a set of images:

  • Images that are very similar would produce low log-variance
  • Images that are very different would produce high log-variance

This is often used in AI models that need to understand the variation in the data, such as in models that generate new data similar to what they’ve been trained on.

How It Works

The LogVarianceLayer calculates the statistical variance of values along a specified axis of the input tensor, and then computes the natural logarithm of that variance. This is often used in neural networks for calculating statistical measures, normalizing data, or as part of variational autoencoders (VAEs).

Constructors

Constructor Summary
LogVarianceLayer(int axis) Initializes a new instance of the LogVarianceLayer class.

Properties

Property Summary
bool SupportsTraining { get; } Gets a value indicating whether this layer supports training through backpropagation.
int Axis { get; set; } Gets the axis along which the variance is calculated.

Methods

Method Summary
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank)
void ResetState() Resets the internal state of the layer.