From e36182cd8c5dd5c6d0aa1f77cf5cdca87e8bb1f0 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Fri, 21 Nov 2014 23:35:19 +0000
Subject: [PATCH] cleaned up data parsing a lot. probably nothing broken?

---
 src/convolutional_layer.h |   63 +++++++++++++++++++++++--------
 1 files changed, 47 insertions(+), 16 deletions(-)

diff --git a/src/convolutional_layer.h b/src/convolutional_layer.h
index ab414ec..970a9b1 100644
--- a/src/convolutional_layer.h
+++ b/src/convolutional_layer.h
@@ -1,37 +1,68 @@
 #ifndef CONVOLUTIONAL_LAYER_H
 #define CONVOLUTIONAL_LAYER_H
 
+#include "opencl.h"
 #include "image.h"
 #include "activations.h"
 
 typedef struct {
+    float learning_rate;
+    float momentum;
+    float decay;
+
+    int batch;
     int h,w,c;
     int n;
+    int size;
     int stride;
-    image *kernels;
-    image *kernel_updates;
-    double *biases;
-    double *bias_updates;
-    image upsampled;
-    double *delta;
-    double *output;
+    int pad;
+    float *filters;
+    float *filter_updates;
+    float *filter_momentum;
 
-    double (* activation)();
-    double (* gradient)();
+    float *biases;
+    float *bias_updates;
+    float *bias_momentum;
+
+    float *col_image;
+    float *delta;
+    float *output;
+
+    #ifdef GPU
+    cl_mem filters_cl;
+    cl_mem filter_updates_cl;
+    cl_mem filter_momentum_cl;
+
+    cl_mem biases_cl;
+    cl_mem bias_updates_cl;
+    cl_mem bias_momentum_cl;
+
+    cl_mem col_image_cl;
+    cl_mem delta_cl;
+    cl_mem output_cl;
+    #endif
+
+    ACTIVATION activation;
 } convolutional_layer;
 
-convolutional_layer *make_convolutional_layer(int h, int w, int c, int n, int size, int stride, ACTIVATION activator);
-void forward_convolutional_layer(const convolutional_layer layer, double *in);
-void backward_convolutional_layer(convolutional_layer layer, double *input, double *delta);
-void learn_convolutional_layer(convolutional_layer layer, double *input);
+#ifdef GPU
+void forward_convolutional_layer_gpu(convolutional_layer layer, cl_mem in);
+void backward_convolutional_layer_gpu(convolutional_layer layer, cl_mem delta_cl);
+void update_convolutional_layer_gpu(convolutional_layer layer);
+void push_convolutional_layer(convolutional_layer layer);
+#endif
 
-void update_convolutional_layer(convolutional_layer layer, double step);
+convolutional_layer *make_convolutional_layer(int batch, int h, int w, int c, int n, int size, int stride, int pad, ACTIVATION activation, float learning_rate, float momentum, float decay);
+void resize_convolutional_layer(convolutional_layer *layer, int h, int w, int c);
+void forward_convolutional_layer(const convolutional_layer layer, float *in);
+void update_convolutional_layer(convolutional_layer layer);
+image *visualize_convolutional_layer(convolutional_layer layer, char *window, image *prev_filters);
 
-void backpropagate_convolutional_layer_convolve(image input, convolutional_layer layer);
-void visualize_convolutional_layer(convolutional_layer layer);
+void backward_convolutional_layer(convolutional_layer layer, float *delta);
 
 image get_convolutional_image(convolutional_layer layer);
 image get_convolutional_delta(convolutional_layer layer);
+image get_convolutional_filter(convolutional_layer layer, int i);
 
 #endif
 

--
Gitblit v1.10.0