Mila 0.13.48
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:
Collaboration diagram for Mila::Dnn::GeluConfig:

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.

Private Attributes

ApproximationMethod approximation_method_ = ApproximationMethod::Tanh

Detailed Description

Configuration class for GELU module.

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

Examples
/__w/Mila/Mila/Mila/Src/Dnn/Components/Activations/Gelu/Gelu.ixx.

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.

Here is the call graph for this function:

◆ getApproximationMethod()

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

Get the configured approximation method.

Returns
ApproximationMethod The approximation method
Examples
/__w/Mila/Mila/Mila/Src/Dnn/Components/Activations/Gelu/Gelu.ixx.
Here is the caller graph for this function:

◆ 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.

Here is the call graph for this function:

◆ 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.

Here is the call graph for this function:

◆ validate()

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

Validate configuration parameters.

Implementations must throw std::invalid_argument on invalid configuration.

Implements Mila::Dnn::ComponentConfig.

Examples
/__w/Mila/Mila/Mila/Src/Dnn/Components/Activations/Gelu/Gelu.ixx.
Here is the caller graph for this function:

◆ 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
Examples
/__w/Mila/Mila/Mila/Src/Dnn/Components/Activations/Gelu/Gelu.ixx.
Here is the caller graph for this function:

Member Data Documentation

◆ approximation_method_

ApproximationMethod Mila::Dnn::GeluConfig::approximation_method_ = ApproximationMethod::Tanh
private

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