We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d07ac0b + bdf167d commit 2bd7e8aCopy full SHA for 2bd7e8a
src/activation.jl
@@ -116,4 +116,4 @@ softsign(x) = x / (one(x) + abs(x))
116
117
See [Deep Sparse Rectifier Neural Networks](http://proceedings.mlr.press/v15/glorot11a/glorot11a.pdf).
118
"""
119
-softplus(x) = log1p(exp(x))
+softplus(x) = ifelse(x > 0, x + log1p(exp(-x)), log1p(exp(x)))
test/activation.jl
@@ -45,6 +45,8 @@ end
45
@test gelu(0.0) == 0.0
46
@test swish(0.0) == 0.0
47
@test softplus(0.0) ≈ log(2.0)
48
+ @test softplus(1e8) ≈ 1e8
49
+ @test softplus(-1e8) ≈ 0.0
50
@test softsign(0.0) == 0.0
51
@test selu(0.0) == 0.0
52
0 commit comments