MeshPoolLayer<T>
Layers · AiDotNet.NeuralNetworks.Layers
Implements mesh pooling via edge collapse for MeshCNN-style networks.
Inheritance: LayerBase<T> → MeshPoolLayer<T>
Implements: IShapeContract
For Beginners
Just like max pooling shrinks an image by combining pixels, mesh pooling shrinks a mesh by combining edges. The layer learns which edges are less important and removes them, simplifying the mesh while preserving important features.
Key concepts:
- Edge collapse: Remove an edge by merging its two vertices into one
- Importance score: Learned value indicating how important each edge is
- Target edges: Number of edges to keep after pooling
The process:
- Compute importance scores for all edges using current features
- Sort edges by importance (lowest first)
- Collapse least important edges until target count is reached
- Update adjacency information for remaining edges
How It Works
MeshPoolLayer reduces the number of edges in a mesh by collapsing edges based on learned importance scores. This is analogous to pooling in image CNNs but operates on the mesh structure.
Reference: “MeshCNN: A Network with an Edge” by Hanocka et al., SIGGRAPH 2019
Constructors
| Constructor | Summary |
|---|---|
MeshPoolLayer(int inputChannels, int targetEdges, int numNeighbors) |
Initializes a new instance of the MeshPoolLayer class. |
Properties
| Property | Summary |
|---|---|
bool SupportsTraining { get; } |
Gets a value indicating whether this layer supports training. |
int InputChannels { get; set; } |
Gets the number of input feature channels per edge. |
int TargetEdges { get; set; } |
Gets the target number of edges after pooling. |
int[] RemainingEdgeIndices { get; set; } |
Gets or sets the edge indices that remain after pooling. |
int[] UpdatedAdjacency { get; set; } |
Gets or sets the updated edge adjacency after pooling. |
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 (null for this layer). |
Tensor<T> GetWeights() |
Gets the importance weights tensor. |
void ResetState() |
Resets the cached state from forward/backward passes. |
void SetEdgeAdjacency(int[] edgeAdjacency) |
Sets the edge adjacency information for the current mesh. |
void SetTrainableParameters(IReadOnlyList<Tensor<T>> parameters) |
Replaces trainable parameter tensors (e.g., with ParameterBuffer views). |
void UpdateParameters(T learningRate) |
Updates the layer parameters using computed gradients. |
void ZeroGrad() |
Clears all gradient fields discovered by convention ({paramName}Gradient). |