From 40896bfe38d09ee02c31d9445ff739a7e2aec911 Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Thu, 5 Sep 2019 17:16:32 +0200 Subject: [PATCH] reduce the chunk size for the hessian test --- test/HessianTest.jl | 4 ++-- test/utils.jl | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/HessianTest.jl b/test/HessianTest.jl index f9125c92..1df4232b 100644 --- a/test/HessianTest.jl +++ b/test/HessianTest.jl @@ -22,7 +22,7 @@ h = [-66.0 -40.0 0.0; -40.0 130.0 -80.0; 0.0 -80.0 200.0] -for c in (1, 2, 3), tag in (nothing, Tag((f,ForwardDiff.gradient), eltype(x))) +for c in HESSIAN_CHUNK_SIZES, tag in (nothing, Tag((f,ForwardDiff.gradient), eltype(x))) println(" ...running hardcoded test with chunk size = $c and tag = $(repr(tag))") cfg = ForwardDiff.HessianConfig(f, x, ForwardDiff.Chunk{c}(), tag) resultcfg = ForwardDiff.HessianConfig(f, DiffResults.HessianResult(x), x, ForwardDiff.Chunk{c}(), tag) @@ -68,7 +68,7 @@ for f in DiffTests.VECTOR_TO_NUMBER_FUNCS h = ForwardDiff.hessian(f, X) # finite difference approximation error is really bad for Hessians... @test isapprox(h, Calculus.hessian(f, X), atol=0.02) - for c in CHUNK_SIZES, tag in (nothing, Tag((f,ForwardDiff.gradient), eltype(x))) + for c in HESSIAN_CHUNK_SIZES, tag in (nothing, Tag((f,ForwardDiff.gradient), eltype(x))) println(" ...testing $f with chunk size = $c and tag = $(repr(tag))") cfg = ForwardDiff.HessianConfig(f, X, ForwardDiff.Chunk{c}(), tag) resultcfg = ForwardDiff.HessianConfig(f, DiffResults.HessianResult(X), X, ForwardDiff.Chunk{c}(), tag) diff --git a/test/utils.jl b/test/utils.jl index ff31550f..5f4e9bb2 100644 --- a/test/utils.jl +++ b/test/utils.jl @@ -11,4 +11,5 @@ const XLEN = DEFAULT_CHUNK_THRESHOLD + 1 const YLEN = div(DEFAULT_CHUNK_THRESHOLD, 2) + 1 const X, Y = rand(XLEN), rand(YLEN) const CHUNK_SIZES = (1, div(DEFAULT_CHUNK_THRESHOLD, 3), div(DEFAULT_CHUNK_THRESHOLD, 2), DEFAULT_CHUNK_THRESHOLD, DEFAULT_CHUNK_THRESHOLD + 1) +const HESSIAN_CHUNK_SIZES = (1, 2, 3) const FINITEDIFF_ERROR = 3e-5