A class that implements a 2-level deep neural network using PyTorch, inheriting from MLFunction.
More...
#include <functions.h>
|
| | TorchDNN2Level (float **weights, float **bias, std::vector< int > dimensions) |
| | Constructor that initializes the neural network with weights and biases.
|
| |
| void | apply (const SelectivityVector &rows, std::vector< VectorPtr > &args, const TypePtr &type, exec::EvalCtx &context, VectorPtr &output) const override |
| | Applies the 2-level neural network to the input array.
|
| |
| float * | getTensor () const override |
| | Returns the tensor associated with this function.
|
| |
| float ** | getWeights () const |
| | Returns the weights of the neural network.
|
| |
| float ** | getBias () const |
| | Returns the biases of the neural network.
|
| |
| std::string | getFuncName () |
| | Returns the name of the function.
|
| |
| CostEstimate | getCost (std::vector< int > inputDims) |
| | Estimates the computational cost of applying the neural network.
|
| |
|
virtual | ~MLFunction ()=default |
| | Virtual destructor.
|
| |
| virtual std::vector< int > | getDims () |
| | Returns the dimensions of the function.
|
| |
| virtual int | getNumDims () |
| | Returns the number of dimensions of the function.
|
| |
|
| static std::vector< std::shared_ptr< exec::FunctionSignature > > | signatures () |
| | Returns the function signatures supported by this class.
|
| |
| static std::string | getName () |
| | Static method to return 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 2-level deep neural network using PyTorch, inheriting from MLFunction.
This class provides functionality to apply a 2-level dense neural network with ReLU activation and softmax output.
◆ TorchDNN2Level()
| TorchDNN2Level::TorchDNN2Level |
( |
float ** | weights, |
|
|
float ** | bias, |
|
|
std::vector< int > | dimensions ) |
|
inline |
Constructor that initializes the neural network with weights and biases.
- Parameters
-
| weights | A pointer to an array of pointers to weight matrices. |
| bias | A pointer to an array of pointers to bias vectors. |
| dimensions | A vector containing the dimensions of the neural network layers. |
◆ apply()
| void TorchDNN2Level::apply |
( |
const SelectivityVector & | rows, |
|
|
std::vector< VectorPtr > & | args, |
|
|
const TypePtr & | type, |
|
|
exec::EvalCtx & | context, |
|
|
VectorPtr & | output ) const |
|
inlineoverride |
Applies the 2-level neural network to the input array.
This method processes the input array, applies the neural network, 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. |
◆ getBias()
| float ** TorchDNN2Level::getBias |
( |
| ) |
const |
|
inline |
Returns the biases of the neural network.
- Returns
- A pointer to an array of pointers to bias vectors.
◆ getCost()
| CostEstimate TorchDNN2Level::getCost |
( |
std::vector< int > | inputDims | ) |
|
|
inlinevirtual |
Estimates the computational cost of applying the neural network.
- Parameters
-
| inputDims | A vector containing the dimensions of the input. |
- Returns
- A CostEstimate object representing the estimated cost.
Reimplemented from MLFunction.
◆ getFuncName()
| std::string TorchDNN2Level::getFuncName |
( |
| ) |
|
|
inlinevirtual |
Returns the name of the function.
- Returns
- The name of the function as a string.
Reimplemented from MLFunction.
◆ getName()
| static std::string TorchDNN2Level::getName |
( |
| ) |
|
|
inlinestatic |
Static method to return the name of the function.
- Returns
- The name of the function as a string ("torch_dnn").
◆ getTensor()
| float * TorchDNN2Level::getTensor |
( |
| ) |
const |
|
inlineoverridevirtual |
Returns the tensor associated with this function.
- Returns
- A pointer to an empty float array (no weights for TorchDNN2Level).
Implements MLFunction.
◆ getWeights()
| float ** TorchDNN2Level::getWeights |
( |
| ) |
const |
|
inline |
Returns the weights of the neural network.
- Returns
- A pointer to an array of pointers to weight matrices.
◆ signatures()
| static std::vector< std::shared_ptr< exec::FunctionSignature > > TorchDNN2Level::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: