|
52 | 52 | @test ad.mode == EnzymeCore.Reverse |
53 | 53 | end |
54 | 54 |
|
| 55 | +@testset "AutoReactant" begin |
| 56 | + ad = AutoReactant() |
| 57 | + @test ad isa AbstractADType |
| 58 | + @test ad isa AutoReactant{<:AutoEnzyme} |
| 59 | + @test ad.mode isa AutoEnzyme |
| 60 | + @test ad.mode.mode === nothing |
| 61 | + @test mode(ad) isa ForwardOrReverseMode |
| 62 | + |
| 63 | + ad = AutoReactant(; mode=AutoEnzyme(; mode = EnzymeCore.Forward)) |
| 64 | + @test ad isa AbstractADType |
| 65 | + @test ad isa AutoReactant{<:AutoEnzyme{typeof(EnzymeCore.Forward), Nothing}} |
| 66 | + @test mode(ad) isa ForwardMode |
| 67 | + @test ad.mode.mode == EnzymeCore.Forward |
| 68 | + |
| 69 | + ad = AutoReactant(; mode=AutoEnzyme(; function_annotation = EnzymeCore.Const)) |
| 70 | + @test ad isa AbstractADType |
| 71 | + @test ad isa AutoReactant{<:AutoEnzyme{Nothing, EnzymeCore.Const}} |
| 72 | + @test mode(ad) isa ForwardOrReverseMode |
| 73 | + @test ad.mode.mode === nothing |
| 74 | + |
| 75 | + ad = AutoReactant(; mode=AutoEnzyme(; |
| 76 | + mode = EnzymeCore.Reverse, function_annotation = EnzymeCore.Duplicated)) |
| 77 | + @test ad isa AbstractADType |
| 78 | + @test ad isa AutoReactant{<:AutoEnzyme{typeof(EnzymeCore.Reverse), EnzymeCore.Duplicated}} |
| 79 | + @test mode(ad) isa ReverseMode |
| 80 | + @test ad.mode.mode == EnzymeCore.Reverse |
| 81 | +end |
| 82 | + |
55 | 83 | @testset "AutoFastDifferentiation" begin |
56 | 84 | ad = AutoFastDifferentiation() |
57 | 85 | @test ad isa AbstractADType |
|
0 commit comments