pooling layer: max pooling: removed the max threshold
authorYangqing Jia <jiayq84@gmail.com>
Mon, 14 Oct 2013 17:48:49 +0000 (10:48 -0700)
committerYangqing Jia <jiayq84@gmail.com>
Mon, 14 Oct 2013 17:48:49 +0000 (10:48 -0700)
src/caffe/layers/pooling_layer.cpp
src/caffe/layers/pooling_layer.cu

index 7de2a64..59ce3fe 100644 (file)
@@ -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<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& 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]);
               }
             }
           }
index 706ee15..9d15c53 100644 (file)
@@ -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;