tipe/test/cnn_utils.c

41 lines
1.3 KiB
C
Raw Normal View History

2022-10-05 11:20:26 +02:00
#include <stdlib.h>
#include <stdio.h>
2023-05-12 16:16:34 +02:00
#include "../src/common/include/colors.h"
2022-10-24 12:54:51 +02:00
#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-10-05 11:20:26 +02:00
int main() {
printf("Création du réseau\n");
Network* network = create_network_lenet5(0, 0, 3, 2, 32, 1);
2023-02-01 21:15:54 +01:00
Network* network2 = create_network_lenet5(0, 0, 3, 2, 32, 1);
printf(GREEN "OK\n" RESET);
2022-10-05 11:20:26 +02:00
2023-02-01 21:15:54 +01:00
printf("Copie du réseau via copy_network\n");
2022-10-05 11:20:26 +02:00
Network* network_cp = copy_network(network);
printf(GREEN "OK\n" RESET);
2022-10-05 11:20:26 +02:00
printf("Vérification de l'égalité des réseaux\n");
if (! equals_networks(network, network_cp)) {
printf_error(RED "Les deux réseaux obtenus ne sont pas égaux.\n" RESET);
2022-10-05 11:20:26 +02:00
exit(1);
}
printf(GREEN "OK\n" RESET);
2022-10-05 11:20:26 +02:00
2023-02-01 21:15:54 +01:00
printf("Copie du réseau via copy_network_parameters\n");
copy_network_parameters(network, network2);
printf(GREEN "OK\n" RESET);
printf("Vérification de l'égalité des réseaux\n");
if (! equals_networks(network, network2)) {
printf_error(RED "Les deux réseaux obtenus ne sont pas égaux.\n" RESET);
exit(1);
}
printf(GREEN "OK\n" RESET);
2022-11-23 10:41:19 +01:00
free_network(network_cp);
2023-02-01 21:15:54 +01:00
free_network(network2);
2022-11-23 10:41:19 +01:00
free_network(network);
2022-10-05 11:20:26 +02:00
return 0;
}