Closed ekinakyurek closed 6 years ago
We can do a trick if you want to test Float32 errors rather than precision.
I am adding an example here:
function justcheck(f, w, x...; kwargs=[], o...) # define this function in test/gradcheck.jl
y = f(w, x...; kwargs...)
if !isa(y,Number); f = gc_scalar(f); end
g = grad(f)
d = g(w, x...; kwargs...)
return true
end
@testset "base" begin
for ft in [Float64,Float32]
if ft == Float32
gradcheck=gradcheckN=justcheck # since it is defined in this @testset, it does not create a problem for other tests
end
.
.
.
What do you think ?
manually merged this.
I added Float32 tests to testsets.
It turns out that there are failing tests for only Float32. I added them here:
https://github.com/denizyuret/AutoGrad.jl/blob/89ff1bce4f2e4d394bdda3767615dec243d3210d/test/base.jl#L37
https://github.com/denizyuret/AutoGrad.jl/blob/89ff1bce4f2e4d394bdda3767615dec243d3210d/test/base.jl#L74
https://github.com/denizyuret/AutoGrad.jl/blob/89ff1bce4f2e4d394bdda3767615dec243d3210d/test/linearalgebra.jl#L46
https://github.com/denizyuret/AutoGrad.jl/blob/89ff1bce4f2e4d394bdda3767615dec243d3210d/test/neuralnet.jl#L19