remove unnecessary local variables from EltwiseProductLayer
authorJeff Donahue <jeff.donahue@gmail.com>
Sat, 29 Mar 2014 19:23:03 +0000 (12:23 -0700)
committerJeff Donahue <jeff.donahue@gmail.com>
Tue, 8 Apr 2014 18:36:18 +0000 (11:36 -0700)
include/caffe/vision_layers.hpp
src/caffe/layers/eltwise_product_layer.cpp

index 93f6d25..bbad319 100644 (file)
@@ -287,11 +287,6 @@ class EltwiseProductLayer : public Layer<Dtype> {
       const bool propagate_down, vector<Blob<Dtype>*>* bottom);
   virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
       const bool propagate_down, vector<Blob<Dtype>*>* bottom);
-
-  int num_;
-  int channels_;
-  int height_;
-  int width_;
 };
 
 template <typename Dtype>
index d056ab1..b394450 100644 (file)
@@ -15,17 +15,17 @@ void EltwiseProductLayer<Dtype>::SetUp(const vector<Blob<Dtype>*>& bottom,
       "Eltwise Product Layer takes at least 2 blobs as input.";
   CHECK_EQ(top->size(), 1) <<
       "Eltwise Product Layer takes a single blob as output.";
-  num_ = bottom[0]->num();
-  channels_ = bottom[0]->channels();
-  height_ = bottom[0]->height();
-  width_ = bottom[0]->width();
+  const int num = bottom[0]->num();
+  const int channels = bottom[0]->channels();
+  const int height = bottom[0]->height();
+  const int width = bottom[0]->width();
   for (int i = 1; i < bottom.size(); ++i) {
-    CHECK_EQ(num_, bottom[i]->num());
-    CHECK_EQ(channels_, bottom[i]->channels());
-    CHECK_EQ(height_, bottom[i]->height());
-    CHECK_EQ(width_, bottom[i]->width());
+    CHECK_EQ(num, bottom[i]->num());
+    CHECK_EQ(channels, bottom[i]->channels());
+    CHECK_EQ(height, bottom[i]->height());
+    CHECK_EQ(width, bottom[i]->width());
   }
-  (*top)[0]->Reshape(num_, channels_, height_, width_);
+  (*top)[0]->Reshape(num, channels, height, width);
 }
 
 template <typename Dtype>