Skip to content

Commit 2f29265

Browse files
committed
Merge branch 'main' into gd/forward_mooncake
2 parents 1f735b3 + 771205e commit 2f29265

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/dense.jl

Lines changed: 4 additions & 4 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()
@@ -307,14 +307,14 @@ Defined by [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
307307
308308
# Constructors
309309
310-
AutoMooncakeForward(; config)
310+
AutoMooncakeForward(; config=nothing)
311311
312312
# Fields
313313
314314
- `config`: either `nothing` or an instance of `Mooncake.Config` -- see the docstring of `Mooncake.Config` for more information. `AutoForwardMooncake(; config=nothing)` is equivalent to `AutoForwardMooncake(; config=Mooncake.Config())`, i.e. the default configuration.
315315
"""
316316
Base.@kwdef struct AutoMooncakeForward{Tconfig} <: AbstractADType
317-
config::Tconfig
317+
config::Tconfig = nothing
318318
end
319319

320320
mode(::AutoMooncakeForward) = ForwardMode()

test/dense.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,18 +127,22 @@ end
127127
end
128128

129129
@testset "AutoMooncake" begin
130-
ad = AutoMooncake(; config = nothing)
130+
ad = AutoMooncake(; config = :config)
131131
@test ad isa AbstractADType
132132
@test ad isa AutoMooncake
133133
@test mode(ad) isa ReverseMode
134+
@test ad.config == :config
135+
ad = AutoMooncake()
134136
@test ad.config === nothing
135137
end
136138

137139
@testset "AutoMooncakeForward" begin
138-
ad = AutoMooncakeForward(; config = nothing)
140+
ad = AutoMooncakeForward(; config = :config)
139141
@test ad isa AbstractADType
140142
@test ad isa AutoMooncakeForward
141143
@test mode(ad) isa ForwardMode
144+
@test ad.config === :config
145+
ad = AutoMooncakeForward()
142146
@test ad.config === nothing
143147
end
144148

0 commit comments

Comments
 (0)