@@ -22,15 +22,6 @@ const ACTIVATIONS = [identity, relu, tanh,
22
22
sigmoid, exp, softplus,
23
23
elu, selu]
24
24
25
- function test_approx (x,y; kw... )
26
- pass = isapprox (x,y; kw... )
27
- if ! pass
28
- kw = (;kw... )
29
- @show norm (x) norm (y) norm (x- y) kw
30
- end
31
- @test pass
32
- end
33
-
34
25
function gpu_gradtest (name:: String , layers:: Vector , x_cpu = nothing , args... ; test_cpu = true )
35
26
isnothing (x_cpu) && error (" Missing input to test the layers against." )
36
27
@testset " $name GPU grad tests" begin
@@ -59,13 +50,11 @@ function gpu_gradtest(name::String, layers::Vector, x_cpu = nothing, args...; te
59
50
60
51
# test
61
52
if test_cpu
62
- test_approx (y_gpu, y_cpu, rtol= 1f-3 , atol= 1f-3 )
63
53
@test y_gpu ≈ y_cpu rtol= 1f-3 atol= 1f-3
64
54
if isnothing (xg_cpu)
65
55
@test isnothing (xg_gpu)
66
56
else
67
- test_approx (Array (xg_gpu), xg_cpu, rtol= 2f-2 , atol= 1f-3 )
68
- # @test Array(xg_gpu) ≈ xg_cpu rtol=1f-3 atol=1f-3
57
+ @test Array (xg_gpu) ≈ xg_cpu rtol= 2f-2 atol= 1f-3
69
58
end
70
59
end
71
60
@test gs_gpu isa Flux. Zygote. Grads
@@ -75,7 +64,6 @@ function gpu_gradtest(name::String, layers::Vector, x_cpu = nothing, args...; te
75
64
else
76
65
@test gs_gpu[p_gpu] isa Flux. CUDA. CuArray
77
66
if test_cpu
78
- test_approx (Array (gs_gpu[p_gpu]), gs_cpu[p_cpu], rtol= 1f-3 , atol= 1f-3 )
79
67
@test Array (gs_gpu[p_gpu]) ≈ gs_cpu[p_cpu] rtol= 1f-3 atol= 1f-3
80
68
end
81
69
end
0 commit comments