const int count = (*bottom)[0]->count();
Dtype negative_slope = this->layer_param_.relu_param().negative_slope();
for (int i = 0; i < count; ++i) {
- bottom_diff[i] = top_diff[i] * ((bottom_data[i] >= 0)
- + negative_slope * (bottom_data[i] < 0));
+ bottom_diff[i] = top_diff[i] * ((bottom_data[i] > 0)
+ + negative_slope * (bottom_data[i] <= 0));
}
}
}
__global__ void ReLUBackward(const int n, const Dtype* in_diff,
const Dtype* in_data, Dtype* out_diff, Dtype negative_slope) {
CUDA_KERNEL_LOOP(index, n) {
- out_diff[index] = in_diff[index] * ((in_data[index] >= 0)
- + (in_data[index] < 0) * negative_slope);
+ out_diff[index] = in_diff[index] * ((in_data[index] > 0)
+ + (in_data[index] <= 0) * negative_slope);
}
}