Skip to content

Commit

Permalink
relu gradient: >=0 -> >0
Browse files Browse the repository at this point in the history
  • Loading branch information
Yangqing committed Oct 10, 2013
1 parent 9d1eb5e commit e1af72e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/caffe/layers/relu_layer.cu
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Dtype ReLULayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,
Dtype* bottom_diff = (*bottom)[0]->mutable_cpu_diff();
const int count = (*bottom)[0]->count();
for (int i = 0; i < count; ++i) {
bottom_diff[i] = top_diff[i] * (bottom_data[i] >= 0);
bottom_diff[i] = top_diff[i] * (bottom_data[i] > 0);
}
}
return Dtype(0);
Expand Down Expand Up @@ -63,7 +63,7 @@ __global__ void ReLUBackward(const int n, const Dtype* in_diff,
const Dtype* in_data, Dtype* out_diff) {
int index = threadIdx.x + blockIdx.x * blockDim.x;
if (index < n) {
out_diff[index] = in_diff[index] * (in_data[index] >= 0);
out_diff[index] = in_diff[index] * (in_data[index] > 0);
}
}

Expand Down

0 comments on commit e1af72e

Please sign in to comment.