check that LRN's local_size is odd as the current implementation requires
authorJonathan L Long <jonlong@cs.berkeley.edu>
Fri, 12 Sep 2014 23:07:34 +0000 (16:07 -0700)
committerEvan Shelhamer <shelhamer@imaginarynumber.net>
Thu, 18 Sep 2014 20:17:43 +0000 (13:17 -0700)
src/caffe/layers/lrn_layer.cpp

index 55b7673..d9e41e9 100644 (file)
@@ -10,6 +10,7 @@ template <typename Dtype>
 void LRNLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom,
       vector<Blob<Dtype>*>* top) {
   size_ = this->layer_param_.lrn_param().local_size();
+  CHECK_EQ(size_ % 2, 1) << "LRN only supports odd values for local_size";
   pre_pad_ = (size_ - 1) / 2;
   alpha_ = this->layer_param_.lrn_param().alpha();
   beta_ = this->layer_param_.lrn_param().beta();