MCPcopy Create free account
hub / github.com/BVLC/caffe / Forward_cpu

Method Forward_cpu

src/caffe/layers/concat_layer.cpp:57–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55
56template <typename Dtype>
57void 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
76template <typename Dtype>
77void ConcatLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,

Callers

nothing calls this directly

Calls 5

caffe_copyFunction · 0.85
shapeMethod · 0.80
sizeMethod · 0.45
mutable_cpu_dataMethod · 0.45
cpu_dataMethod · 0.45

Tested by

no test coverage detected