tipe/src/cnn/include/function.h

62 lines
1.2 KiB
C
Raw Normal View History

2022-07-05 08:13:25 +02:00
#ifndef DEF_FUNCTION_H
#define DEF_FUNCTION_H
2022-10-31 20:08:42 +01:00
2022-07-05 08:13:25 +02:00
// Les dérivées sont l'opposé
2022-11-12 14:20:13 +01:00
#define IDENTITY 1
#define TANH 2
#define SIGMOID 3
#define RELU 4
#define SOFTMAX 5
2022-07-05 08:13:25 +02:00
2022-11-01 11:20:17 +01:00
typedef float (*ptr)(float);
typedef ptr (*pm)();
2022-07-05 08:13:25 +02:00
/*
* Fonction max pour les floats
*/
2022-11-03 18:13:01 +01:00
float max_float(float a, float b);
2022-07-05 08:13:25 +02:00
2022-11-12 14:20:13 +01:00
float identity(float x);
float identity_derivative(float x);
2022-07-05 08:13:25 +02:00
float sigmoid(float x);
float sigmoid_derivative(float x);
float relu(float x);
float relu_derivative(float x);
float tanh_(float x);
float tanh_derivative(float x);
/*
2022-11-12 14:20:13 +01:00
* Applique softmax sur input[depth][rows][columns]
2022-07-05 08:13:25 +02:00
*/
void apply_softmax_input(float ***input, int depth, int rows, int columns);
/*
2022-11-12 14:20:13 +01:00
* Applique la fonction f sur input[depth][rows][columns]
2022-07-05 08:13:25 +02:00
*/
void apply_function_input(float (*f)(float), float*** input, int depth, int rows, int columns);
/*
2022-09-30 15:50:29 +02:00
* Redirige vers la fonction à appliquer sur une matrice
2022-07-05 08:13:25 +02:00
*/
2022-09-30 15:50:29 +02:00
void choose_apply_function_matrix(int activation, float*** input, int depth, int dim);
/*
* Redirige vers la fonction à appliquer sur un vecteur
*/
void choose_apply_function_vector(int activation, float*** input, int dim);
2022-07-05 08:13:25 +02:00
/*
* Renvoie la fonction d'activation correspondant à son identifiant (activation)
*/
2022-11-01 11:20:17 +01:00
ptr get_function_activation(int activation);
2022-07-05 08:13:25 +02:00
#endif