Skip to content

Commit

Permalink
Merge pull request BVLC#3411 from ghost/patch-3
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 1df3a25 + 0f61cc0 commit 6137b24
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/caffe/layers/sigmoid_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace caffe {

template <typename Dtype>
inline Dtype sigmoid(Dtype x) {
return 1. / (1. + exp(-x));
return 0.5 * tanh(0.5 * x) + 0.5;
}

template <typename Dtype>
Expand Down

0 comments on commit 6137b24

Please sign in to comment.