SpiralConvLayer<T>

Layers · AiDotNet.NeuralNetworks.Layers

Implements spiral convolution for mesh vertex processing.

Inheritance: LayerBase<T> → SpiralConvLayer<T>

Implements: IShapeContract

For Beginners

Unlike image convolutions where neighbors are in a grid, mesh vertices have irregular connectivity. Spiral convolution solves this by:

  1. Starting at each vertex
  2. Visiting neighbors in a consistent spiral pattern (like a clock hand)
  3. Gathering features from each neighbor in order
  4. Applying learned weights to the ordered features

This creates a consistent “template” for convolution regardless of mesh topology.

Applications:

  • 3D shape analysis and classification
  • Facial expression recognition
  • Body pose estimation
  • Medical surface analysis

How It Works

SpiralConvLayer operates on mesh vertices by aggregating features from neighbors in a consistent spiral ordering. This enables translation-equivariant convolutions on irregular mesh structures by defining a canonical ordering of vertex neighbors.

Reference: “Neural 3D Morphable Models: Spiral Convolutional Networks” by Bouritsas et al. Reference: “SpiralNet++: A Fast and Highly Efficient Mesh Convolution Operator” by Gong et al.

Constructors

Constructor Summary
SpiralConvLayer(int inputChannels, int outputChannels, int spiralLength, IActivationFunction<T> activationFunction) Eager constructor: allocates and initializes the weight/bias tensors immediately for a known input channel count.
SpiralConvLayer(int outputChannels, int spiralLength, IActivationFunction<T> activationFunction) Initializes a new instance of the SpiralConvLayer class with vector activation.
SpiralConvLayer(int outputChannels, int spiralLength, IVectorActivationFunction<T> vectorActivation) Initializes a new instance of the SpiralConvLayer class with vector activation.

Properties

Property Summary
bool SupportsTraining { get; } Gets a value indicating whether this layer supports training (backpropagation).
int InputChannels { get; set; } Gets the number of input feature channels per vertex.
int OutputChannels { get; set; } Gets the number of output feature channels per vertex.
int SpiralLength { get; set; } Gets the spiral sequence length (number of neighbors in the spiral).

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].
Tensor<T> GetBiases() Gets the bias tensor.
Tensor<T> GetWeights() Gets the weight tensor.
void ResetState() Resets cached state from forward/backward passes.
void SetSpiralIndices(int[] spiralIndices) Sets the spiral indices for the mesh being processed.
void SetTrainableParameters(IReadOnlyList<Tensor<T>> parameters) Replaces trainable parameter tensors (e.g., with ParameterBuffer views).
void UpdateParameters(T learningRate) Updates layer parameters using computed gradients.
void ZeroGrad() Clears all gradient fields discovered by convention ({paramName}Gradient).