Skip to content

Commit bc488c7

Browse files
committed
remove debug code
1 parent 734ffef commit bc488c7

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

test/cuda/layers.jl

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,6 @@ const ACTIVATIONS = [identity, relu, tanh,
2222
sigmoid, exp, softplus,
2323
elu, selu]
2424

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-
3425
function gpu_gradtest(name::String, layers::Vector, x_cpu = nothing, args...; test_cpu = true)
3526
isnothing(x_cpu) && error("Missing input to test the layers against.")
3627
@testset "$name GPU grad tests" begin
@@ -59,13 +50,11 @@ function gpu_gradtest(name::String, layers::Vector, x_cpu = nothing, args...; te
5950

6051
# test
6152
if test_cpu
62-
test_approx(y_gpu, y_cpu, rtol=1f-3, atol=1f-3)
6353
@test y_gpu y_cpu rtol=1f-3 atol=1f-3
6454
if isnothing(xg_cpu)
6555
@test isnothing(xg_gpu)
6656
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
6958
end
7059
end
7160
@test gs_gpu isa Flux.Zygote.Grads
@@ -75,7 +64,6 @@ function gpu_gradtest(name::String, layers::Vector, x_cpu = nothing, args...; te
7564
else
7665
@test gs_gpu[p_gpu] isa Flux.CUDA.CuArray
7766
if test_cpu
78-
test_approx(Array(gs_gpu[p_gpu]), gs_cpu[p_cpu], rtol=1f-3, atol=1f-3)
7967
@test Array(gs_gpu[p_gpu]) gs_cpu[p_cpu] rtol=1f-3 atol=1f-3
8068
end
8169
end

0 commit comments

Comments
 (0)