From b5936b499abc94c0efffbcc99b5698574b59d860 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Sat, 05 Sep 2015 00:52:44 +0000
Subject: [PATCH] lots of stuff

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

diff --git a/src/network_kernels.cu b/src/network_kernels.cu
index 3a4f0bf..1f0a654 100644
--- a/src/network_kernels.cu
+++ b/src/network_kernels.cu
@@ -1,6 +1,7 @@
 extern "C" {
 #include <stdio.h>
 #include <time.h>
+#include <assert.h>
 
 #include "network.h"
 #include "image.h"
@@ -12,6 +13,7 @@
 #include "crop_layer.h"
 #include "connected_layer.h"
 #include "detection_layer.h"
+#include "region_layer.h"
 #include "convolutional_layer.h"
 #include "deconvolutional_layer.h"
 #include "maxpool_layer.h"
@@ -21,6 +23,7 @@
 #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);
@@ -32,12 +35,17 @@
     int i;
     for(i = 0; i < net.n; ++i){
         layer l = net.layers[i];
+        if(l.delta_gpu){
+            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){
             forward_deconvolutional_layer_gpu(l, state);
         } else if(l.type == DETECTION){
             forward_detection_layer_gpu(l, state);
+        } else if(l.type == REGION){
+            forward_region_layer_gpu(l, state);
         } else if(l.type == CONNECTED){
             forward_connected_layer_gpu(l, state);
         } else if(l.type == CROP){
@@ -88,6 +96,8 @@
             backward_dropout_layer_gpu(l, state);
         } else if(l.type == DETECTION){
             backward_detection_layer_gpu(l, state);
+        } else if(l.type == REGION){
+            backward_region_layer_gpu(l, state);
         } else if(l.type == NORMALIZATION){
             backward_normalization_layer_gpu(l, state);
         } else if(l.type == SOFTMAX){
@@ -106,14 +116,15 @@
 {
     int i;
     int update_batch = net.batch*net.subdivisions;
+    float rate = get_current_rate(net);
     for(i = 0; i < net.n; ++i){
         layer l = net.layers[i];
         if(l.type == CONVOLUTIONAL){
-            update_convolutional_layer_gpu(l, update_batch, net.learning_rate, net.momentum, net.decay);
+            update_convolutional_layer_gpu(l, update_batch, rate, net.momentum, net.decay);
         } else if(l.type == DECONVOLUTIONAL){
-            update_deconvolutional_layer_gpu(l, net.learning_rate, net.momentum, net.decay);
+            update_deconvolutional_layer_gpu(l, rate, net.momentum, net.decay);
         } else if(l.type == CONNECTED){
-            update_connected_layer_gpu(l, update_batch, net.learning_rate, net.momentum, net.decay);
+            update_connected_layer_gpu(l, update_batch, rate, net.momentum, net.decay);
         }
     }
 }
@@ -137,7 +148,7 @@
     forward_network_gpu(net, state);
     backward_network_gpu(net, state);
     float error = get_network_cost(net);
-    if ((net.seen / net.batch) % net.subdivisions == 0) update_network_gpu(net);
+    if (((*net.seen) / net.batch) % net.subdivisions == 0) update_network_gpu(net);
 
     return error;
 }

--
Gitblit v1.10.0