Skip to content

Commit

Permalink
Merge branch 'master' into onlyreal
Browse files Browse the repository at this point in the history
  • Loading branch information
devmotion committed Mar 26, 2019
2 parents ad8b04f + 2bd7e8a commit 4fbf7ab
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
comment: false
2 changes: 1 addition & 1 deletion src/activation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ softsign(x::Real) = x / (one(x) + abs(x))
See [Deep Sparse Rectifier Neural Networks](http://proceedings.mlr.press/v15/glorot11a/glorot11a.pdf).
"""
softplus(x::Real) = log1p(exp(x))
softplus(x::Real) = ifelse(x > 0, x + log1p(exp(-x)), log1p(exp(x)))

# Provide an informative error message if activation functions are called with an array
for f in (, :σ_stable, :logσ, :relu, :leakyrelu, :elu, :gelu, :swish, :selu, :softsign, :softplus)
Expand Down
2 changes: 2 additions & 0 deletions test/activation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ end
@test gelu(0.0) == 0.0
@test swish(0.0) == 0.0
@test softplus(0.0) log(2.0)
@test softplus(1e8) 1e8
@test softplus(-1e8) 0.0
@test softsign(0.0) == 0.0
@test selu(0.0) == 0.0

Expand Down

0 comments on commit 4fbf7ab

Please sign in to comment.