◆ LayerNormConfig() [1/2]
| Mila::Dnn::LayerNormConfig::LayerNormConfig |
( |
shape_t | shape | ) |
|
|
inlineexplicit |
Construct in shape mode.
Normalizes over the trailing dimensions described by shape.
- Parameters
-
| shape | Trailing dimensions to normalize over (e.g. shape_t{ model_dim }). |
◆ LayerNormConfig() [2/2]
| Mila::Dnn::LayerNormConfig::LayerNormConfig |
( |
int64_t | axis | ) |
|
|
inlineexplicit |
Construct in axis mode.
Normalizes over a single axis.
- Parameters
-
| axis | Axis along which to normalize (negative indexing supported). |
◆ fromMetadata()
Populate configuration from provided metadata.
Implementations should read available keys and leave missing keys at their current/default values to preserve forward/backward compatibility.
- Parameters
-
| meta | Metadata to read configuration values from. |
Implements Mila::Dnn::ComponentConfig.
◆ getAxis()
| std::optional< int64_t > Mila::Dnn::LayerNormConfig::getAxis |
( |
| ) |
const |
|
inlinenoexcept |
◆ getEpsilon()
| float Mila::Dnn::LayerNormConfig::getEpsilon |
( |
| ) |
const |
|
inlinenoexcept |
◆ getNormalizedShape()
| const shape_t & Mila::Dnn::LayerNormConfig::getNormalizedShape |
( |
| ) |
const |
|
inlinenoexcept |
◆ hasBias()
| bool Mila::Dnn::LayerNormConfig::hasBias |
( |
| ) |
const |
|
inlinenoexcept |
◆ hasNormalizedShape()
| bool Mila::Dnn::LayerNormConfig::hasNormalizedShape |
( |
| ) |
const |
|
inlinenoexcept |
◆ toMetadata()
◆ toString()
| std::string Mila::Dnn::LayerNormConfig::toString |
( |
| ) |
const |
|
inlineoverridevirtual |
Produce a short, human-readable summary of the configuration.
Implementations should return a compact, single-line description suitable for logging and debugging.
- Returns
- std::string Human-readable summary of the configuration.
Implements Mila::Dnn::ComponentConfig.
◆ validate()
| void Mila::Dnn::LayerNormConfig::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.
◆ withBias()
template<typename Self>
| decltype(auto) Mila::Dnn::LayerNormConfig::withBias |
( |
this Self && | self, |
|
|
bool | has_bias ) |
|
inline |
Enable or disable learnable bias.
Default: true.
◆ withEpsilon()
template<typename Self>
| decltype(auto) Mila::Dnn::LayerNormConfig::withEpsilon |
( |
this Self && | self, |
|
|
float | epsilon ) |
|
inline |
Set epsilon for numerical stability.
Default: 1e-5f.
◆ axis_
| std::optional<dim_t> Mila::Dnn::LayerNormConfig::axis_ { std::nullopt } |
|
private |
◆ epsilon_
| float Mila::Dnn::LayerNormConfig::epsilon_ { 1e-5f } |
|
private |
◆ has_bias_
| bool Mila::Dnn::LayerNormConfig::has_bias_ { true } |
|
private |
◆ normalized_shape_
| shape_t Mila::Dnn::LayerNormConfig::normalized_shape_ {} |
|
private |
The documentation for this class was generated from the following file: