From d00f0a1ccd2a9b1c332bbf7754f291dd61dee14f Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Tue, 21 Jul 2015 23:09:33 +0000
Subject: [PATCH] Changes to make routing work better

---
 src/network_kernels.cu |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/network_kernels.cu b/src/network_kernels.cu
index 36f5594..6562590 100644
--- a/src/network_kernels.cu
+++ b/src/network_kernels.cu
@@ -15,10 +15,13 @@
 #include "convolutional_layer.h"
 #include "deconvolutional_layer.h"
 #include "maxpool_layer.h"
+#include "avgpool_layer.h"
+#include "normalization_layer.h"
 #include "cost_layer.h"
 #include "softmax_layer.h"
 #include "dropout_layer.h"
 #include "route_layer.h"
+#include "blas.h"
 }
 
 float * get_network_output_gpu_layer(network net, int i);
@@ -30,6 +33,9 @@
     int i;
     for(i = 0; i < net.n; ++i){
         layer l = net.layers[i];
+        if(l.delta){
+            scal_ongpu(l.outputs * l.batch, 0, l.delta_gpu, 1);
+        }
         if(l.type == CONVOLUTIONAL){
             forward_convolutional_layer_gpu(l, state);
         } else if(l.type == DECONVOLUTIONAL){
@@ -44,8 +50,12 @@
             forward_cost_layer_gpu(l, state);
         } else if(l.type == SOFTMAX){
             forward_softmax_layer_gpu(l, state);
+        } else if(l.type == NORMALIZATION){
+            forward_normalization_layer_gpu(l, state);
         } else if(l.type == MAXPOOL){
             forward_maxpool_layer_gpu(l, state);
+        } else if(l.type == AVGPOOL){
+            forward_avgpool_layer_gpu(l, state);
         } else if(l.type == DROPOUT){
             forward_dropout_layer_gpu(l, state);
         } else if(l.type == ROUTE){
@@ -76,10 +86,14 @@
             backward_deconvolutional_layer_gpu(l, state);
         } else if(l.type == MAXPOOL){
             if(i != 0) backward_maxpool_layer_gpu(l, state);
+        } else if(l.type == AVGPOOL){
+            if(i != 0) backward_avgpool_layer_gpu(l, state);
         } else if(l.type == DROPOUT){
             backward_dropout_layer_gpu(l, state);
         } else if(l.type == DETECTION){
             backward_detection_layer_gpu(l, state);
+        } else if(l.type == NORMALIZATION){
+            backward_normalization_layer_gpu(l, state);
         } else if(l.type == SOFTMAX){
             if(i != 0) backward_softmax_layer_gpu(l, state);
         } else if(l.type == CONNECTED){
@@ -136,20 +150,7 @@
 {
     layer l = net.layers[i];
     cuda_pull_array(l.output_gpu, l.output, l.outputs*l.batch);
-    if(l.type == CONVOLUTIONAL){
-        return l.output;
-    } else if(l.type == DECONVOLUTIONAL){
-        return l.output;
-    } else if(l.type == CONNECTED){
-        return l.output;
-    } else if(l.type == DETECTION){
-        return l.output;
-    } else if(l.type == MAXPOOL){
-        return l.output;
-    } else if(l.type == SOFTMAX){
-        return l.output;
-    }
-    return 0;
+    return l.output;
 }
 
 float *get_network_output_gpu(network net)

--
Gitblit v1.10.0