|
Mila
Deep Neural Network Library
|
Configuration class for the elementwise Activation component. More...
Public Member Functions | |
| ActivationConfig (ActivationType activation_type) | |
| void | fromMetadata (const SerializationMetadata &meta) override |
| Populate configuration from provided metadata. | |
| ActivationType | getActivationType () const noexcept |
| ApproximationMethod | getGeluApproximation () const noexcept |
| float | getLeakyReluAlpha () 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. | |
| template<typename Self> | |
| Self && | withActivationType (this Self &&self, ActivationType activation_type) |
| Set the activation function type (serializable metadata). | |
| template<typename Self> | |
| Self && | withGeluApproximation (this Self &&self, ApproximationMethod method) |
| Set the GELU approximation flavor. | |
| template<typename Self> | |
| Self && | withLeakyReluAlpha (this Self &&self, float alpha) |
| Set the LeakyReLU negative-slope coefficient. | |
| Public Member Functions inherited from Mila::Dnn::ComponentConfig | |
| virtual | ~ComponentConfig ()=default |
| Virtual destructor for polymorphic base. | |
Configuration class for the elementwise Activation component.
|
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.
| std::invalid_argument | if the activation type is not elementwise (e.g. Swiglu), which belongs to the gated FFN family, not here. |
Implements Mila::Dnn::ComponentConfig.
|
inline |
Set the GELU approximation flavor.
Ignored by other functions.
|
inline |
Set the LeakyReLU negative-slope coefficient.
Ignored by other functions.