| 13 | |
| 14 | template <typename Dtype> |
| 15 | void ThresholdLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom, |
| 16 | const vector<Blob<Dtype>*>& top) { |
| 17 | const Dtype* bottom_data = bottom[0]->cpu_data(); |
| 18 | Dtype* top_data = top[0]->mutable_cpu_data(); |
| 19 | const int count = bottom[0]->count(); |
| 20 | for (int i = 0; i < count; ++i) { |
| 21 | top_data[i] = (bottom_data[i] > threshold_) ? Dtype(1) : Dtype(0); |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | #ifdef CPU_ONLY |
| 26 | STUB_GPU_FORWARD(ThresholdLayer, Forward); |
nothing calls this directly
no test coverage detected