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

Method Backward_cpu

src/caffe/layers/log_layer.cpp:57–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55
56template <typename Dtype>
57void LogLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,
58 const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) {
59 if (!propagate_down[0]) { return; }
60 const int count = bottom[0]->count();
61 const Dtype* bottom_data = bottom[0]->cpu_data();
62 const Dtype* top_diff = top[0]->cpu_diff();
63 Dtype* bottom_diff = bottom[0]->mutable_cpu_diff();
64 caffe_copy(count, bottom_data, bottom_diff);
65 if (input_scale_ != Dtype(1)) {
66 caffe_scal(count, input_scale_, bottom_diff);
67 }
68 if (input_shift_ != Dtype(0)) {
69 caffe_add_scalar(count, input_shift_, bottom_diff);
70 }
71 caffe_powx(count, bottom_diff, Dtype(-1), bottom_diff);
72 if (backward_num_scale_ != Dtype(1)) {
73 caffe_scal(count, backward_num_scale_, bottom_diff);
74 }
75 caffe_mul(count, top_diff, bottom_diff, bottom_diff);
76}
77
78#ifdef CPU_ONLY
79STUB_GPU(LogLayer);

Callers

nothing calls this directly

Calls 6

caffe_copyFunction · 0.85
caffe_add_scalarFunction · 0.85
countMethod · 0.80
cpu_diffMethod · 0.80
mutable_cpu_diffMethod · 0.80
cpu_dataMethod · 0.45

Tested by

no test coverage detected