-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLayer.h
More file actions
44 lines (37 loc) · 1.13 KB
/
Copy pathLayer.h
File metadata and controls
44 lines (37 loc) · 1.13 KB
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
#ifndef Layer_h
#define Layer_h
#include "string.h"
#include "stdlib.h"
class Layer
{
public:
int inputs;
int outputs;
float * _biases;
float * _weights;
~Layer();
Layer()
{
output_arr = 0;
_biases = 0;
_weights = 0;
}
//return a pointer to the array of activations
//this pointer is only good until the next time someone tries to activate the network
//so copy the data if needed elsewhere
float * activate(float * input_arr);
//weights should be inputs cols, outputs rows
Layer(int layer_inputs, int layer_outputs, float ** weights, float * biases);
//This contructor assumes weights is stored contingously in row-major order
Layer(int layer_inputs, int layer_outputs, float * weights, float * biases);
void init_unitialized(int layer_inputs, int layer_outputs);
void setBiases(float * biases);
void setParams(float ** weights, float * biases);
void weightsFromRotated(float * rotWeights);
void printRotatedWeights();
virtual float activation_func(float out);
private:
// this is so that we don't have to malloc space to store the output array each time
float * output_arr;
};
#endif