2022-09-23 14:25:56 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
2022-10-24 12:54:51 +02:00
|
|
|
#include "../src/include/colors.h"
|
|
|
|
#include "../src/cnn/include/neuron_io.h"
|
|
|
|
#include "../src/cnn/include/creation.h"
|
|
|
|
#include "../src/cnn/include/utils.h"
|
2022-11-23 10:41:19 +01:00
|
|
|
#include "../src/cnn/include/free.h"
|
2022-11-11 11:20:30 +01:00
|
|
|
#include "../src/include/colors.h"
|
2022-09-23 14:25:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
printf("Création du réseau\n");
|
2022-10-03 10:04:11 +02:00
|
|
|
Network* network = create_network_lenet5(0, 0, 3, 2, 32, 1);
|
2022-11-11 11:20:30 +01:00
|
|
|
printf(GREEN "OK\n" RESET);
|
2022-09-23 14:25:56 +02:00
|
|
|
|
|
|
|
printf("Écriture du réseau\n");
|
2022-11-11 11:20:30 +01:00
|
|
|
write_network((char*)".test-cache/cnn_neuron_io.bin", network);
|
|
|
|
printf(GREEN "OK\n" RESET);
|
2022-09-23 14:25:56 +02:00
|
|
|
|
|
|
|
printf("Vérification de l'accès en lecture\n");
|
2022-11-11 11:20:30 +01:00
|
|
|
Network* network2 = read_network((char*)".test-cache/cnn_neuron_io.bin");
|
2023-01-13 22:19:06 +01:00
|
|
|
Network* network3 = read_network((char*)".test-cache/cnn_neuron_io.bin");
|
2022-11-11 11:20:30 +01:00
|
|
|
printf(GREEN "OK\n" RESET);
|
2022-09-25 11:52:36 +02:00
|
|
|
|
2022-09-28 10:20:08 +02:00
|
|
|
printf("Vérification de l'égalité des réseaux\n");
|
|
|
|
if (! equals_networks(network, network2)) {
|
2023-01-13 22:19:06 +01:00
|
|
|
printf_error(RED "Le réseau lu ne contient pas les mêmes données.\n" RESET);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
if (! equals_networks(network2, network3)) {
|
|
|
|
printf_error(RED "La lecture du réseau donne des résultats différents.\n" RESET);
|
2022-09-28 10:20:08 +02:00
|
|
|
exit(1);
|
|
|
|
}
|
2022-11-11 11:20:30 +01:00
|
|
|
printf(GREEN "OK\n" RESET);
|
2022-09-28 10:20:08 +02:00
|
|
|
|
2022-11-23 10:41:19 +01:00
|
|
|
printf("Libération de la mémoire\n");
|
|
|
|
free_network(network);
|
|
|
|
free_network(network2);
|
2023-01-13 22:19:06 +01:00
|
|
|
free_network(network3);
|
2022-11-23 10:41:19 +01:00
|
|
|
printf(GREEN "OK\n" RESET);
|
|
|
|
|
2022-09-23 14:25:56 +02:00
|
|
|
return 0;
|
|
|
|
}
|