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

Configuration class for Linear module. More...

Inheritance diagram for Mila::Dnn::LinearConfig:
Collaboration diagram for Mila::Dnn::LinearConfig:

Public Member Functions

 LinearConfig (size_t input_features, size_t output_features)
 Constructor with required parameters.
 
size_t getInputFeatures () const
 
size_t getOutputFeatures () const
 
bool hasBias () const
 
void validate () const
 Validate configuration parameters.
 
LinearConfigwithBias (bool has_bias)
 Configure whether the linear layer uses bias.
 
- 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

bool has_bias_ = true
 
size_t input_features_
 
size_t output_features_
 

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 Linear module.

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

Constructor & Destructor Documentation

◆ LinearConfig()

Mila::Dnn::LinearConfig::LinearConfig ( size_t  input_features,
size_t  output_features 
)
inline

Constructor with required parameters.

Parameters
input_featuresThe number of input features
output_featuresThe number of output features

Member Function Documentation

◆ getInputFeatures()

size_t Mila::Dnn::LinearConfig::getInputFeatures ( ) const
inline
Here is the caller graph for this function:

◆ getOutputFeatures()

size_t Mila::Dnn::LinearConfig::getOutputFeatures ( ) const
inline
Here is the caller graph for this function:

◆ hasBias()

bool Mila::Dnn::LinearConfig::hasBias ( ) const
inline
Here is the caller graph for this function:

◆ validate()

void Mila::Dnn::LinearConfig::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:
Here is the caller graph for this function:

◆ withBias()

LinearConfig & Mila::Dnn::LinearConfig::withBias ( bool  has_bias)
inline

Configure whether the linear layer uses bias.

Parameters
has_biasWhether to include bias term
Returns
LinearConfig& Reference to this for method chaining

Member Data Documentation

◆ has_bias_

bool Mila::Dnn::LinearConfig::has_bias_ = true
private

◆ input_features_

size_t Mila::Dnn::LinearConfig::input_features_
private

◆ output_features_

size_t Mila::Dnn::LinearConfig::output_features_
private

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