diff --git a/src/cnn/function.c b/src/cnn/function.c index 9f1e1ce..0143731 100644 --- a/src/cnn/function.c +++ b/src/cnn/function.c @@ -5,7 +5,6 @@ #include "../include/colors.h" #include "include/function.h" -#define BOUND_RELU 15 float identity(float x) { return x; @@ -28,7 +27,7 @@ float sigmoid_derivative(float x) { float relu(float x) { - return fmaxf(0, fminf(x, BOUND_RELU)); + return fmaxf(0, fminf(x, RELU_CLIP_VALUE)); } float relu_derivative(float x) { @@ -40,7 +39,7 @@ float relu_derivative(float x) { float leaky_relu(float x) { if (x>0) - return fminf(x, BOUND_RELU); + return fminf(x, RELU_CLIP_VALUE); return x*LEAKER; } diff --git a/src/cnn/include/function.h b/src/cnn/include/function.h index 4e1b770..c09ccab 100644 --- a/src/cnn/include/function.h +++ b/src/cnn/include/function.h @@ -12,6 +12,9 @@ #define LEAKER 0.2 +// RELU and Leaky RELU max value +#define RELU_CLIP_VALUE 15 + typedef float (*ptr)(float); typedef ptr (*pm)();