@@ -6,7 +6,6 @@ import FiniteDifferences, ForwardDiff, Enzyme, Tracker, Zygote, ReverseDiff # ba
6
6
import ADTypes # load support for AD types with options
7
7
import BenchmarkTools # load the heuristic chunks code
8
8
using ComponentArrays: ComponentVector # test with other vector types
9
- import DifferentiationInterface
10
9
11
10
struct EnzymeTestMode <: Enzyme.Mode{Enzyme.DefaultABI, false, false} end
12
11
@@ -71,6 +70,15 @@ struct TestTag end
71
70
# Allow tag type in gradient etc. calls of the log density function
72
71
ForwardDiff. checktag (:: Type{ForwardDiff.Tag{TestTag, V}} , :: Base.Fix1{typeof(logdensity),typeof(TestLogDensity())} , :: AbstractArray{V} ) where {V} = true
73
72
73
+ @testset " Missing DI for unsupported ADType" begin
74
+ msg = " Don't know how to AD with AutoFiniteDifferences. Did you forget to load DifferentiationInterface?"
75
+ adtype = ADTypes. AutoFiniteDifferences (; fdm= FiniteDifferences. central_fdm (5 , 1 ))
76
+ @test_throws msg ADgradient (adtype, TestLogDensity2 ())
77
+ @test_throws msg ADgradient (adtype, TestLogDensity2 (); x= zeros (20 ))
78
+ end
79
+
80
+ import DifferentiationInterface
81
+
74
82
@testset " AD via ReverseDiff" begin
75
83
ℓ = TestLogDensity ()
76
84
296
304
297
305
@testset " ADgradient missing method" begin
298
306
msg = " Don't know how to AD with Foo, consider `import Foo` if there is such a package."
299
- @test_logs ((:info , msg), @test_throws (MethodError, ADgradient (:Foo , TestLogDensity2 ())))
307
+ @test_throws msg ADgradient (:Foo , TestLogDensity2 ())
308
+ @test_throws msg ADgradient (:Foo , TestLogDensity2 (); x= zeros (20 ))
309
+ @test_throws msg ADgradient (Val (:Foo ), TestLogDensity2 ())
310
+ @test_throws msg ADgradient (Val (:Foo ), TestLogDensity2 (); x= zeros (20 ))
300
311
end
301
312
302
313
@testset " benchmark ForwardDiff chunk size" begin
0 commit comments