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

Public Member Functions

void fromMetadata (const SerializationMetadata &meta) override
 Populate configuration from serialization metadata.
size_t getEmbeddingDim () const
 Get the configured embedding dimension.
size_t getMaxSequenceLength () const
 Get the configured maximum sequence length.
size_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, size_t embedding_dim)
 C++23-style fluent setter for embedding dimension.
template<typename Self>
decltype(auto) withMaxSequenceLength (this Self &&self, size_t max_seq_len)
 C++23-style fluent setter for maximum sequence length.
template<typename Self>
decltype(auto) withVocabularyLength (this Self &&self, size_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.

Private Attributes

size_t embedding_dim_ = 0
 The embedding dimension size.
size_t max_seq_len_ = 512
 The maximum sequence length.
size_t vocab_len_ = 50000
 The vocabulary size.

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.

Here is the call graph for this function:

◆ getEmbeddingDim()

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

Get the configured embedding dimension.

Returns
size_t The embedding dimension

◆ getMaxSequenceLength()

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

Get the configured maximum sequence length.

Returns
size_t The maximum sequence length

◆ getVocabularyLength()

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

Get the configured vocabulary length.

Returns
size_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.

Here is the call graph for this function:

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

Here is the caller graph for this function:

◆ withEmbeddingDim()

template<typename Self>
decltype(auto) Mila::Dnn::LpeConfig::withEmbeddingDim ( this Self && self,
size_t embedding_dim )
inline

C++23-style fluent setter for embedding dimension.

◆ withMaxSequenceLength()

template<typename Self>
decltype(auto) Mila::Dnn::LpeConfig::withMaxSequenceLength ( this Self && self,
size_t max_seq_len )
inline

C++23-style fluent setter for maximum sequence length.

◆ withVocabularyLength()

template<typename Self>
decltype(auto) Mila::Dnn::LpeConfig::withVocabularyLength ( this Self && self,
size_t vocab_len )
inline

C++23-style fluent setter for vocabulary length.

Here is the caller graph for this function:

Member Data Documentation

◆ embedding_dim_

size_t Mila::Dnn::LpeConfig::embedding_dim_ = 0
private

The embedding dimension size.

◆ max_seq_len_

size_t Mila::Dnn::LpeConfig::max_seq_len_ = 512
private

The maximum sequence length.

◆ vocab_len_

size_t Mila::Dnn::LpeConfig::vocab_len_ = 50000
private

The vocabulary size.


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