From d9f1b0b16edeb59281355a855e18a8be343fc33c Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Fri, 08 Aug 2014 19:04:15 +0000
Subject: [PATCH] probably how maxpool layers should be
---
src/col2im.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/col2im.c b/src/col2im.c
index bc15b7b..fd7de4f 100644
--- a/src/col2im.c
+++ b/src/col2im.c
@@ -1,4 +1,6 @@
-inline void col2im_set_pixel(float *im, int height, int width, int channels,
+#include <stdio.h>
+#include <math.h>
+inline void col2im_add_pixel(float *im, int height, int width, int channels,
int row, int col, int channel, int pad, float val)
{
row -= pad;
@@ -6,7 +8,7 @@
if (row < 0 || col < 0 ||
row >= height || col >= width) return;
- im[col + width*(row + channel*height)] = val;
+ im[col + width*(row + channel*height)] += val;
}
//This one might be too, can't remember.
void col2im_cpu(float* data_col,
@@ -31,7 +33,7 @@
int im_row = h_offset + h * stride;
int im_col = w_offset + w * stride;
double val = data_col[(c * height_col + h) * width_col + w];
- col2im_set_pixel(data_im, height, width, channels,
+ col2im_add_pixel(data_im, height, width, channels,
im_row, im_col, c_im, pad, val);
}
}
--
Gitblit v1.10.0