From 0f645836f193e75c4c3b718369e6fab15b5d19c5 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Wed, 11 Feb 2015 03:41:03 +0000
Subject: [PATCH] Detection is back, baby\!
---
src/convolutional_layer.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/convolutional_layer.c b/src/convolutional_layer.c
index 2e25844..7782e3d 100644
--- a/src/convolutional_layer.c
+++ b/src/convolutional_layer.c
@@ -44,7 +44,6 @@
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)
{
int i;
- size = 2*(size/2)+1; //HA! And you thought you'd use an even sized filter...
convolutional_layer *layer = calloc(1, sizeof(convolutional_layer));
layer->learning_rate = learning_rate;
@@ -95,11 +94,10 @@
return layer;
}
-void resize_convolutional_layer(convolutional_layer *layer, int h, int w, int c)
+void resize_convolutional_layer(convolutional_layer *layer, int h, int w)
{
layer->h = h;
layer->w = w;
- layer->c = c;
int out_h = convolutional_out_height(*layer);
int out_w = convolutional_out_width(*layer);
@@ -109,6 +107,16 @@
layer->batch*out_h * out_w * layer->n*sizeof(float));
layer->delta = realloc(layer->delta,
layer->batch*out_h * out_w * layer->n*sizeof(float));
+
+ #ifdef GPU
+ cuda_free(layer->col_image_gpu);
+ cuda_free(layer->delta_gpu);
+ cuda_free(layer->output_gpu);
+
+ layer->col_image_gpu = cuda_make_array(layer->col_image, out_h*out_w*layer->size*layer->size*layer->c);
+ layer->delta_gpu = cuda_make_array(layer->delta, layer->batch*out_h*out_w*layer->n);
+ layer->output_gpu = cuda_make_array(layer->output, layer->batch*out_h*out_w*layer->n);
+ #endif
}
void bias_output(float *output, float *biases, int batch, int n, int size)
--
Gitblit v1.10.0