| 55 | |
| 56 | template <typename Dtype> |
| 57 | void ConcatLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom, |
| 58 | const vector<Blob<Dtype>*>& top) { |
| 59 | if (bottom.size() == 1) { return; } |
| 60 | Dtype* top_data = top[0]->mutable_cpu_data(); |
| 61 | int offset_concat_axis = 0; |
| 62 | const int top_concat_axis = top[0]->shape(concat_axis_); |
| 63 | for (int i = 0; i < bottom.size(); ++i) { |
| 64 | const Dtype* bottom_data = bottom[i]->cpu_data(); |
| 65 | const int bottom_concat_axis = bottom[i]->shape(concat_axis_); |
| 66 | for (int n = 0; n < num_concats_; ++n) { |
| 67 | caffe_copy(bottom_concat_axis * concat_input_size_, |
| 68 | bottom_data + n * bottom_concat_axis * concat_input_size_, |
| 69 | top_data + (n * top_concat_axis + offset_concat_axis) |
| 70 | * concat_input_size_); |
| 71 | } |
| 72 | offset_concat_axis += bottom_concat_axis; |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | template <typename Dtype> |
| 77 | void ConcatLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top, |
nothing calls this directly
no test coverage detected