Collective Variables Module - Developer Documentation
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
neuralnetworkCV::denseLayer Class Reference

Public Member Functions

 denseLayer ()
 empty constructor
 
 denseLayer (const std::string &weights_file, const std::string &biases_file, const std::function< double(double)> &f, const std::function< double(double)> &df)
 
void readFromFile (const std::string &weights_file, const std::string &biases_file)
 read data from file
 
void setActivationFunction (const std::function< double(double)> &f, const std::function< double(double)> &df)
 setup activation function
 
void compute (const std::vector< double > &input, std::vector< double > &output) const
 compute the value of this layer
 
double computeGradientElement (const std::vector< double > &input, const size_t i, const size_t j) const
 compute the gradient of i-th output wrt j-th input
 
void computeGradient (const std::vector< double > &input, std::vector< std::vector< double > > &output_grad) const
 output[i][j] is the gradient of i-th output wrt j-th input
 
size_t getInputSize () const
 get the input size
 
size_t getOutputSize () const
 get the output size
 
double getWeight (size_t i, size_t j) const
 getter for weights and biases
 
double getBias (size_t i) const
 

Private Attributes

size_t m_input_size
 
size_t m_output_size
 
std::function< double(double)> m_activation_function
 
std::function< double(double)> m_activation_function_derivative
 
std::vector< std::vector< double > > m_weights
 weights[i][j] is the weight of the i-th output and the j-th input
 
std::vector< double > m_biases
 bias of each node
 

Static Private Attributes

static const bool m_use_custom_activation = false
 

Constructor & Destructor Documentation

◆ denseLayer()

neuralnetworkCV::denseLayer::denseLayer ( const std::string &  weights_file,
const std::string &  biases_file,
const std::function< double(double)> &  f,
const std::function< double(double)> &  df 
)
Parameters
[in]weights_filefilename of the weights file
[in]biases_filefilename of the biases file
[in]factivation function
[in]dfderivative of the activation function

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