2022-07-05 08:13:25 +02:00
|
|
|
#ifndef DEF_INITIALISATION_H
|
|
|
|
#define DEF_INITIALISATION_H
|
|
|
|
|
2023-01-13 15:58:26 +01:00
|
|
|
// Génère un flottant entre 0 et 1
|
2022-07-05 08:13:25 +02:00
|
|
|
#define RAND_FLT() ((float)rand())/((float)RAND_MAX)
|
2023-03-09 06:57:51 +01:00
|
|
|
#define TWOPI 6.2831853071795864769252867665
|
2022-07-05 08:13:25 +02:00
|
|
|
|
|
|
|
#define ZERO 0
|
2022-11-04 10:54:32 +01:00
|
|
|
#define GLOROT 1
|
2023-03-09 06:57:51 +01:00
|
|
|
#define XAVIER 1 // Xavier et Glorot initialisations sont indentiques
|
2023-03-09 14:27:23 +01:00
|
|
|
#define NORMALIZED_GLOROT 2
|
2023-03-09 06:57:51 +01:00
|
|
|
#define NORMALIZED_XAVIER 2
|
|
|
|
#define HE 3
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Renvoie un flottant à partir de la loi normale [x;y].
|
|
|
|
* La fonction repose sur la méthode de Box-Muller
|
|
|
|
*/
|
|
|
|
float randn();
|
2022-07-05 08:13:25 +02:00
|
|
|
|
|
|
|
/*
|
2022-11-04 10:54:32 +01:00
|
|
|
* Initialise une matrice 1d dim de float en fonction du type d'initialisation
|
2022-07-05 08:13:25 +02:00
|
|
|
*/
|
2023-03-09 06:57:51 +01:00
|
|
|
void initialisation_1d_matrix(int initialisation, float* matrix, int dim, int n_in, int n_out);
|
2022-07-05 08:13:25 +02:00
|
|
|
|
|
|
|
/*
|
2022-11-04 10:54:32 +01:00
|
|
|
* Initialise une matrice 2d dim1*dim2 de float en fonction du type d'initialisation
|
2022-07-05 08:13:25 +02:00
|
|
|
*/
|
2022-11-04 10:54:32 +01:00
|
|
|
void initialisation_2d_matrix(int initialisation, float** matrix, int dim1, int dim2, int n_in, int n_out);
|
2022-07-05 08:13:25 +02:00
|
|
|
|
|
|
|
/*
|
2022-11-04 10:54:32 +01:00
|
|
|
* Initialise une matrice 3d depth*dim1*dim2 de float en fonction du type d'initialisation
|
2022-07-05 08:13:25 +02:00
|
|
|
*/
|
2022-11-04 10:54:32 +01:00
|
|
|
void initialisation_3d_matrix(int initialisation, float*** matrix, int depth, int dim1, int dim2, int n_in, int n_out);
|
2022-07-05 08:13:25 +02:00
|
|
|
|
|
|
|
/*
|
2022-11-04 10:54:32 +01:00
|
|
|
* Initialise une matrice 4d depth1*depth2*dim1*dim2 de float en fonction du type d'initialisation
|
2022-07-05 08:13:25 +02:00
|
|
|
*/
|
2022-11-04 10:54:32 +01:00
|
|
|
void initialisation_4d_matrix(int initialisation, float**** matrix, int depth1, int depth2, int dim1, int dim2, int n_in, int n_out);
|
2022-07-05 08:13:25 +02:00
|
|
|
|
|
|
|
#endif
|