Skip to content

Commit

Permalink
define NNlib.leakyrelu(::AbstractSIMD) for Julia 1.6 test
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed May 3, 2024
1 parent 51ee029 commit c948864
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/forwarddiffext.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ function tovec(x::ForwardDiff.Dual{T,V,N}) where {T,V,N}
return ret
end

if LoopVectorization.ifelse !== Base.ifelse
@inline function NNlib.leakyrelu(x::LoopVectorization.AbstractSIMD, a=NNlib.oftf(x, NNlib.leakyrelu_a))
LoopVectorization.ifelse(x>0, float(x), NNlib.oftf(x, a*x)) # max(a*x, x) is 3x slower
end
end

vx0 = randnvec()
vx1 = randnvec()
Expand Down

0 comments on commit c948864

Please sign in to comment.