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

Configuration for the TokenEmbedding component. More...

Inheritance diagram for Mila::Dnn::TokenEmbeddingConfig:
Collaboration diagram for Mila::Dnn::TokenEmbeddingConfig:

Public Member Functions

void fromMetadata (const SerializationMetadata &meta)
 Populate configuration from provided metadata.
size_t getEmbeddingDim () const
size_t getVocabSize () const
SerializationMetadata toMetadata () const
 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 parameters.
template<typename Self>
decltype(auto) withEmbeddingDim (this Self &&self, size_t embedding_dim)
template<typename Self>
decltype(auto) withVocabSize (this Self &&self, size_t vocab_size)
Public Member Functions inherited from Mila::Dnn::ComponentConfig
virtual ~ComponentConfig ()=default
 Virtual destructor for polymorphic base.

Private Attributes

size_t embedding_dim_ { 0 }
size_t vocab_size_ { 0 }

Detailed Description

Configuration for the TokenEmbedding component.

Provides a type-safe fluent interface for configuring a pure token embedding lookup. Positional fields are intentionally absent — they belong to the model or attention configuration.

Member Function Documentation

◆ fromMetadata()

void Mila::Dnn::TokenEmbeddingConfig::fromMetadata ( const SerializationMetadata & meta)
inlinevirtual

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.

Here is the call graph for this function:

◆ getEmbeddingDim()

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

◆ getVocabSize()

size_t Mila::Dnn::TokenEmbeddingConfig::getVocabSize ( ) const
inline

◆ toMetadata()

SerializationMetadata Mila::Dnn::TokenEmbeddingConfig::toMetadata ( ) const
inlinevirtual

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.

Here is the call graph for this function:

◆ toString()

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

Validate configuration parameters.

Called by callers to ensure the configuration represents a valid, constructible component. Implementations must throw std::invalid_argument (or a derived exception) when validation fails.

Exceptions
std::invalid_argumentIf the configuration is invalid.

Implements Mila::Dnn::ComponentConfig.

◆ withEmbeddingDim()

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

◆ withVocabSize()

template<typename Self>
decltype(auto) Mila::Dnn::TokenEmbeddingConfig::withVocabSize ( this Self && self,
size_t vocab_size )
inline
Here is the caller graph for this function:

Member Data Documentation

◆ embedding_dim_

size_t Mila::Dnn::TokenEmbeddingConfig::embedding_dim_ { 0 }
private

◆ vocab_size_

size_t Mila::Dnn::TokenEmbeddingConfig::vocab_size_ { 0 }
private

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