-
Notifications
You must be signed in to change notification settings - Fork 0
/
fc_layer.hpp
33 lines (28 loc) · 973 Bytes
/
fc_layer.hpp
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
#ifndef CPPCNN_FC_LAYER_H_
#define CPPCNN_FC_LAYER_H_
#include <array2d.hpp>
#include <sigmoid.hpp>
using namespace std;
namespace cppcnn{
class FCLayer
{
private:
Sigmoid fun;
public:
Array2d W;
uint num_in, num_out;
FCLayer(uint _num_in, uint _num_out);
void initialize();
vector<double> forward(const vector<double>& inputs) const;
vector<double> compute(const vector<double>& inputs) const;
vector<double> activate(const vector<double>& z) const;
vector<double> get_layer_err(const vector<double>& z,
const vector<double>& backwrd_err) const;
vector<double> backward(const vector<double>& delta) const;
void update(const vector<double>& delta, const vector<double>& z,
double lr);
vector<double> get_learnable_parameters() const;
void set_learnable_parameters(vector<double> learnable_parameters);
}; //FCLayer
} // namespace
#endif // CPPCNN_FC_LAYER_H_