LayerPropertyAttribute

Attributes · AiDotNet.Attributes

Declares architectural properties of a neural network layer for cataloging and test generation.

Inheritance: Attribute → LayerPropertyAttribute

Constructors

Constructor Summary
LayerPropertyAttribute()

Properties

Property Summary
ComputeCost Cost { get; set; } Relative computational cost.
LayerApiShape ApiShape { get; set; } The Forward method signature shape this layer uses.
bool ChangesShape { get; set; } Whether the layer changes the shape of its input.
bool HasTrainingMode { get; set; } Whether the layer behaves differently during training vs inference (e.g., Dropout, BatchNorm).
bool IsStateful { get; set; } Whether the layer is stateful across forward passes (RNN hidden state, running mean).
bool IsTrainable { get; set; } Whether the layer has trainable parameters (weights/biases).
bool NormalizesInput { get; set; } Whether the layer normalizes input (LayerNorm, BatchNorm, etc.) so uniform-value inputs produce identical outputs regardless of the actual value.
bool ProducesNonFiniteOutput { get; set; } Whether the layer legitimately produces ±Infinity values in its Forward output, by design rather than by numerical instability.
bool SupportsBackpropagation { get; set; } Whether the layer supports backpropagation gradient computation.
bool SupportsInPlace { get; set; } Whether the layer supports in-place operation (output can alias input).
bool TrainsViaCustomLoss { get; set; } Whether the layer trains via a custom loss rather than gradients flowing from its Forward output.
bool UsesSurrogateGradient { get; set; } Whether the layer uses surrogate gradients (e.g., spiking neural networks use a smooth approximation for the non-differentiable Heaviside step function).
int ExpectedInputRank { get; set; } Expected input rank (number of dimensions).
string TestConstructorArgs { get; set; } Constructor arguments as a comma-separated string for auto-generated tests.
string TestInputShape { get; set; } The input tensor shape to use for auto-generated tests, as a comma-separated string.
string TestSetupCode { get; set; } C# code to call on the layer after construction to set up graph data, adjacency matrices, or other domain-specific initialization required before Forward.