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

Configuration class for GELU module. More...

Inheritance diagram for Mila::Dnn::GeluConfig:
Mila::Dnn::ComponentConfig

Public Member Functions

void fromMetadata (const SerializationMetadata &meta) override
 Populate configuration from provided metadata.
ApproximationMethod getApproximationMethod () const
 Get the configured approximation method.
SerializationMetadata toMetadata () const override
 Convert configuration into framework metadata.
std::string toString () const override
 Produce a short, human-readable summary of this configuration.
void validate () const override
 Validate configuration parameters.
template<typename Self>
Self && withApproximationMethod (this Self &&self, ApproximationMethod method)
 Configure the approximation method for GELU computation.
Public Member Functions inherited from Mila::Dnn::ComponentConfig
virtual ~ComponentConfig ()=default
 Virtual destructor for polymorphic base.

Detailed Description

Configuration class for GELU module.

Provides a type-safe fluent interface for configuring GELU modules.

Member Function Documentation

◆ fromMetadata()

void Mila::Dnn::GeluConfig::fromMetadata ( const SerializationMetadata & meta)
inlineoverridevirtual

Populate configuration from provided metadata.

Missing keys are ignored leaving defaults intact. Unknown approximation method strings result in std::invalid_argument.

Parameters
metaMetadata to read configuration values from.

Implements Mila::Dnn::ComponentConfig.

◆ getApproximationMethod()

ApproximationMethod Mila::Dnn::GeluConfig::getApproximationMethod ( ) const
inline

Get the configured approximation method.

Returns
ApproximationMethod The approximation method

◆ toMetadata()

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

Convert configuration into framework metadata.

Includes base fields (precision) and GELU-specific options.

Returns
SerializationMetadata Metadata representing this configuration.

Implements Mila::Dnn::ComponentConfig.

◆ toString()

std::string Mila::Dnn::GeluConfig::toString ( ) const
inlineoverridevirtual

Produce a short, human-readable summary of this configuration.

Suitable for logging and debugging.

Returns
std::string Human-readable summary of the configuration.

Implements Mila::Dnn::ComponentConfig.

◆ validate()

void Mila::Dnn::GeluConfig::validate ( ) const
inlineoverridevirtual

Validate configuration parameters.

Implementations must throw std::invalid_argument on invalid configuration.

Implements Mila::Dnn::ComponentConfig.

◆ withApproximationMethod()

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

Configure the approximation method for GELU computation.

Note: Currently, only the Tanh approximation method is supported.

Template Parameters
SelfDeduction of the concrete config type via C++23 explicit object parameter
Parameters
methodThe approximation method to use
Returns
Self&& Reference to this for method chaining

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