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

Method Backward_cpu

src/caffe/layers/elu_layer.cpp:22–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20
21template <typename Dtype>
22void ELULayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,
23 const vector<bool>& propagate_down,
24 const vector<Blob<Dtype>*>& bottom) {
25 if (propagate_down[0]) {
26 const Dtype* bottom_data = bottom[0]->cpu_data();
27 const Dtype* top_data = top[0]->cpu_data();
28 const Dtype* top_diff = top[0]->cpu_diff();
29 Dtype* bottom_diff = bottom[0]->mutable_cpu_diff();
30 const int count = bottom[0]->count();
31 Dtype alpha = this->layer_param_.elu_param().alpha();
32 for (int i = 0; i < count; ++i) {
33 bottom_diff[i] = top_diff[i] * ((bottom_data[i] > 0)
34 + (alpha + top_data[i]) * (bottom_data[i] <= 0));
35 }
36 }
37}
38
39
40#ifdef CPU_ONLY

Callers

nothing calls this directly

Calls 4

cpu_diffMethod · 0.80
mutable_cpu_diffMethod · 0.80
countMethod · 0.80
cpu_dataMethod · 0.45

Tested by

no test coverage detected