-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMLP.h
38 lines (28 loc) · 906 Bytes
/
MLP.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
#ifndef MLP_H
#define MLP_H
#include <vector>
#include <memory>
#include "Value.h"
class Neuron {
public:
std::vector<std::shared_ptr<Value>> weights;
std::shared_ptr<Value> bias;
std::shared_ptr<Value> out;
Neuron(int inp_size);
std::shared_ptr<Value> operator()(const std::vector<std::shared_ptr<Value>>& inputs);
};
class Layer {
public:
std::vector<std::shared_ptr<Neuron>> neurons;
Layer(int inp_size, int num_neurons);
std::vector<std::shared_ptr<Value>> operator()(const std::vector<std::shared_ptr<Value>>& inputs);
};
// void printLayerDetails(Layer& layer);
class MLP {
public:
std::vector<std::shared_ptr<Layer>> mlp_layers;
MLP(int inp_size, std::vector<int> layer_sizes);
std::vector<std::shared_ptr<Value>> operator()(const std::vector<std::shared_ptr<Value>>& inputs);
std::vector<std::shared_ptr<Value>> get_all_params();
};
#endif