mirror of
https://github.com/augustin64/projet-tipe
synced 2025-02-02 19:39:39 +01:00
Update tests
This commit is contained in:
parent
11002758f6
commit
afb0e7b068
@ -48,5 +48,5 @@ int main() {
|
|||||||
read_test(nb_images, width, height, images, labels);
|
read_test(nb_images, width, height, images, labels);
|
||||||
|
|
||||||
printf("OK\n");
|
printf("OK\n");
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
@ -9,20 +9,20 @@
|
|||||||
int main() {
|
int main() {
|
||||||
printf("Création du réseau\n");
|
printf("Création du réseau\n");
|
||||||
|
|
||||||
Network* network_neuronal = malloc(sizeof(Network));
|
Network* network = (Network*)malloc(sizeof(Network));
|
||||||
int tab[5] = {30, 25, 20, 15, 10};
|
int tab[5] = {30, 25, 20, 15, 10};
|
||||||
network_creation(network_neuronal, tab, 5);
|
network_creation(network, tab, 5);
|
||||||
|
|
||||||
printf("OK\n");
|
printf("OK\n");
|
||||||
printf("Initialisation du réseau\n");
|
printf("Initialisation du réseau\n");
|
||||||
|
|
||||||
network_initialisation(network_neuronal);
|
network_initialisation(network);
|
||||||
|
|
||||||
printf("OK\n");
|
printf("OK\n");
|
||||||
printf("Enregistrement du réseau\n");
|
printf("Enregistrement du réseau\n");
|
||||||
|
|
||||||
write_network(".test-cache/random_network.bin", network_neuronal);
|
write_network(".test-cache/random_network.bin", network);
|
||||||
|
|
||||||
printf("OK\n");
|
printf("OK\n");
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
@ -7,10 +7,10 @@
|
|||||||
|
|
||||||
|
|
||||||
Neuron* creer_neuron(int nb_sortants) {
|
Neuron* creer_neuron(int nb_sortants) {
|
||||||
Neuron* neuron = malloc(2*sizeof(float*)+6*sizeof(float));
|
Neuron* neuron = (Neuron*)malloc(sizeof(Neuron));
|
||||||
neuron->weights = malloc(sizeof(float)*nb_sortants);
|
neuron->weights = (float*)malloc(sizeof(float)*nb_sortants);
|
||||||
neuron->back_weights = malloc(sizeof(float)*nb_sortants);
|
neuron->back_weights = (float*)malloc(sizeof(float)*nb_sortants);
|
||||||
neuron->last_back_weights = malloc(sizeof(float)*nb_sortants);
|
neuron->last_back_weights = (float*)malloc(sizeof(float)*nb_sortants);
|
||||||
|
|
||||||
for (int i=0; i < nb_sortants; i++) {
|
for (int i=0; i < nb_sortants; i++) {
|
||||||
neuron->weights[i] = 0.5;
|
neuron->weights[i] = 0.5;
|
||||||
@ -27,8 +27,8 @@ Neuron* creer_neuron(int nb_sortants) {
|
|||||||
|
|
||||||
|
|
||||||
Layer* creer_layer(int nb_neurons, int nb_sortants) {
|
Layer* creer_layer(int nb_neurons, int nb_sortants) {
|
||||||
Layer* layer = malloc(sizeof(int)+sizeof(Neuron**));
|
Layer* layer = (Layer*)malloc(sizeof(Layer));
|
||||||
Neuron** tab = malloc(sizeof(Neuron*)*nb_neurons);
|
Neuron** tab = (Neuron**)malloc(sizeof(Neuron*)*nb_neurons);
|
||||||
|
|
||||||
layer->nb_neurons = nb_neurons;
|
layer->nb_neurons = nb_neurons;
|
||||||
layer->neurons = tab;
|
layer->neurons = tab;
|
||||||
@ -41,8 +41,8 @@ Layer* creer_layer(int nb_neurons, int nb_sortants) {
|
|||||||
|
|
||||||
|
|
||||||
Network* create_network(int nb_layers, int nb_max_neurons, int nb_min_neurons) {
|
Network* create_network(int nb_layers, int nb_max_neurons, int nb_min_neurons) {
|
||||||
Network* network = malloc(sizeof(int)+sizeof(Layer**));
|
Network* network = (Network*)malloc(sizeof(Network));
|
||||||
network->layers = malloc(sizeof(Layer*)*nb_layers);
|
network->layers = (Layer**)malloc(sizeof(Layer*)*nb_layers);
|
||||||
int nb_neurons[nb_layers+1];
|
int nb_neurons[nb_layers+1];
|
||||||
|
|
||||||
network->nb_layers = nb_layers;
|
network->nb_layers = nb_layers;
|
||||||
@ -62,5 +62,5 @@ int main() {
|
|||||||
Network* network = create_network(5, 300, 10);
|
Network* network = create_network(5, 300, 10);
|
||||||
write_network(".test-cache/neuron_io.bin", network);
|
write_network(".test-cache/neuron_io.bin", network);
|
||||||
Network* network2 = read_network(".test-cache/neuron_io.bin");
|
Network* network2 = read_network(".test-cache/neuron_io.bin");
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user