Mila
Deep Neural Network Library
Loading...
Searching...
No Matches
Mila::Dnn::ActivationConfig Class Referenceexport

Configuration class for the elementwise Activation component. More...

Inheritance diagram for Mila::Dnn::ActivationConfig:
Mila::Dnn::ComponentConfig

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.

Detailed Description

Configuration class for the elementwise Activation component.

Member Function Documentation

◆ fromMetadata()

void Mila::Dnn::ActivationConfig::fromMetadata ( const SerializationMetadata & meta)
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.

Parameters
metaMetadata to read configuration values from.

Implements Mila::Dnn::ComponentConfig.

◆ toMetadata()

SerializationMetadata Mila::Dnn::ActivationConfig::toMetadata ( ) const
inlineoverridevirtual

Convert configuration into a SerializationMetadata object.

Implementations should include any fields required to fully reconstruct the configuration via fromMetadata.

Returns
SerializationMetadata Metadata representation of the config.

Implements Mila::Dnn::ComponentConfig.

◆ toString()

std::string Mila::Dnn::ActivationConfig::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::ActivationConfig::validate ( ) const
inlineoverridevirtual

Validate configuration.

Exceptions
std::invalid_argumentif the activation type is not elementwise (e.g. Swiglu), which belongs to the gated FFN family, not here.

Implements Mila::Dnn::ComponentConfig.

◆ withGeluApproximation()

template<typename Self>
Self && Mila::Dnn::ActivationConfig::withGeluApproximation ( this Self && self,
ApproximationMethod method )
inline

Set the GELU approximation flavor.

Ignored by other functions.

◆ withLeakyReluAlpha()

template<typename Self>
Self && Mila::Dnn::ActivationConfig::withLeakyReluAlpha ( this Self && self,
float alpha )
inline

Set the LeakyReLU negative-slope coefficient.

Ignored by other functions.


The documentation for this class was generated from the following file: