-
Notifications
You must be signed in to change notification settings - Fork 0
/
visual.c
86 lines (79 loc) · 2.58 KB
/
visual.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include "visual.h"
void menu(int opt){
switch(opt){
case 1:
printf("--------------------\nSTEP 1 - Design Model\n--------------------\n");
break;
case 2:
printf("\n--------------------\nSTEP 2 - Input Weights\n--------------------\n");
break;
case 3:
printf("\n--------------------\nSTEP 3 - Operations Weights\n--------------------\n");
break;
case 4:
printf("\n--------------------\nSTEP 4 - Output\n--------------------\n");
break;
}
return;
}
int printmodelopt(){
int choice;
printf("1 - Fully Connected Model.");
printf("\n2 - Convolutional Network.");
printf("\n3 - TBD.");
printf("\n4 - TBD.");
printf("\n5 - TBD.");
printf("\nSelect one of the templates: ");fflush(stdin);scanf("%i", &choice);
return choice;
}
void showWeights(char *str, int wchoice, int w1count, int MTAM, double *w1, double **w2){
char opt;
printf("\nWould you like to see the input weights generated %s (Y/N) - ", str);fflush(stdin);scanf("%c", &opt);
if(opt=='Y'||opt=='y'){
if(wchoice==2) {
printf("\n\n--------------------");
int memsize = MTAM*MTAM;
for(int i=0; i<w1count; i++){
printf("\nw%i:\n", i);
for(int j=0;j<memsize;++j){
printf("%f ", w2[i][j]);
if(j!=0 && (j+1)%MTAM==0)
printf("\n");
}
printf("--------------------");
}
}
else{
printf("\n\n--------------------");
for(int i=0;i<w1count;++i){
printf("\nw%i: %f",i,*(w1+i));
printf("\n--------------------");
}
printf("\n\n");
}
}
}
void showNeurons(int layercount, layer *layers){
char opt;
printf("Would you like to see all the Neurons in the model ?(Y/N): ");fflush(stdin);scanf("%c", &opt);
if(opt=='Y' || opt=='y'){
for(int i=0;i<layercount;++i){
for(int j=0;j<(layers+i)->tamneurons;++j)
printf("\nNeuron %i-%i: %f",i,j,layers[i].neurons[j].value);
printf("\n\n");
}
}
}
void showOutput(layer outputLayer){
for(int i=0;i<outputLayer.tamneurons;++i){
printf("\nOutput neuron %i: %f", i, outputLayer.neurons[i].value);
}
}
void PrintArray(double *arr, int WSize){
for(int i=0;i<(WSize*WSize);++i){
printf("%f ", *(arr+i));
if(i!=0 && (i+1)%WSize==0)
printf("\n");
}
printf("\n\n");
}