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

Method Backward_cpu

src/caffe/layers/split_layer.cpp:34–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33template <typename Dtype>
34void SplitLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,
35 const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) {
36 if (!propagate_down[0]) { return; }
37 if (top.size() == 1) {
38 caffe_copy(count_, top[0]->cpu_diff(), bottom[0]->mutable_cpu_diff());
39 return;
40 }
41 caffe_add(count_, top[0]->cpu_diff(), top[1]->cpu_diff(),
42 bottom[0]->mutable_cpu_diff());
43 // Add remaining top blob diffs.
44 for (int i = 2; i < top.size(); ++i) {
45 const Dtype* top_diff = top[i]->cpu_diff();
46 Dtype* bottom_diff = bottom[0]->mutable_cpu_diff();
47 caffe_axpy(count_, Dtype(1.), top_diff, bottom_diff);
48 }
49}
50
51
52#ifdef CPU_ONLY

Callers

nothing calls this directly

Calls 4

caffe_copyFunction · 0.85
cpu_diffMethod · 0.80
mutable_cpu_diffMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected