caffe relu layer update, not sure if it's useful or not
authorYangqing Jia <jiayq84@gmail.com>
Mon, 14 Oct 2013 17:49:29 +0000 (10:49 -0700)
committerYangqing Jia <jiayq84@gmail.com>
Mon, 14 Oct 2013 17:49:29 +0000 (10:49 -0700)
src/caffe/layers/relu_layer.cu

index 8613b3b..b0fc46e 100644 (file)
@@ -39,7 +39,7 @@ template <typename Dtype>
 __global__ void ReLUForward(const int n, const Dtype* in, Dtype* out) {
   int index = threadIdx.x + blockIdx.x * blockDim.x;
   if (index < n) {
-    out[index] = max(in[index], Dtype(0.));
+    out[index] = in[index] > 0 ? in[index] : 0;
   }
 }