-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMLP.cuh
80 lines (55 loc) · 1.81 KB
/
MLP.cuh
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
62
63
64
65
66
67
#pragma once
#include "MLP.h"
using namespace std;
class MultiLayerParatron : public MultiLayerPerceptron{
public:
MultiLayerParatron(vector<int> cells_in_layer, loss_function func, double bias = 1.0, double eta = 0.5, double momentum=.4, int batchSize = 0);
void addLayer(int CIL, activation_function func);
void finalize();
void cleanerRun(double* d_x);
vector<double> getRun(double* d_x);
void batchRun(double* d_batchX);
vector<vector<double>> getBatchRun(double* d_batchX);
void getLoss(double* x, double* y);
void bLoss(double* x, double* y);
double cleanerbp(double* x, double* y);
vector<vector<double>> getCleanerBp(double* x, double* y);
double batchP(double* batchX, double* batchY);
vector<vector<double>> getBatchP(double* batchX, double* batchY);
double aveBatchP(double* batchX, double* batchY);
vector<vector<double>> getAveP(double* batchX, double* batchY);
int* d_CIL;
double* d_outputs;
double** d_outputs_href;
double** d_batch_outs_href;
int* outputLayerOffsets;
int* d_outputLayerOffsets;
double* d_weights;
double** d_weights_href;
double** d_gradient_href;
double** d_batch_grad_href;
int* d_weightLayerOffsets;
int* weightLayerOffsets;
double* d_error_terms;
double** d_error_terms_href;
double** d_batch_errors_href;
activation_function* d_A_Fs;
loss_function* d_L_F; //I think pointer to pass to GPU
double* d_loss;
double* d_eta;
vector<vector<double>> batch_out;
vector<vector<double>> batch_err;
vector<vector<double>> batch_gradient;
vector<vector<vector<double>>> h_weights;
vector<vector<int>> weight_lengths;
int batchSize;
int termSize;
int outputSize;
vector<activation_function> h_A_Fs;
//vector<int> cells_in_layer;
//double bias;
//double eta;
//loss_function L_F;
//vector<vector<double> > outputs;
//vector<vector<double> > error_terms;
};