|
Mila
Deep Neural Network Library
|
Public Member Functions | |
| LayerNormConfig (int64_t axis) | |
| Construct in axis mode. | |
| LayerNormConfig (shape_t shape) | |
| Construct in shape mode. | |
| void | fromMetadata (const SerializationMetadata &meta) override |
| Populate configuration from provided metadata. | |
| std::optional< int64_t > | getAxis () const noexcept |
| float | getEpsilon () const noexcept |
| const shape_t & | getNormalizedShape () const noexcept |
| bool | hasBias () const noexcept |
| bool | hasNormalizedShape () const noexcept |
| SerializationMetadata | toMetadata () const override |
| Convert configuration into a SerializationMetadata object. | |
| std::string | toString () const override |
| Produce a short, human-readable summary of the configuration. | |
| void | validate () const override |
| Validate configuration parameters. | |
| template<typename Self> | |
| decltype(auto) | withBias (this Self &&self, bool has_bias) |
| Enable or disable learnable bias. | |
| template<typename Self> | |
| decltype(auto) | withEpsilon (this Self &&self, float epsilon) |
| Set epsilon for numerical stability. | |
| Public Member Functions inherited from Mila::Dnn::ComponentConfig | |
| virtual | ~ComponentConfig ()=default |
| Virtual destructor for polymorphic base. | |
|
inlineexplicit |
Construct in shape mode.
Normalizes over the trailing dimensions described by shape.
| shape | Trailing dimensions to normalize over (e.g. shape_t{ model_dim }). |
|
inlineexplicit |
Construct in axis mode.
Normalizes over a single axis.
| axis | Axis along which to normalize (negative indexing supported). |
|
inlineoverridevirtual |
Populate configuration from provided metadata.
Implementations should read available keys and leave missing keys at their current/default values to preserve forward/backward compatibility.
| meta | Metadata to read configuration values from. |
Implements Mila::Dnn::ComponentConfig.
|
inlineoverridevirtual |
Convert configuration into a SerializationMetadata object.
Implementations should include any fields required to fully reconstruct the configuration via fromMetadata.
Implements Mila::Dnn::ComponentConfig.
|
inlineoverridevirtual |
Produce a short, human-readable summary of the configuration.
Implementations should return a compact, single-line description suitable for logging and debugging.
Implements Mila::Dnn::ComponentConfig.
|
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.
| std::invalid_argument | If the configuration is invalid. |
Implements Mila::Dnn::ComponentConfig.
|
inline |
Enable or disable learnable bias.
Default: true.
|
inline |
Set epsilon for numerical stability.
Default: 1e-5f.