|
Mila 0.13.48
Deep Neural Network Library
|
Configuration class for the Learned Positional Encoder. More...


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. | |
Configuration class for the Learned Positional Encoder.
Provides a type-safe fluent interface for configuring Encoder.
|
inlineoverridevirtual |
Populate configuration from serialization metadata.
Reads available fields from the provided metadata and updates the configuration object accordingly.
Implements Mila::Dnn::ComponentConfig.

|
inline |
Get the configured embedding dimension.
|
inline |
Get the configured maximum sequence length.
|
inline |
Get the configured vocabulary length.
|
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.

|
inlineoverridevirtual |
Produce a short, human-readable summary of this configuration.
Overrides ComponentConfig::toString() to include Encoder-specific fields.
Implements Mila::Dnn::ComponentConfig.
|
inlineoverridevirtual |
Validate configuration parameters.
| std::invalid_argument | If validation fails |
Implements Mila::Dnn::ComponentConfig.

|
inline |
C++23-style fluent setter for embedding dimension.
|
inline |
C++23-style fluent setter for maximum sequence length.
|
inline |
C++23-style fluent setter for vocabulary length.

|
private |
The embedding dimension size.
|
private |
The maximum sequence length.
|
private |
The vocabulary size.