Configuration class for Residual connection component.
More...
Configuration class for Residual connection component.
ResidualConfig is a lightweight, fluent configuration object consumed by Residual components and by compute-backend factories.
◆ connectionTypeToString()
| const char * Mila::Dnn::ResidualConfig::connectionTypeToString |
( |
ConnectionType | ct | ) |
|
|
inlinestaticprivatenoexcept |
◆ fromMetadata()
Populate configuration from serialization metadata.
Reads available fields from the provided metadata and updates the configuration object accordingly.
Implements Mila::Dnn::ComponentConfig.
◆ getConnectionType()
Get the configured connection type.
- Returns
- ConnectionType The connection type
◆ getScalingFactor()
| float Mila::Dnn::ResidualConfig::getScalingFactor |
( |
| ) |
const |
|
inlinenoexcept |
Get the configured scaling factor.
- Returns
- float Scaling factor
◆ toMetadata()
◆ toString()
| std::string Mila::Dnn::ResidualConfig::toString |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ validate()
| void Mila::Dnn::ResidualConfig::validate |
( |
| ) |
const |
|
inlineoverridevirtual |
Validate configuration parameters.
Called by callers to ensure the configuration represents a valid, constructible component. Implementations must throw std::invalid_argument (or a derived exception) when validation fails.
- Exceptions
-
| std::invalid_argument | If the configuration is invalid. |
Implements Mila::Dnn::ComponentConfig.
◆ withConnectionType()
template<typename Self>
| decltype(auto) Mila::Dnn::ResidualConfig::withConnectionType |
( |
this Self && | self, |
|
|
ConnectionType | ct ) |
|
inline |
Set the connection type.
Currently only Addition is supported.
- Returns
- Self&& for method chaining
◆ withScalingFactor()
template<typename Self>
| decltype(auto) Mila::Dnn::ResidualConfig::withScalingFactor |
( |
this Self && | self, |
|
|
float | factor ) |
|
inline |
Set the scaling factor applied to the residual branch.
- Parameters
-
| factor | Scaling factor (positive) |
- Returns
- Self&& for method chaining
◆ connection_type_
◆ scaling_factor_
| float Mila::Dnn::ResidualConfig::scaling_factor_ = 1.0f |
|
private |
The documentation for this class was generated from the following file: