| 32 | |
| 33 | template <typename Dtype> |
| 34 | void 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 | |
| 56 | template <typename Dtype> |
| 57 | void LogLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top, |
nothing calls this directly
no test coverage detected