-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathReluLayer.cpp
More file actions
43 lines (36 loc) · 810 Bytes
/
Copy pathReluLayer.cpp
File metadata and controls
43 lines (36 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* @Author: Weiliang Chen
* @Date: 2016-09-29 10:51:07
* @Last Modified by: Weiliang Chen
* @Last Modified time: 2016-09-29 10:55:27
*/
#include <armadillo>
#include "Layer.h"
#include "ReluLayer.h"
#include "common.h"
#include "Blob.h"
using std::cout;
using std::endl;
namespace fn {
template <typename Dtype>
ReluLayer<Dtype>::ReluLayer()
{
}
template <typename Dtype>
ReluLayer<Dtype>::~ReluLayer()
{
}
template<typename Dtype>
void ReluLayer<Dtype>::Forward(const arma::Cube<Dtype> &bottom,
arma::Cube<Dtype> &top) {
if (bottom.n_rows > 0
&& bottom.n_cols > 0
&& bottom.n_slices > 0) {
for (int i = 0; i < bottom.n_elem; ++i) {
top.at(i) = std::max<Dtype>(bottom.at(i), 0);
}
}
}
//Explicit instantiation
INSTANTIATE_CLASS(ReluLayer);
}