From 7c120aef23fde5b215b0fb6eef3074a15f16ff69 Mon Sep 17 00:00:00 2001 From: Joseph Redmon Date: Wed, 19 Nov 2014 14:03:51 -0800 Subject: [PATCH] stable, dropout on gpu --- src/cnn.c | 5 +++-- src/dropout_layer.cl | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 src/dropout_layer.cl diff --git a/src/cnn.c b/src/cnn.c index 5399679d..f77b8f0c 100644 --- a/src/cnn.c +++ b/src/cnn.c @@ -308,8 +308,8 @@ void train_asirra() void train_imagenet() { float avg_loss = 1; - network net = parse_network_cfg("/home/pjreddie/imagenet_backup/imagenet_2280.cfg"); - //network net = parse_network_cfg("cfg/imagenet2.cfg"); + //network net = parse_network_cfg("/home/pjreddie/imagenet_backup/alexnet_1270.cfg"); + network net = parse_network_cfg("cfg/imagenet.cfg"); printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay); int imgs = 1000/net.batch+1; srand(time(0)); @@ -1042,6 +1042,7 @@ int main(int argc, char *argv[]) #ifdef GPU else if(0==strcmp(argv[1], "test_gpu")) test_gpu_blas(); #endif + test_parser(); fprintf(stderr, "Success!\n"); return 0; } diff --git a/src/dropout_layer.cl b/src/dropout_layer.cl new file mode 100644 index 00000000..aa24964a --- /dev/null +++ b/src/dropout_layer.cl @@ -0,0 +1,5 @@ +__kernel void forward(__global float *input, __global float *rand, float prob) +{ + int id = get_global_id(0); + input[id] = (rand[id] < prob) ? 0 : input[id]/(1.-prob); +}