Skip to content

Commit 4fbf7ab

Browse files
committedMar 26, 2019
Merge branch 'master' into onlyreal
2 parents ad8b04f + 2bd7e8a commit 4fbf7ab

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed
 

‎.codecov.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
comment: false

‎src/activation.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ softsign(x::Real) = x / (one(x) + abs(x))
116116
117117
See [Deep Sparse Rectifier Neural Networks](http://proceedings.mlr.press/v15/glorot11a/glorot11a.pdf).
118118
"""
119-
softplus(x::Real) = log1p(exp(x))
119+
softplus(x::Real) = ifelse(x > 0, x + log1p(exp(-x)), log1p(exp(x)))
120120

121121
# Provide an informative error message if activation functions are called with an array
122122
for f in (, :σ_stable, :logσ, :relu, :leakyrelu, :elu, :gelu, :swish, :selu, :softsign, :softplus)

‎test/activation.jl

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ end
4545
@test gelu(0.0) == 0.0
4646
@test swish(0.0) == 0.0
4747
@test softplus(0.0) log(2.0)
48+
@test softplus(1e8) 1e8
49+
@test softplus(-1e8) 0.0
4850
@test softsign(0.0) == 0.0
4951
@test selu(0.0) == 0.0
5052

0 commit comments

Comments
 (0)
Please sign in to comment.