Skip to content

Commit 89eb296

Browse files
committed
added leakyrelu
1 parent 676b668 commit 89eb296

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/special/misc.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ end
8787
pow_by_square(x, StaticInt(N))
8888
# @inline relu(x) = (y = zero(x); ifelse(x > y, x, y))
8989
@inline relu(x) = (y = zero(x); ifelse(x < y, y, x))
90+
@inline leakyrelu(x, a = 0.01) = (y = zero(x); ifelse(x < y, x*a, x))
9091

9192
Base.sign(v::AbstractSIMD) = ifelse(v > 0, one(v), -one(v))
9293

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,7 @@ include("testsetup.jl")
10711071
trunc,
10721072
round,
10731073
VectorizationBase.relu,
1074+
VectorizationBase.leakyrelu,
10741075
abs2,
10751076
Base.FastMath.abs2_fast,
10761077
Base.FastMath.sub_fast,

0 commit comments

Comments
 (0)