SubLayerInputAttribute
Attributes · AiDotNet.Attributes
Declares the input shape a composite layer feeds to one of its sub-layers, so the shape can be generated rather than hand-written.
Inheritance: Attribute → SubLayerInputAttribute
How It Works
A composite’s children do not all receive the composite’s own input. A transformer encoder feeds
its embedding width to the norms and to the first feed-forward, but the FEED-FORWARD width to the
second one, and self-attention wants a sequence axis in front. Only the composite knows that, and
it is the single fact LayerBase.BringUpDeclaredSubLayers needs in order to bring a child up
to shapes or all the way to weights on the composite’s behalf.
Written as a comma-separated list of C# expressions evaluated in the composite’s own scope, the
same form [TrainableParameter(Shape = "...")] uses:
The generator emits DeclaredSubLayerShapes() from these, so no composite implements it.
The generated method answers empty while any child is still null or any declared axis is still negative — a composite builds its children inside its initializer, so both are ordinary states before that runs, and an empty declaration is the base’s signal that the layer cannot say yet.
Constructors
| Constructor | Summary |
|---|---|
SubLayerInputAttribute(string shape) |
Creates the declaration. |
Properties
| Property | Summary |
|---|---|
string Shape { get; } |
The declared input shape for this sub-layer. |