diff --git a/Project.toml b/Project.toml index 00c8622..f88632f 100644 --- a/Project.toml +++ b/Project.toml @@ -3,7 +3,7 @@ uuid = "47edcb42-4c32-4615-8424-f2b9edc5f35b" authors = [ "Vaibhav Dixit , Guillaume Dalle and contributors", ] -version = "1.1.0" +version = "1.2.0" [deps] ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" diff --git a/src/dense.jl b/src/dense.jl index 1751d91..35bcaa4 100644 --- a/src/dense.jl +++ b/src/dense.jl @@ -172,8 +172,14 @@ mode(::AutoSymbolics) = SymbolicMode() Struct used to select the [Tapir.jl](https://github.com/withbayes/Tapir.jl) backend for automatic differentiation. Exported from [ADTypes.jl](https://github.com/SciML/ADTypes.jl). + +# Keyword Arguments + +- `safe_mode::Bool`: whether to run additional checks to catch errors early. On by default. Turn off to maximise performance if your code runs correctly. """ -struct AutoTapir <: AbstractADType end +Base.@kwdef struct AutoTapir <: AbstractADType + safe_mode::Bool = true +end mode(::AutoTapir) = ReverseMode() diff --git a/test/dense.jl b/test/dense.jl index 272d2cf..7753779 100644 --- a/test/dense.jl +++ b/test/dense.jl @@ -138,6 +138,10 @@ end @test ad isa AbstractADType @test ad isa AutoTapir @test mode(ad) isa ReverseMode + @test ad.safe_mode + + ad = AutoTapir(; safe_mode=false) + @test !ad.safe_mode end @testset "AutoTracker" begin