From 154a081db7131174893a12e0bc665f8b76e98048 Mon Sep 17 00:00:00 2001 From: Yangqing Jia Date: Fri, 20 Sep 2013 17:10:52 -0700 Subject: [PATCH] fixed bug --- src/caffeine/test/test_gradient_check_util.hpp | 6 +++--- src/caffeine/util/im2col.cu | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/caffeine/test/test_gradient_check_util.hpp b/src/caffeine/test/test_gradient_check_util.hpp index 334a3ee..6b77336 100644 --- a/src/caffeine/test/test_gradient_check_util.hpp +++ b/src/caffeine/test/test_gradient_check_util.hpp @@ -71,11 +71,11 @@ void GradientChecker::CheckGradientSingle(Layer& layer, blobs_to_check.push_back(bottom[check_bottom]); } // go through the bottom and parameter blobs - LOG(ERROR) << "Checking " << blobs_to_check.size() << " blobs."; + //LOG(ERROR) << "Checking " << blobs_to_check.size() << " blobs."; for (int blobid = 0; blobid < blobs_to_check.size(); ++blobid) { Blob* current_blob = blobs_to_check[blobid]; - LOG(ERROR) << "Blob " << blobid << ": checking " << current_blob->count() - << " parameters."; + //LOG(ERROR) << "Blob " << blobid << ": checking " << current_blob->count() + // << " parameters."; // go through the values for (int feat_id = 0; feat_id < current_blob->count(); ++feat_id) { // First, obtain the original data diff --git a/src/caffeine/util/im2col.cu b/src/caffeine/util/im2col.cu index 11cba4a..03c1dca 100644 --- a/src/caffeine/util/im2col.cu +++ b/src/caffeine/util/im2col.cu @@ -68,14 +68,11 @@ __global__ void col2im_gpu_kernel(const int n, const Dtype* data_col, int w_col_end = min(w / stride + 1, width_col); int h_col_start = (h < ksize) ? 0 : (h - ksize) / stride + 1; int h_col_end = min(h / stride + 1, height_col); - int col_offset = c * ksize * ksize + h * ksize + w; for (int h_col = h_col_start; h_col < h_col_end; ++h_col) { for (int w_col = w_col_start; w_col < w_col_end; ++w_col) { - //// the col location: [c * width * height + h_out, w_out] - //int c_col = c * ksize * ksize + (h - h_col * stride) * ksize + (w - w_col * stride); - //data_im[index] += data_col[(c_col * height_col + h_col) * width_col + w_col]; - data_im[index] += - data_col[col_offset - (h_col * ksize + w_col) * stride]; + // the col location: [c * width * height + h_out, w_out] + int c_col = c * ksize * ksize + (h - h_col * stride) * ksize + (w - w_col * stride); + data_im[index] += data_col[(c_col * height_col + h_col) * width_col + w_col]; } } } -- 2.7.4