tipe/src/cnn/include/struct.h

44 lines
1.8 KiB
C
Raw Normal View History

2022-07-05 08:13:25 +02:00
#ifndef DEF_STRUCT_H
#define DEF_STRUCT_H
typedef struct Kernel_cnn {
2022-11-01 10:10:43 +01:00
int k_size; // k_size = dim_input - dim_output + 1
2022-09-16 14:36:50 +02:00
int rows; // Depth of the input
int columns; // Depth of the 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]
2022-09-16 14:36:50 +02:00
float**** w; // w[rows][columns][k_size][k_size]
2022-10-08 14:13:02 +02:00
float**** d_w; // d_w[rows][columns][k_size][k_size]
2022-07-05 08:13:25 +02:00
} Kernel_cnn;
typedef struct Kernel_nn {
2022-09-12 17:56:44 +02:00
int input_units; // Nombre d'éléments en entrée
2022-09-16 14:36:50 +02:00
int output_units; // Nombre d'éléments en sortie
float* bias; // bias[output_units]
float* d_bias; // d_bias[output_units]
float** weights; // weight[input_units][output_units]
float** d_weights; // d_weights[input_units][output_units]
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
2022-11-12 14:20:13 +01:00
int activation; // Vaut l'identifiant de la fonction d'activation
2023-01-11 12:09:41 +01:00
int linearisation; // Vaut 1 si c'est la linéarisation d'une couche, 0 sinon
2022-07-05 08:13:25 +02:00
} Kernel;
typedef struct Network{
2022-09-16 14:36:50 +02:00
int dropout; // Contient la 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
2022-07-05 08:13:25 +02:00
int initialisation; // Contient le 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
float**** input; // Tableau de toutes les couches du réseau input[size][couche->depth][couche->width][couche->width]
2022-10-31 20:08:42 +01:00
float**** input_z; // Même tableau que input mais ne contient paas la dernière fonction d'activation à chaque ligne
2022-07-05 08:13:25 +02:00
} Network;
#endif