LayerInfo<T>
Models & Types · AiDotNet.Interfaces
Metadata about a single layer within a layered model, including its position in the flat parameter vector and computational characteristics.
How It Works
For Beginners: When you have a neural network with many layers, you often need to know details about each one: how many parameters it has, what type it is, where its parameters sit in the overall parameter vector, and how expensive it is to compute.
This class packages all that information together so that tools like pipeline partitioners, quantizers, and pruners can make smart per-layer decisions.
For example, a pipeline partitioner can use EstimatedFlops to balance
computational load across GPUs, or a quantizer can use Category to apply
different bit-widths to attention vs dense layers.
Constructors
| Constructor | Summary |
|---|---|
LayerInfo() |
Properties
| Property | Summary |
|---|---|
ILayer<T> Layer { get; set; } |
Reference to the actual layer instance. |
LayerCategory Category { get; set; } |
Layer type classification for automated decisions. |
bool IsTrainable { get; set; } |
Whether this layer has trainable parameters. |
int Index { get; set; } |
Layer index within the model (0-based). |
int ParameterOffset { get; set; } |
Start index of this layer’s parameters in the flat parameter vector returned by GetParameters(). |
int[] InputShape { get; set; } |
Input shape expected by this layer. |
int[] OutputShape { get; set; } |
Output shape produced by this layer. |
long EstimatedActivationMemory { get; set; } |
Estimated activation memory (bytes) needed during forward pass. |
long EstimatedFlops { get; set; } |
Estimated computational cost (FLOPs) for a single forward pass. |
long ParameterCount { get; set; } |
Number of trainable parameters in this layer. |
string Name { get; set; } |
Human-readable layer name (e.g., “SelfAttentionLayer_0”, “FullyConnectedLayer_3”). |