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

Configuration class for the Learned Positional Encoder. More...

Inheritance diagram for Mila::Dnn::LpeConfig:
Mila::Dnn::ComponentConfig

Public Member Functions

void fromMetadata (const SerializationMetadata &meta) override
 Populate configuration from serialization metadata.
dim_t getEmbeddingDim () const
 Get the configured embedding dimension.
dim_t getMaxSequenceLength () const
 Get the configured maximum sequence length.
dim_t getVocabularyLength () const
 Get the configured vocabulary length.
SerializationMetadata toMetadata () const override
 Convert configuration to serialization 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>
decltype(auto) withEmbeddingDim (this Self &&self, dim_t embedding_dim)
 C++23-style fluent setter for embedding dimension.
template<typename Self>
decltype(auto) withMaxSequenceLength (this Self &&self, dim_t max_seq_len)
 C++23-style fluent setter for maximum sequence length.
template<typename Self>
decltype(auto) withVocabularyLength (this Self &&self, dim_t vocab_len)
 C++23-style fluent setter for vocabulary length.
Public Member Functions inherited from Mila::Dnn::ComponentConfig
virtual ~ComponentConfig ()=default
 Virtual destructor for polymorphic base.

Detailed Description

Configuration class for the Learned Positional Encoder.

Provides a type-safe fluent interface for configuring Encoder.

Member Function Documentation

◆ fromMetadata()

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

Populate configuration from serialization metadata.

Reads available fields from the provided metadata and updates the configuration object accordingly.

Implements Mila::Dnn::ComponentConfig.

◆ getEmbeddingDim()

dim_t Mila::Dnn::LpeConfig::getEmbeddingDim ( ) const
inline

Get the configured embedding dimension.

Returns
dim_t The embedding dimension

◆ getMaxSequenceLength()

dim_t Mila::Dnn::LpeConfig::getMaxSequenceLength ( ) const
inline

Get the configured maximum sequence length.

Returns
dim_t The maximum sequence length

◆ getVocabularyLength()

dim_t Mila::Dnn::LpeConfig::getVocabularyLength ( ) const
inline

Get the configured vocabulary length.

Returns
dim_t The vocabulary length

◆ toMetadata()

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

Convert configuration to serialization metadata.

Produces a SerializationMetadata object containing the configuration fields suitable for writing into an archive by the caller.

Implements Mila::Dnn::ComponentConfig.

◆ toString()

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

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

Overrides ComponentConfig::toString() to include Encoder-specific fields.

Implements Mila::Dnn::ComponentConfig.

◆ validate()

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

Validate configuration parameters.

Exceptions
std::invalid_argumentIf validation fails

Implements Mila::Dnn::ComponentConfig.


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