DilatedConvolutionalLayer<T>

Layers · AiDotNet.NeuralNetworks.Layers

Represents a dilated convolutional layer for neural networks that applies filters with gaps between filter elements.

Inheritance: LayerBase<T> → DilatedConvolutionalLayer<T>

Implements: IShapeContract

For Beginners

A dilated convolutional layer is like looking at an image with a special magnifying glass.

Regular convolutions look at pixels that are right next to each other, like this:

  • Looking at a 3×3 area of an image (9 adjacent pixels)

Dilated convolutions skip some pixels, creating gaps, like this:

  • With dilation=2, it looks at pixels with a gap of 1 pixel between them
  • The 3×3 filter now covers a 5×5 area (still using only 9 values)

Benefits:

  • Sees a larger area without needing more computing power
  • Captures wider patterns in the data
  • Helps detect features at different scales

For example, in image processing, dilated convolutions can help the network understand both fine details and broader context at the same time.

How It Works

A dilated convolutional layer extends traditional convolutional layers by introducing gaps (dilation) between the elements of the convolution kernel. This increases the receptive field without increasing the number of parameters or computational cost. Dilated convolutions are particularly useful in tasks requiring a wide context without sacrificing resolution, such as semantic segmentation or audio generation.

Constructors

Constructor Summary
DilatedConvolutionalLayer(int outputDepth, int kernelSize, int dilation, int stride, int padding, IActivationFunction<T> activation, IInitializationStrategy<T> initializationStrategy) Initializes a new instance of the DilatedConvolutionalLayer class with scalar activation.
DilatedConvolutionalLayer(int outputDepth, int kernelSize, int dilation, int stride, int padding, IVectorActivationFunction<T> vectorActivation) Initializes a new instance of the DilatedConvolutionalLayer class with vector activation.

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].
void ClearGradients()
void ResetState() Resets the internal state of the layer.
void SetTrainableParameters(IReadOnlyList<Tensor<T>> parameters) Replaces trainable parameter tensors (e.g., with ParameterBuffer views).
void UpdateParameters(T learningRate) Updates the layer’s weights and biases using the calculated gradients and the specified learning rate.
void ZeroGrad() Clears all gradient fields discovered by convention ({paramName}Gradient).