Skip to content

Commit 4ce2d6c

Browse files
author
Michael Abbott
committed
fix relu
1 parent 6735542 commit 4ce2d6c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/special/misc.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@inline Base.:^(v::AbstractSIMD{W,T}, i::Integer) where {W,T} = Base.power_by_squaring(v, i)
22
@inline Base.:^(v::AbstractSIMD{W,T}, i::Integer) where {W,T<:Union{Float32,Float64}} = Base.power_by_squaring(v, i)
3-
@inline relu(x) = (y = zero(x); IfElse.ifelse(x > y, x, y))
3+
@inline relu(x) = (y = zero(x); ifelse(x > y, x, y))
44

55
@inline Base.fld(x::AbstractSIMD, y::AbstractSIMD) = div(promote(x,y)..., RoundDown)
66

test/runtests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ end
425425
Vec(ntuple(_ -> Core.VecElement(randn()), Val(W64)))
426426
))
427427
x = tovector(v)
428-
for f [-, abs, inv, floor, ceil, trunc, round, sqrt abs]
428+
for f [-, abs, inv, floor, ceil, trunc, round, sqrt abs, VectorizationBase.relu]
429429
@test tovector(@inferred(f(v))) == map(f, x)
430430
end
431431
invtol = VectorizationBase.AVX512F ? 2^-14 : 1.5*2^-12 # moreaccurate with AVX512
@@ -459,7 +459,7 @@ end
459459
xi1 = tovector(vi1); xi2 = tovector(vi2);
460460
xi3 = mapreduce(tovector, vcat, m1.data);
461461
xi4 = mapreduce(tovector, vcat, m2.data);
462-
for f [+, -, *, ÷, /, %, <<, >>, >>>, , &, |, VectorizationBase.rotate_left, VectorizationBase.rotate_right, copysign, max, min]
462+
for f [+, -, *, div, ÷, /, rem, %, <<, >>, >>>, , &, |, VectorizationBase.rotate_left, VectorizationBase.rotate_right, copysign, max, min]
463463
# @show f
464464
check_within_limits(tovector(@inferred(f(vi1, vi2))), f.(xi1, xi2))
465465
check_within_limits(tovector(@inferred(f(j, vi2))), f.(j, xi2))

0 commit comments

Comments
 (0)