From 06167a220998f4de1a692f790cb7e7b1dc95e865 Mon Sep 17 00:00:00 2001 From: Yangqing Jia Date: Mon, 14 Oct 2013 10:48:49 -0700 Subject: [PATCH] pooling layer: max pooling: removed the max threshold --- src/caffe/layers/pooling_layer.cpp | 7 ++----- src/caffe/layers/pooling_layer.cu | 5 +---- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/caffe/layers/pooling_layer.cpp b/src/caffe/layers/pooling_layer.cpp index 7de2a64..59ce3fe 100644 --- a/src/caffe/layers/pooling_layer.cpp +++ b/src/caffe/layers/pooling_layer.cpp @@ -8,8 +8,6 @@ #include "caffe/vision_layers.hpp" #include "caffe/util/math_functions.hpp" -#define CAFFE_MAX_POOLING_THRESHOLD 1e-8f - using std::max; using std::min; @@ -135,9 +133,8 @@ Dtype PoolingLayer::Backward_cpu(const vector*>& top, for (int w = wstart; w < wend; ++w) { bottom_diff[h * WIDTH_ + w] += top_diff[ph * POOLED_WIDTH_ + pw] * - (bottom_data[h * WIDTH_ + w] >= - top_data[ph * POOLED_WIDTH_ + pw] - - CAFFE_MAX_POOLING_THRESHOLD); + (bottom_data[h * WIDTH_ + w] == + top_data[ph * POOLED_WIDTH_ + pw]); } } } diff --git a/src/caffe/layers/pooling_layer.cu b/src/caffe/layers/pooling_layer.cu index 706ee15..9d15c53 100644 --- a/src/caffe/layers/pooling_layer.cu +++ b/src/caffe/layers/pooling_layer.cu @@ -6,8 +6,6 @@ #include "caffe/vision_layers.hpp" #include "caffe/util/math_functions.hpp" -#define CAFFE_MAX_POOLING_THRESHOLD 1e-8f - using std::max; using std::min; @@ -116,8 +114,7 @@ __global__ void MaxPoolBackward(const int nthreads, const Dtype* bottom_data, for (int ph = phstart; ph < phend; ++ph) { for (int pw = pwstart; pw < pwend; ++pw) { gradient += top_diff[ph * pooled_width + pw] * - (bottom_datum >= top_data[ph * pooled_width + pw] - - CAFFE_MAX_POOLING_THRESHOLD); + (bottom_datum == top_data[ph * pooled_width + pw]); } } bottom_diff[index] = gradient; -- 2.7.4