-
Notifications
You must be signed in to change notification settings - Fork 396
Leaky ReLUs #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leaky ReLUs #105
Changes from 8 commits
ca8938b
eb7915e
204006f
1fb4697
7c70a7e
6a7c361
3c7dbba
8cec194
a30ca99
9e87141
a0c90c4
00bd0dc
b918024
5d09aa0
6c2215a
0bdc64e
0294836
6c7ed9e
d707c8d
54eb717
0a3a84e
7162449
48ee736
94c860f
012c672
058bfc8
1c41188
95d000d
411c9cd
9483fba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| </$objtype/mkfile | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the reason of adding this file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Portability to Plan 9 I guess |
||
|
|
||
| CC=pcc | ||
| CFLAGS=-D_PLAN9_SOURCE -c | ||
| NOMK=(parallel_train.c) | ||
| TARG=`{ ls *.c | grep -v '^('$NOMK')$' | sed 's,.c$,,' } | ||
| PROGS=${TARG:%=$O.%} | ||
|
|
||
| all:V: $PROGS | ||
|
|
||
| </sys/src/cmd/mkmany | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,8 +10,15 @@ ELSE() | |
| SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") | ||
| ENDIF(NOT OPENMP_FOUND OR DISABLE_PARALLEL_FANN) | ||
|
|
||
| FIND_PACKAGE(OpenCL) | ||
| IF(OPENCL_FOUND) | ||
| SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${OpenCL_INCLUDE_DIR}") | ||
| SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${OpenCL_INCLUDE_DIR}") | ||
| ENDIF(OPENCL_FOUND) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be deleted as it's not used anywhere? |
||
|
|
||
| ADD_SUBDIRECTORY( include ) | ||
|
|
||
| #INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/include/optimized/opencl) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please delete it |
||
| INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) | ||
| ADD_DEFINITIONS(-D_REENTRANT) | ||
| if (WIN32) | ||
|
|
@@ -81,6 +88,12 @@ INSTALL(TARGETS fixedfann fixedfann_static LIBRARY DESTINATION ${LIB_INSTALL_DIR | |
|
|
||
| SET(fann_LIB_SRCS | ||
| floatfann.c | ||
| # optimized/opencl/fann.c | ||
| # optimized/opencl/fann_cl.cpp | ||
| # optimized/opencl/fann_cl_kernel.c | ||
| # optimized/opencl/fann_cl_train.c | ||
| # optimized/opencl/fann_cl_ann.c | ||
| # optimized/opencl/fann_cl_run.c | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please delete it. |
||
| ) | ||
|
|
||
| ADD_LIBRARY(fann SHARED ${fann_LIB_SRCS}) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,12 +17,21 @@ | |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| */ | ||
|
|
||
| #ifdef PLAN9 | ||
| #include <stdio.h> | ||
| #include <stdlib.h> | ||
| #include <string.h> | ||
| #include <sys/time.h> | ||
| #include <time.h> | ||
| #include <math.h> | ||
| #else | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's the purpose of this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Portability to Plan 9 I guess |
||
| #include <stdio.h> | ||
| #include <stdlib.h> | ||
| #include <stdarg.h> | ||
| #include <string.h> | ||
| #include <time.h> | ||
| #include <math.h> | ||
| #endif | ||
|
|
||
| #include "config.h" | ||
| #include "fann.h" | ||
|
|
@@ -654,7 +663,8 @@ FANN_EXTERNAL fann_type *FANN_API fann_run(struct fann * ann, fann_type * input) | |
| break; | ||
| } | ||
|
|
||
| for(; i != num_connections; i += 4) | ||
| #pragma omp parallel for reduction(+:neuron_sum) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. omp shouldn't be added as part of this PR as it's not used in fann.c |
||
| for(i = num_connections & 3; i < num_connections; i += 4) | ||
| { | ||
| neuron_sum += | ||
| fann_mult(weights[i], neurons[i].value) + | ||
|
|
@@ -688,7 +698,8 @@ FANN_EXTERNAL fann_type *FANN_API fann_run(struct fann * ann, fann_type * input) | |
| break; | ||
| } | ||
|
|
||
| for(; i != num_connections; i += 4) | ||
| #pragma omp parallel for reduction(+:neuron_sum) | ||
| for(i = num_connections & 3; i < num_connections; i += 4) | ||
| { | ||
| neuron_sum += | ||
| fann_mult(weights[i], neuron_pointers[i]->value) + | ||
|
|
@@ -769,6 +780,12 @@ FANN_EXTERNAL fann_type *FANN_API fann_run(struct fann * ann, fann_type * input) | |
| case FANN_LINEAR_PIECE_SYMMETRIC: | ||
| neuron_it->value = (fann_type)((neuron_sum < -multiplier) ? -multiplier : (neuron_sum > multiplier) ? multiplier : neuron_sum); | ||
| break; | ||
| case FANN_LINEAR_PIECE_LEAKY: | ||
| neuron_it->value = (fann_type)((neuron_sum < 0) ? 0.01 * neuron_sum: neuron_sum); | ||
| break; | ||
| case FANN_LINEAR_PIECE_RECT: | ||
| neuron_it->value = (fann_type)((neuron_sum < 0) ? 0: neuron_sum); | ||
| break; | ||
| case FANN_ELLIOT: | ||
| case FANN_ELLIOT_SYMMETRIC: | ||
| case FANN_GAUSSIAN: | ||
|
|
@@ -1828,7 +1845,7 @@ FANN_EXTERNAL void FANN_API fann_enable_seed_rand() | |
| /* INTERNAL FUNCTION | ||
| Seed the random function. | ||
| */ | ||
| void fann_seed_rand() | ||
| void fann_seed_rand(void) | ||
| { | ||
| #ifndef _WIN32 | ||
| FILE *fp = fopen("/dev/urandom", "r"); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenCL is not used so this shouldn't be here.