Skip to content

Commit

Permalink
Merge pull request #59 from pevnak/pull-request/ea057b05
Browse files Browse the repository at this point in the history
softplus
  • Loading branch information
MikeInnes authored Mar 26, 2019
2 parents d07ac0b + bdf167d commit 2bd7e8a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/activation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ softsign(x) = x / (one(x) + abs(x))
See [Deep Sparse Rectifier Neural Networks](http://proceedings.mlr.press/v15/glorot11a/glorot11a.pdf).
"""
softplus(x) = log1p(exp(x))
softplus(x) = ifelse(x > 0, x + log1p(exp(-x)), log1p(exp(x)))
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 2bd7e8a

Please sign in to comment.