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

Method Forward_cpu

src/caffe/layers/log_layer.cpp:34–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33template <typename Dtype>
34void LogLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom,
35 const vector<Blob<Dtype>*>& top) {
36 const int count = bottom[0]->count();
37 const Dtype* bottom_data = bottom[0]->cpu_data();
38 Dtype* top_data = top[0]->mutable_cpu_data();
39 if (input_scale_ == Dtype(1) && input_shift_ == Dtype(0)) {
40 caffe_log(count, bottom_data, top_data);
41 } else {
42 caffe_copy(count, bottom_data, top_data);
43 if (input_scale_ != Dtype(1)) {
44 caffe_scal(count, input_scale_, top_data);
45 }
46 if (input_shift_ != Dtype(0)) {
47 caffe_add_scalar(count, input_shift_, top_data);
48 }
49 caffe_log(count, top_data, top_data);
50 }
51 if (base_scale_ != Dtype(1)) {
52 caffe_scal(count, base_scale_, top_data);
53 }
54}
55
56template <typename Dtype>
57void LogLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,

Callers

nothing calls this directly

Calls 5

caffe_copyFunction · 0.85
caffe_add_scalarFunction · 0.85
countMethod · 0.80
cpu_dataMethod · 0.45
mutable_cpu_dataMethod · 0.45

Tested by

no test coverage detected