-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLSTM.h
More file actions
61 lines (50 loc) · 1.31 KB
/
LSTM.h
File metadata and controls
61 lines (50 loc) · 1.31 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef LSTM_H_
#define LSTM_H_
#include <cstdlib>
#include <vector>
#include <cmath>
#include "Matrix.h"
class LSTM{
public:
LSTM(unsigned const inputSize, unsigned const hiddenSize);
void forwardPropogate(std::vector<Matrix> const &inputs);
void backwardPropogate(std::vector<Matrix> const &targets);
private:
unsigned inputSize;
unsigned hiddenSize;
std::vector<Matrix> a;
std::vector<Matrix> aGradient;
Matrix aInputWeights;
Matrix aRecurrentWeights;
Matrix aBiases;
std::vector<Matrix> i;
std::vector<Matrix> iGradient;
Matrix iInputWeights;
Matrix iRecurrentWeights;
Matrix iBiases;
std::vector<Matrix> f;
std::vector<Matrix> fGradient;
Matrix fInputWeights;
Matrix fRecurrentWeights;
Matrix fBiases;
std::vector<Matrix> o;
std::vector<Matrix> oGradient;
Matrix oInputWeights;
Matrix oRecurrentWeights;
Matrix oBiases;
std::vector<Matrix> in;
std::vector<Matrix> inGradient;
std::vector<Matrix> state;
std::vector<Matrix> stateGradient;
std::vector<Matrix> out;
std::vector<Matrix> outGradient;
std::vector<Matrix> outDelta;
};
double randomWeight();
double inputActivationFunction(double x);
double inputGateFunction(double x);
double forgetGateFunction(double x);
double outputGateFunction(double x);
double outputActivationFunction(double x);
double stateActivationFunction(double x);
#endif