-
Notifications
You must be signed in to change notification settings - Fork 0
/
fc_layer_sl.h
executable file
·59 lines (46 loc) · 1.99 KB
/
fc_layer_sl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/******************************************************
*
* FEEDFORWARD LAYER WITH SILU ACTIVATION
* FUNCTION
*
******************************************************/
/*!
* \brief Feedforward layer with silu activation function.
*/
#ifndef FC_LAYER_SL_H
#define FC_LAYER_SL_H
//STD libs
#include<vector>
#include<omp.h>
//Eigen libs
#include"Eigen/Dense"
//Neural Network libs
#include"activation_functions.h"
#include"layer.h"
class fc_layer_sl : public layer
{
public:
//ctors
/**Default constructor. */
fc_layer_sl( ) : layer() { };
/**Initializes a feedforward layer with silu activation function given a matrix of weights and a vector of biases. */
fc_layer_sl(const std::vector<std::vector<double>> &weights_,const std::vector<double> &biases_);
/**Initializes a feedforward layer with silu activation function given a matrix of weights and a vector of biases. */
fc_layer_sl(const Eigen::MatrixXd &weights_,const std::vector<double> &biases_);
/**Initializes a feedforward layer with silu activation function given a matrix of weights and a vector of biases. */
fc_layer_sl(const Eigen::MatrixXd &weights_,const Eigen::VectorXd &biases_);
//dtor
/**Default deconstructor. */
~fc_layer_sl(){ };
//Computes the output of the layer given an input
/**Computes the output of the layer given an Eigen::VectorXd as input. */
Eigen::VectorXd predict(const Eigen::VectorXd & input) override;
/**Computes the outputs of the layer given a vector<Eigen::VectorXd> as input. */
std::vector<Eigen::VectorXd> predict_batch(const std::vector<Eigen::VectorXd> & input) override;
//Jacobians
/**Computes the Jacobian matrix with respect to the input variables. The Jacobian is computer in reduced form. */
Eigen::MatrixXd compute_partial_derivatives_wrt_inputs(Eigen::VectorXd &input) override;
/**Computes the Jacobian matrix with respect to weights and biases. */
Eigen::MatrixXd compute_partial_derivatives_wrt_weights_biases(Eigen::VectorXd &input) override;
};
#endif /* FC_LAYER_SL_H */