-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
45 lines (38 loc) · 905 Bytes
/
main.c
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
#include "network/layer.h"
#include "network/method.h"
#include <stdio.h>
void prints(layer *l1, layer *l2) {
lprint(l1, true);
printf("\n");
lprint(l2, true);
printf("\n");
}
int main(void) {
const unsigned int EPOCHS = 100;
// XOR table
double inputs[4][2] = {
{0.0, 0.0},
{0.0, 1.0},
{1.0, 0},
{1.0, 1.0}
};
double outputs[4] = {0.0, 1.0, 1.0, 0.0};
// Creating layers
layer l = create_layer(2, 1);
layer l2 = create_layer(1, 1);
// Input
feed(&l, inputs[1]);
printf("================== INPUT ==================\n");
prints(&l,&l2);
// Activate the layer
activate(&l);
printf("================== ACTIV ==================\n");
prints(&l,&l2);
//Feed forward
feedforward(&l,&l2);
printf("================== FEEDF ==================\n");
prints(&l,&l2);
double out = sum(&l2, 0);
printf("OUTPUT: %lf", out);
return 0;
}