From d61adb8212e027a164da87bb83bcc18367a8a9f9 Mon Sep 17 00:00:00 2001 From: Jeff Donahue Date: Sat, 29 Mar 2014 12:23:03 -0700 Subject: [PATCH] remove unnecessary local variables from EltwiseProductLayer --- include/caffe/vision_layers.hpp | 5 ----- src/caffe/layers/eltwise_product_layer.cpp | 18 +++++++++--------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/include/caffe/vision_layers.hpp b/include/caffe/vision_layers.hpp index 93f6d25..bbad319 100644 --- a/include/caffe/vision_layers.hpp +++ b/include/caffe/vision_layers.hpp @@ -287,11 +287,6 @@ class EltwiseProductLayer : public Layer { const bool propagate_down, vector*>* bottom); virtual void Backward_gpu(const vector*>& top, const bool propagate_down, vector*>* bottom); - - int num_; - int channels_; - int height_; - int width_; }; template diff --git a/src/caffe/layers/eltwise_product_layer.cpp b/src/caffe/layers/eltwise_product_layer.cpp index d056ab1..b394450 100644 --- a/src/caffe/layers/eltwise_product_layer.cpp +++ b/src/caffe/layers/eltwise_product_layer.cpp @@ -15,17 +15,17 @@ void EltwiseProductLayer::SetUp(const vector*>& 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 -- 2.7.4