DiffusionConvLayer<T>
Layers · AiDotNet.NeuralNetworks.Layers
Implements diffusion convolution for mesh surface processing using the heat diffusion equation.
Inheritance: LayerBase<T> → DiffusionConvLayer<T>
Implements: IShapeContract
For Beginners
Think of heat spreading on a surface:
- Place a heat source at each vertex
- Let the heat diffuse across the mesh surface
- After some time, nearby vertices (in geodesic distance) will share heat
- Use this diffusion pattern to aggregate features from neighbors
Key advantages:
- Respects the true surface geometry (not just mesh connectivity)
- Adaptive receptive field based on diffusion time
- Robust to mesh discretization and vertex density
Applications:
- Shape classification and segmentation
- Surface analysis (curvature, normals, features)
- Correspondence between shapes
- Texture synthesis on surfaces
How It Works
DiffusionConvLayer applies learned diffusion kernels on mesh surfaces to aggregate information across geodesic neighborhoods. Instead of using fixed spatial neighborhoods, it leverages the heat diffusion equation to create adaptive receptive fields that respect the underlying geometry.
Reference: “DiffusionNet: Discretization Agnostic Learning on Surfaces” by Sharp et al.
Constructors
| Constructor | Summary |
|---|---|
DiffusionConvLayer(int outputChannels, int numTimeScales, int numEigenvectors, IActivationFunction<T> activation, bool? preferSpectralDiffusion) |
Initializes a new instance of the DiffusionConvLayer class with vector activation. |
DiffusionConvLayer(int outputChannels, int numTimeScales, int numEigenvectors, IVectorActivationFunction<T> vectorActivation, bool? preferSpectralDiffusion) |
Initializes a new instance of the DiffusionConvLayer class with vector activation. |
Properties
| Property | Summary |
|---|---|
T[] DiffusionTimes { get; set; } |
Gets the learned diffusion time values. |
bool SupportsGpuTraining { get; } |
Gets a value indicating whether this layer supports GPU training. |
bool SupportsTraining { get; } |
Gets a value indicating whether this layer supports training. |
int InputChannels { get; set; } |
Gets the number of input feature channels per vertex. |
int NumTimeScales { get; set; } |
Gets the number of diffusion time scales to use. |
int OutputChannels { get; set; } |
Gets the number of output feature channels per vertex. |
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]. |
IReadOnlyList<ValueTuple<string, Tensor<T>>> GetRegisteredBuffers() |
|
Tensor<T> GetBiases() |
Gets the bias tensor. |
Tensor<T> GetWeights() |
Gets the weight tensor. |
void ResetState() |
Resets cached state from forward/backward passes. |
void SetEigenbasis(T[] eigenvalues, Tensor<T> eigenvectors, Tensor<T> massMatrix) |
Sets the Laplacian eigenbasis for the current mesh. |
void SetLaplacian(Tensor<T> laplacian, Tensor<T> massMatrix) |
Sets the Laplacian matrix directly for the current mesh. |
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 UpdateParametersGpu(IGpuOptimizerConfig config) |
Updates parameters on GPU using the configured optimizer. |
void ZeroGrad() |
Clears all gradient fields discovered by convention ({paramName}Gradient). |