AveragePoolingLayer<T>

Layers ยท AiDotNet.NeuralNetworks.Layers

Implements an average pooling layer for neural networks, which reduces the spatial dimensions of the input by taking the average value in each pooling window.

Inheritance: LayerBase<T> โ†’ AveragePoolingLayer<T>

Implements: IShapeContract

How It Works

For Beginners: An average pooling layer helps reduce the size of data flowing through a neural network while preserving overall characteristics. It works by dividing the input into small windows (determined by the pool size) and computing the average of all values in each window.

Think of it like creating a lower-resolution summary: instead of keeping every detail, you average all the values in each area to get a representative value.

This helps the network:

  1. Preserve background information and overall context
  2. Reduce computation needs
  3. Smooth out noisy features

Average pooling is often used in the final layers of a network or when you want to preserve more spatial information compared to max pooling.

Constructors

Constructor Summary
AveragePoolingLayer(int poolSize, int strides) Creates a new average pooling layer with the specified parameters.

Properties

Property Summary
bool SupportsTraining { get; } Indicates whether this layer supports training operations.
int PoolSize { get; set; } Gets the size of the pooling window.
int Strides { get; set; } Gets the step size when moving the pooling window across the input.

Methods

Method Summary
IEnumerable<ActivationFunction> GetActivationTypes() Returns the activation functions used by this layer.
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank)
int[] GetPoolSize() Gets the pool size as a 2D array (height, width).
int[] GetStride() Gets the stride as a 2D array (height stride, width stride).
void ResetState() Resets the internal state of the layer.