2022-07-05 08:13:25 +02:00
|
|
|
#ifndef DEF_STRUCT_H
|
|
|
|
#define DEF_STRUCT_H
|
|
|
|
|
|
|
|
typedef struct Kernel_cnn {
|
2023-02-19 13:54:00 +01:00
|
|
|
// Noyau ayant une couche matricielle en sortie
|
2022-11-01 10:10:43 +01:00
|
|
|
int k_size; // k_size = dim_input - dim_output + 1
|
2023-02-19 13:54:00 +01:00
|
|
|
int rows; // Depth de l'input
|
|
|
|
int columns; // Depth de l'output
|
2022-11-01 10:10:43 +01:00
|
|
|
float*** bias; // bias[columns][dim_output][dim_output]
|
|
|
|
float*** d_bias; // d_bias[columns][dim_output][dim_output]
|
2023-02-19 13:38:33 +01:00
|
|
|
float**** weights; // weights[rows][columns][k_size][k_size]
|
|
|
|
float**** d_weights; // d_weights[rows][columns][k_size][k_size]
|
2022-07-05 08:13:25 +02:00
|
|
|
} Kernel_cnn;
|
|
|
|
|
|
|
|
typedef struct Kernel_nn {
|
2023-02-19 13:54:00 +01:00
|
|
|
// Noyau ayant une couche vectorielle en sortie
|
2023-02-19 12:50:27 +01:00
|
|
|
int size_input; // Nombre d'éléments en entrée
|
2023-02-19 12:53:08 +01:00
|
|
|
int size_output; // Nombre d'éléments en sortie
|
|
|
|
float* bias; // bias[size_output]
|
|
|
|
float* d_bias; // d_bias[size_output]
|
|
|
|
float** weights; // weight[size_input][size_output]
|
|
|
|
float** d_weights; // d_weights[size_input][size_output]
|
2022-07-05 08:13:25 +02:00
|
|
|
} Kernel_nn;
|
|
|
|
|
|
|
|
typedef struct Kernel {
|
2022-09-16 14:36:50 +02:00
|
|
|
Kernel_cnn* cnn; // NULL si ce n'est pas un cnn
|
|
|
|
Kernel_nn* nn; // NULL si ce n'est pas un nn
|
2023-02-19 13:54:00 +01:00
|
|
|
int activation; // Id de la fonction d'activation et -Id de sa dérivée
|
|
|
|
int linearisation; // 1 si c'est la linéarisation d'une couche, 0 sinon
|
2023-01-30 09:39:45 +01:00
|
|
|
int pooling; // 0 si pas pooling, 1 si average_pooling, 2 si max_pooling
|
2022-07-05 08:13:25 +02:00
|
|
|
} Kernel;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct Network{
|
2023-02-19 13:54:00 +01:00
|
|
|
int dropout; // Probabilité d'abandon d'un neurone dans [0, 100] (entiers)
|
2022-11-15 18:15:18 +01:00
|
|
|
float learning_rate; // Taux d'apprentissage du réseau
|
2023-02-19 13:54:00 +01:00
|
|
|
int initialisation; // Id du type d'initialisation
|
2022-09-16 14:36:50 +02:00
|
|
|
int max_size; // Taille du tableau contenant le réseau
|
|
|
|
int size; // Taille actuelle du réseau (size ≤ max_size)
|
|
|
|
int* width; // width[size]
|
|
|
|
int* depth; // depth[size]
|
2022-10-05 11:20:26 +02:00
|
|
|
Kernel** kernel; // kernel[size], contient tous les kernels
|
2023-02-19 13:54:00 +01:00
|
|
|
float**** input_z; // Tableau de toutes les couches du réseau input_z[size][couche->depth][couche->width][couche->width]
|
|
|
|
float**** input; // input[i] = f(input_z[i]) où f est la fonction d'activation de la couche i
|
2022-07-05 08:13:25 +02:00
|
|
|
} Network;
|
|
|
|
|
|
|
|
#endif
|