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

Configuration class for Encoder module. More...

Inheritance diagram for Mila::Dnn::EncoderConfig:
Collaboration diagram for Mila::Dnn::EncoderConfig:

Public Member Functions

 EncoderConfig ()=default
 Default constructor.
 
size_t getChannels () 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.
 
void validate () const
 Validate configuration parameters.
 
EncoderConfigwithChannels (size_t channels)
 Set the embedding dimension.
 
EncoderConfigwithMaxSequenceLength (size_t max_seq_len)
 Set the maximum sequence length.
 
EncoderConfigwithVocabularyLength (size_t vocab_len)
 Set the vocabulary length.
 
- Public Member Functions inherited from Mila::Dnn::ComponentConfig
virtual ~ComponentConfig ()=default
 Virtual destructor to support proper polymorphic destruction.
 
const std::string & getName () const
 Gets the configured component name.
 
ComputePrecision::Policy getPrecision () const
 Gets the configured precision policy.
 
bool isTraining () const
 Gets the configured training mode.
 
template<typename Self >
auto & withName (this Self &&self, std::string name)
 Sets the name of the component with fluent interface.
 
template<typename Self >
auto & withPrecision (this Self &&self, ComputePrecision::Policy policy)
 Sets the compute precision policy with fluent interface.
 
template<typename Self >
auto & withTraining (this Self &&self, bool is_training)
 Sets the training mode with fluent interface.
 

Private Attributes

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

Additional Inherited Members

- Protected Attributes inherited from Mila::Dnn::ComponentConfig
bool is_training_ = false
 Training mode flag, defaults to false (inference mode)
 
std::string name_ = "unnamed"
 Component name, defaults to "unnamed" if not explicitly set.
 
ComputePrecision::Policy precision_ = ComputePrecision::Policy::Auto
 Precision policy for computation, defaults to Auto.
 

Detailed Description

Configuration class for Encoder module.

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

Constructor & Destructor Documentation

◆ EncoderConfig()

Mila::Dnn::EncoderConfig::EncoderConfig ( )
default

Default constructor.

Member Function Documentation

◆ getChannels()

size_t Mila::Dnn::EncoderConfig::getChannels ( ) const
inline

Get the configured embedding dimension.

Returns
size_t The embedding dimension

◆ getMaxSequenceLength()

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

Get the configured maximum sequence length.

Returns
size_t The maximum sequence length

◆ getVocabularyLength()

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

Get the configured vocabulary length.

Returns
size_t The vocabulary length

◆ validate()

void Mila::Dnn::EncoderConfig::validate ( ) const
inlinevirtual

Validate configuration parameters.

Exceptions
std::invalid_argumentIf validation fails

Reimplemented from Mila::Dnn::ComponentConfig.

Here is the call graph for this function:

◆ withChannels()

EncoderConfig & Mila::Dnn::EncoderConfig::withChannels ( size_t  channels)
inline

Set the embedding dimension.

Parameters
channelsThe embedding dimension size
Returns
EncoderConfig& Reference to this for method chaining

◆ withMaxSequenceLength()

EncoderConfig & Mila::Dnn::EncoderConfig::withMaxSequenceLength ( size_t  max_seq_len)
inline

Set the maximum sequence length.

Parameters
max_seq_lenMaximum sequence length
Returns
EncoderConfig& Reference to this for method chaining

◆ withVocabularyLength()

EncoderConfig & Mila::Dnn::EncoderConfig::withVocabularyLength ( size_t  vocab_len)
inline

Set the vocabulary length.

Parameters
vocab_lenSize of the vocabulary
Returns
EncoderConfig& Reference to this for method chaining

Member Data Documentation

◆ channels_

size_t Mila::Dnn::EncoderConfig::channels_ = 0
private

The embedding dimension size.

◆ max_seq_len_

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

The maximum sequence length.

◆ vocab_len_

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

The vocabulary size.


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