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

Method Backward_cpu

src/caffe/layers/bnll_layer.cpp:24–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23template <typename Dtype>
24void BNLLLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,
25 const vector<bool>& propagate_down,
26 const vector<Blob<Dtype>*>& bottom) {
27 if (propagate_down[0]) {
28 const Dtype* bottom_data = bottom[0]->cpu_data();
29 const Dtype* top_diff = top[0]->cpu_diff();
30 Dtype* bottom_diff = bottom[0]->mutable_cpu_diff();
31 const int count = bottom[0]->count();
32 Dtype expval;
33 for (int i = 0; i < count; ++i) {
34 expval = exp(std::min(bottom_data[i], Dtype(kBNLL_THRESHOLD)));
35 bottom_diff[i] = top_diff[i] * expval / (expval + 1.);
36 }
37 }
38}
39
40#ifdef CPU_ONLY
41STUB_GPU(BNLLLayer);

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