Permalink
Browse files

Merge pull request #3411 from ghost/patch-3

sigmoid fix: calculate by tanh instead of exp (cpp)
  • Loading branch information...
2 parents 1df3a25 + 0f61cc0 commit 6137b24a19c720026c78462c1bc8018cd850396a @shelhamer shelhamer committed on GitHub Apr 14, 2017
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/caffe/layers/sigmoid_layer.cpp
@@ -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>

0 comments on commit 6137b24

Please sign in to comment.