|
Mila 0.13.48
Deep Neural Network Library
|
Configuration object for a Linear (fully connected) layer. More...


Public Member Functions | |
| LinearConfig (dim_t input_features, dim_t output_features) | |
| Construct a LinearConfig with required feature dimensions. | |
| void | fromMetadata (const SerializationMetadata &meta) override |
| Populate configuration from provided metadata. | |
| dim_t | getInputFeatures () const noexcept |
| Get the configured number of input features. | |
| dim_t | getOutputFeatures () const noexcept |
| Get the configured number of output features. | |
| bool | hasBias () const noexcept |
| Query whether the bias term is enabled. | |
| SerializationMetadata | toMetadata () const override |
| Convert configuration into SerializationMetadata. | |
| std::string | toString () const override |
| Human-readable summary suitable for logging. | |
| void | validate () const override |
| Validate the configuration values. | |
| template<typename Self> | |
| Self && | withBias (this Self &&self, bool has_bias) |
| Fluent setter for bias enable flag. | |
| template<typename Self> | |
| Self && | withInputFeatures (this Self &&self, dim_t input_features) |
| Fluent setter for input features. | |
| template<typename Self> | |
| Self && | withOutputFeatures (this Self &&self, dim_t output_features) |
| Fluent setter for output features. | |
| Public Member Functions inherited from Mila::Dnn::ComponentConfig | |
| virtual | ~ComponentConfig ()=default |
| Virtual destructor for polymorphic base. | |
Private Attributes | |
| bool | has_bias_ { true } |
| Whether the layer has a bias term. | |
| dim_t | input_features_ |
| Number of input features (must be > 0). | |
| dim_t | output_features_ |
| Number of output features (must be > 0). | |
Configuration object for a Linear (fully connected) layer.
LinearConfig describes parameters required to construct a Linear layer: input and output feature dimensions and whether a bias is present.
Instances are lightweight value objects intended to be passed into module factories or constructors. Call validate() prior to constructing runtime objects to surface configuration errors early.
Construct a LinearConfig with required feature dimensions.
| input_features | Number of input features (must be > 0). |
| output_features | Number of output features (must be > 0). |
|
inlineoverridevirtual |
Populate configuration from provided metadata.
Missing keys are ignored, leaving defaults intact. Type mismatches result in no assignment (use tryGet* helpers).
| meta | Metadata to read configuration values from. |
Implements Mila::Dnn::ComponentConfig.

|
inlinenoexcept |
Get the configured number of input features.
|
inlinenoexcept |
Get the configured number of output features.
|
inlinenoexcept |
Query whether the bias term is enabled.
|
inlineoverridevirtual |
Convert configuration into SerializationMetadata.
Produces keys:
Implements Mila::Dnn::ComponentConfig.

|
inlineoverridevirtual |
Human-readable summary suitable for logging.
Implements Mila::Dnn::ComponentConfig.
|
inlineoverridevirtual |
Validate the configuration values.
Throws std::invalid_argument when the configuration is invalid.
Implements Mila::Dnn::ComponentConfig.
|
inline |
Fluent setter for bias enable flag.
| Self | Concrete config type (deduced via explicit object parameter) |
| has_bias | True to include a bias parameter, false to omit it. |

|
inline |
Fluent setter for input features.
| input_features | Number of input features. |
|
inline |
Fluent setter for output features.
| output_features | Number of output features. |
|
private |
Whether the layer has a bias term.
Default is true.
|
private |
Number of input features (must be > 0).
|
private |
Number of output features (must be > 0).