Skip to content

Commit

Permalink
Merge pull request BVLC#3410 from ghost/patch-2
Browse files Browse the repository at this point in the history
sigmoid fix: calculate by tanh instead of exp (cpp)
  • Loading branch information
shelhamer authored Apr 14, 2017
2 parents 6137b24 + 52dcf48 commit 08bded8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/caffe/layers/sigmoid_layer.cu
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace caffe {
template <typename Dtype>
__global__ void SigmoidForward(const int n, const Dtype* in, Dtype* out) {
CUDA_KERNEL_LOOP(index, n) {
out[index] = 1. / (1. + exp(-in[index]));
out[index] = 0.5 * tanh(0.5 * in[index]) + 0.5;
}
}

Expand Down

0 comments on commit 08bded8

Please sign in to comment.