Skip to content

Commit

Permalink
Cosmetic change in ConcatLayer
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyk committed May 19, 2014
1 parent efeaf17 commit 1b735b5
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/caffe/layers/concat_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ template <typename Dtype>
void ConcatLayer<Dtype>::SetUp(const vector<Blob<Dtype>*>& bottom,
vector<Blob<Dtype>*>* top) {
CHECK_GT(bottom.size(), 1) <<
"Concat Layer takes at least two blobs as input.";
"ConcatLayer takes at least two blobs as input.";
CHECK_EQ(top->size(), 1) <<
"Concat Layer takes a single blob as output.";
"ConcatLayer takes a single blob as output.";

concat_dim_ = this->layer_param_.concat_param().concat_dim();
CHECK_GE(concat_dim_, 0) << "concat_dim should be >= 0";
CHECK_GE(concat_dim_, 0) <<
"concat_dim should be >= 0";
CHECK_LE(concat_dim_, 1) <<
"For now concat_dim <=1, it can only concat num and channels";
// Intialize with the first blob

// Initialize with the first blob.
count_ = bottom[0]->count();
num_ = bottom[0]->num();
channels_ = bottom[0]->channels();
Expand Down Expand Up @@ -64,10 +67,7 @@ Dtype ConcatLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom,
top_data+(*top)[0]->offset(n, offset_channel));
}
offset_channel += bottom[i]->channels();
}
} else {
LOG(FATAL) << "concat_dim along dim" << concat_dim_ <<
" not implemented yet";
} // concat_dim_ is guaranteed to be 0 or 1 by SetUp.
}
return Dtype(0.);
}
Expand Down Expand Up @@ -97,10 +97,7 @@ void ConcatLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,
}
offset_channel += blob->channels();
}
} else {
LOG(FATAL) << "concat_dim along dim" << concat_dim_ <<
" not implemented yet";
}
} // concat_dim_ is guaranteed to be 0 or 1 by SetUp.
}

INSTANTIATE_CLASS(ConcatLayer);
Expand Down

0 comments on commit 1b735b5

Please sign in to comment.