Skip to content

Commit 771205e

Browse files
Merge pull request #112 from SciML/gd/mooncake_default
Allow calling `AutoMooncake()` without the `config` keyword
2 parents 623e6af + 5e7a91a commit 771205e

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ADTypes"
22
uuid = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
33
authors = ["Vaibhav Dixit <[email protected]>, Guillaume Dalle and contributors"]
4-
version = "1.14.1"
4+
version = "1.15.0"
55

66
[deps]
77
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"

src/dense.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,14 @@ Defined by [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
282282
283283
# Constructors
284284
285-
AutoMooncake(; config)
285+
AutoMooncake(; config=nothing)
286286
287287
# Fields
288288
289289
- `config`: either `nothing` or an instance of `Mooncake.Config` -- see the docstring of `Mooncake.Config` for more information. `AutoMooncake(; config=nothing)` is equivalent to `AutoMooncake(; config=Mooncake.Config())`, i.e. the default configuration.
290290
"""
291291
Base.@kwdef struct AutoMooncake{Tconfig} <: AbstractADType
292-
config::Tconfig
292+
config::Tconfig = nothing
293293
end
294294

295295
mode(::AutoMooncake) = ReverseMode()

test/dense.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ end
7171
@test ad.absstep === nothing
7272
@test ad.dir
7373

74-
ad = AutoFiniteDiff(; fdtype = Val(:central), fdjtype = Val(:forward), relstep = 1e-3, absstep = 1e-4, dir = false)
74+
ad = AutoFiniteDiff(; fdtype = Val(:central), fdjtype = Val(:forward),
75+
relstep = 1e-3, absstep = 1e-4, dir = false)
7576
@test ad isa AbstractADType
7677
@test ad isa AutoFiniteDiff
7778
@test mode(ad) isa ForwardMode
@@ -126,10 +127,12 @@ end
126127
end
127128

128129
@testset "AutoMooncake" begin
129-
ad = AutoMooncake(; config=nothing)
130+
ad = AutoMooncake(; config = :config)
130131
@test ad isa AbstractADType
131132
@test ad isa AutoMooncake
132133
@test mode(ad) isa ReverseMode
134+
@test ad.config == :config
135+
ad = AutoMooncake()
133136
@test ad.config === nothing
134137
end
135138

0 commit comments

Comments
 (0)