Skip to content

Commit

Permalink
forwarddiff tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Drvi authored and MikeInnes committed Dec 15, 2017
1 parent ee3eae8 commit 56bb473
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/activation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ function test_value_int_input_forces_float64(a)
end
end

if Base.find_in_path("ForwardDiff") nothing
using ForwardDiff
function test_value_duals(a)
@testset "$(a): " begin
for T in [Float32, Float64, Int32, Int64]
val = @inferred a(ForwardDiff.Dual(float(T(1)), one(float(T))))
@test typeof(val) == ForwardDiff.Dual{Void,float(T),1}
end
end
end

test_value_duals.(ACTIVATION_FUNCTIONS)
end

@testset "Activation Functions" begin

@test σ(0.0) == 0.5
Expand Down

0 comments on commit 56bb473

Please sign in to comment.