| 32 | |
| 33 | template <typename Dtype> |
| 34 | void 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 |
nothing calls this directly
no test coverage detected