A class that implements a fully connected layer with batch normalization and ReLU activation, inheriting from MLFunction.
More...
|
| | FullyConnectWithBatchNormAndRelu (float *NNWeights, float *NNBias, float *NormWeights, float *NormBias, float eps, int numInput, int numOutput) |
| | Constructor that initializes the fully connected layer with weights, biases, and dimensions.
|
| |
| void | apply (const SelectivityVector &rows, std::vector< VectorPtr > &args, const TypePtr &type, exec::EvalCtx &context, VectorPtr &output) const override |
| | Applies the fully connected layer, batch normalization, and ReLU activation to the input array.
|
| |
| float * | getTensor () const override |
| | Returns the tensor associated with this function.
|
| |
| std::string | getWeightsFile () |
| | Returns the path to the weights file.
|
| |
| void | setWeights (float *weights) |
| | Sets the weights for the fully connected layer.
|
| |
|
virtual | ~MLFunction ()=default |
| | Virtual destructor.
|
| |
| virtual std::vector< int > | getDims () |
| | Returns the dimensions of the function.
|
| |
| virtual std::string | getFuncName () |
| | Returns the name of the function.
|
| |
| virtual int | getNumDims () |
| | Returns the number of dimensions of the function.
|
| |
| virtual CostEstimate | getCost (std::vector< int > inputDims) |
| | Estimates the computational cost of applying the function.
|
| |
|
| static std::vector< std::shared_ptr< exec::FunctionSignature > > | signatures () |
| | Returns the function signatures supported by this class.
|
| |
| static std::string | getName () |
| | Returns the name of the function.
|
| |
|
| double | getWeightedCost (std::string name, float cost) |
| | Calculates the weighted cost of the function.
|
| |
| std::vector< double > | getCoefficientVector (std::string name) |
| | Retrieves the cost coefficients for the function.
|
| |
|
std::vector< int > | dims |
| | Dimensions of the function.
|
| |
A class that implements a fully connected layer with batch normalization and ReLU activation, inheriting from MLFunction.
This class provides functionality to apply a fully connected layer, followed by batch normalization and ReLU activation, to an input array.
◆ FullyConnectWithBatchNormAndRelu()
| FullyConnectWithBatchNormAndRelu::FullyConnectWithBatchNormAndRelu |
( |
float * | NNWeights, |
|
|
float * | NNBias, |
|
|
float * | NormWeights, |
|
|
float * | NormBias, |
|
|
float | eps, |
|
|
int | numInput, |
|
|
int | numOutput ) |
|
inline |
Constructor that initializes the fully connected layer with weights, biases, and dimensions.
- Parameters
-
| NNWeights | A pointer to the weight matrix for the fully connected layer. |
| NNBias | A pointer to the bias vector for the fully connected layer. |
| NormWeights | A pointer to the weight matrix for batch normalization. |
| NormBias | A pointer to the bias vector for batch normalization. |
| eps | A small value added to the variance to avoid division by zero. |
| numInput | The number of input features. |
| numOutput | The number of output features. |
◆ apply()
| void FullyConnectWithBatchNormAndRelu::apply |
( |
const SelectivityVector & | rows, |
|
|
std::vector< VectorPtr > & | args, |
|
|
const TypePtr & | type, |
|
|
exec::EvalCtx & | context, |
|
|
VectorPtr & | output ) const |
|
inlineoverride |
Applies the fully connected layer, batch normalization, and ReLU activation to the input array.
This method processes the input array, applies the fully connected layer, batch normalization, and ReLU activation, and stores the result in the output vector.
- Parameters
-
| rows | A SelectivityVector specifying the rows to process. |
| args | A vector of input arguments (e.g., the input array). |
| type | The type of the output vector. |
| context | The execution context. |
| output | The output vector where the result will be stored. |
◆ getName()
| static std::string FullyConnectWithBatchNormAndRelu::getName |
( |
| ) |
|
|
inlinestatic |
Returns the name of the function.
- Returns
- The name of the function as a string ("fully_layer_with_batch_norm").
◆ getTensor()
| float * FullyConnectWithBatchNormAndRelu::getTensor |
( |
| ) |
const |
|
inlineoverridevirtual |
Returns the tensor associated with this function.
- Returns
- A pointer to the weight matrix for the fully connected layer.
Implements MLFunction.
◆ getWeightsFile()
| std::string FullyConnectWithBatchNormAndRelu::getWeightsFile |
( |
| ) |
|
|
inline |
Returns the path to the weights file.
- Returns
- The path to the weights file as a string.
◆ setWeights()
| void FullyConnectWithBatchNormAndRelu::setWeights |
( |
float * | weights | ) |
|
|
inline |
Sets the weights for the fully connected layer.
- Parameters
-
| weights | A pointer to the new weight matrix. |
◆ signatures()
| static std::vector< std::shared_ptr< exec::FunctionSignature > > FullyConnectWithBatchNormAndRelu::signatures |
( |
| ) |
|
|
inlinestatic |
Returns the function signatures supported by this class.
- Returns
- A vector of shared pointers to FunctionSignature objects.
The documentation for this class was generated from the following file: