loss in forward pass for concat layer (thought i'd rebased to latest dev
authorJeff Donahue <jeff.donahue@gmail.com>
Fri, 14 Mar 2014 21:52:51 +0000 (14:52 -0700)
committerJeff Donahue <jeff.donahue@gmail.com>
Wed, 19 Mar 2014 19:37:31 +0000 (12:37 -0700)
but apparently not)

include/caffe/vision_layers.hpp
src/caffe/layers/concat_layer.cpp
src/caffe/layers/concat_layer.cu

index c1729dd..3a3bdfd 100644 (file)
@@ -352,13 +352,13 @@ class ConcatLayer : public Layer<Dtype> {
       vector<Blob<Dtype>*>* top);
 
  protected:
-  virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
+  virtual Dtype Forward_cpu(const vector<Blob<Dtype>*>& bottom,
       vector<Blob<Dtype>*>* top);
-  virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
+  virtual Dtype Forward_gpu(const vector<Blob<Dtype>*>& bottom,
       vector<Blob<Dtype>*>* top);
-  virtual Dtype Backward_cpu(const vector<Blob<Dtype>*>& top,
+  virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
       const bool propagate_down, vector<Blob<Dtype>*>* bottom);
-  virtual Dtype Backward_gpu(const vector<Blob<Dtype>*>& top,
+  virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
       const bool propagate_down, vector<Blob<Dtype>*>* bottom);
   Blob<Dtype> col_bob_;
 
index dc949c1..e654510 100644 (file)
@@ -42,7 +42,7 @@ void ConcatLayer<Dtype>::SetUp(const vector<Blob<Dtype>*>& bottom,
 }
 
 template <typename Dtype>
-void ConcatLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom,
+Dtype ConcatLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom,
       vector<Blob<Dtype>*>* top) {
   Dtype* top_data = (*top)[0]->mutable_cpu_data();
   if (concat_dim_== 0) {
@@ -69,10 +69,11 @@ void ConcatLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom,
     LOG(FATAL) << "concat_dim along dim" << concat_dim_ <<
       " not implemented yet";
   }
+  return Dtype(0.);
 }
 
 template <typename Dtype>
-Dtype ConcatLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,
+void ConcatLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,
       const bool propagate_down, vector<Blob<Dtype>*>* bottom) {
   const Dtype* top_diff = top[0]->cpu_diff();
   if (concat_dim_ == 0) {
@@ -100,7 +101,6 @@ Dtype ConcatLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,
     LOG(FATAL) << "concat_dim along dim" << concat_dim_ <<
       " not implemented yet";
   }
-  return Dtype(0.);
 }
 
 INSTANTIATE_CLASS(ConcatLayer);
index 616a5e6..8a20cea 100644 (file)
@@ -9,7 +9,7 @@
 namespace caffe {
 
 template <typename Dtype>
-void ConcatLayer<Dtype>::Forward_gpu(const vector<Blob<Dtype>*>& bottom,
+Dtype ConcatLayer<Dtype>::Forward_gpu(const vector<Blob<Dtype>*>& bottom,
       vector<Blob<Dtype>*>* top) {
   Dtype* top_data = (*top)[0]->mutable_gpu_data();
   if (concat_dim_ == 0) {
@@ -36,10 +36,11 @@ void ConcatLayer<Dtype>::Forward_gpu(const vector<Blob<Dtype>*>& bottom,
     LOG(FATAL) << "concat_dim along dim" << concat_dim_ <<
       " not implemented yet";
   }
+  return Dtype(0.);
 }
 
 template <typename Dtype>
-Dtype ConcatLayer<Dtype>::Backward_gpu(const vector<Blob<Dtype>*>& top,
+void ConcatLayer<Dtype>::Backward_gpu(const vector<Blob<Dtype>*>& top,
       const bool propagate_down, vector<Blob<Dtype>*>* bottom) {
   const Dtype* top_diff = top[0]->gpu_diff();
   if (concat_dim_ == 0) {
@@ -67,7 +68,6 @@ Dtype ConcatLayer<Dtype>::Backward_gpu(const vector<Blob<Dtype>*>& top,
     LOG(FATAL) << "concat_dim along dim" << concat_dim_ <<
       " not implemented yet";
   }
-  return Dtype(0.);
 }
 
 INSTANTIATE_CLASS(ConcatLayer);