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/col2im.cl | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/col2im.cl b/src/col2im.cl
index 00d8f83..2ccf89e 100644
--- a/src/col2im.cl
+++ b/src/col2im.cl
@@ -21,13 +21,15 @@
id /= channels;
int b = id%batch;
- int w_start = (w<ksize)?0:(w-ksize)/stride + 1;
+ //int w_start = (w<ksize)?0:(w-ksize)/stride + 1;
+ int w_start = (w-ksize+stride)/stride;
int w_end = w/stride + 1;
- if(width_col < w_end) w_end = width_col;
+ //w_end = (width_col < w_end) ? width_col : w_end;
- int h_start = (h<ksize)?0:(h-ksize)/stride+1;
+ int h_start = (h-ksize+stride)/stride;
+ //int h_start = (h-ksize)/stride+1;
int h_end = h/stride + 1;
- if(height_col < h_end) h_end = height_col;
+ //h_end = (height_col < h_end) ? height_col : h_end;
int rows = channels * ksize * ksize;
int cols = height_col*width_col;
@@ -39,7 +41,9 @@
int h_col, w_col;
for(h_col = h_start; h_col < h_end; ++h_col){
for(w_col = w_start; w_col < w_end; ++w_col){
- val += data_col[offset +h_col*h_coeff + w_col*w_coeff];
+ int col_index = offset +h_col*h_coeff + w_col*w_coeff;
+ float part = (w_col < 0 || h_col < 0 || h_col >= height_col || w_col >= width_col) ? 0 : data_col[col_index];
+ val += part;
}
}
data_im[index] = val;
--
Gitblit v1.10.0