Skip to content

Commit 04203ab

Browse files
Add AutoModelingToolkit to deprecations (#51)
* Add AutoModelingToolkit to deprecations * Add deprecation tests and remove redundent legacy exports --------- Co-authored-by: Guillaume Dalle <[email protected]>
1 parent d4a014a commit 04203ab

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

src/ADTypes.jl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@ export AutoChainRules,
3939

4040
export AutoSparse
4141

42-
# legacy
43-
44-
export AutoSparseFastDifferentiation,
45-
AutoSparseFiniteDiff,
46-
AutoSparseForwardDiff,
47-
AutoSparsePolyesterForwardDiff,
48-
AutoSparseReverseDiff,
49-
AutoSparseZygote
42+
# legacy exports are taken care of by @deprecated
5043

5144
end

src/legacy.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@
1010
@deprecate AutoSparseReverseDiff(; kwargs...) AutoSparse(AutoReverseDiff(; kwargs...))
1111

1212
@deprecate AutoSparseZygote() AutoSparse(AutoZygote())
13+
14+
@deprecate AutoModelingToolkit(; kwargs...) AutoSparse(AutoSymbolics())

test/legacy.jl

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1+
@testset "AutoModelingToolkig" begin
2+
ad = @test_deprecated AutoModelingToolkit()
3+
@test ad isa AbstractADType
4+
@test ad isa AutoSparse
5+
@test dense_ad(ad) isa AutoSymbolics
6+
end
7+
18
@testset "AutoSparseFastDifferentiation" begin
2-
ad = AutoSparseFastDifferentiation()
9+
ad = @test_deprecated AutoSparseFastDifferentiation()
310
@test ad isa AbstractADType
411
@test dense_ad(ad) isa AutoFastDifferentiation
512
end
613

714
@testset "AutoSparseFiniteDiff" begin
8-
ad = AutoSparseFiniteDiff()
15+
ad = @test_deprecated AutoSparseFiniteDiff()
916
@test ad isa AbstractADType
1017
@test dense_ad(ad) isa AutoFiniteDiff
1118
@test dense_ad(ad).fdtype === Val(:forward)
@@ -14,30 +21,31 @@ end
1421
end
1522

1623
@testset "AutoSparseForwardDiff" begin
17-
ad = AutoSparseForwardDiff()
24+
ad = @test_deprecated AutoSparseForwardDiff()
1825
@test ad isa AbstractADType
1926
@test dense_ad(ad) isa AutoForwardDiff{nothing, Nothing}
2027

21-
ad = AutoSparseForwardDiff(; chunksize = 10, tag = CustomTag())
28+
ad = @test_deprecated AutoSparseForwardDiff(; chunksize = 10, tag = CustomTag())
2229
@test ad isa AbstractADType
2330
@test dense_ad(ad) isa AutoForwardDiff{10, CustomTag}
2431
end
2532

2633
@testset "AutoSparsePolyesterForwardDiff" begin
27-
ad = AutoSparsePolyesterForwardDiff(; chunksize = 10, tag = CustomTag())
34+
ad = @test_deprecated AutoSparsePolyesterForwardDiff(;
35+
chunksize = 10, tag = CustomTag())
2836
@test ad isa AbstractADType
2937
@test dense_ad(ad) isa AutoPolyesterForwardDiff{10, CustomTag}
3038
end
3139

3240
@testset "AutoSparseReverseDiff" begin
33-
ad = AutoSparseReverseDiff(; compile = true)
41+
ad = @test_deprecated AutoSparseReverseDiff(; compile = true)
3442
@test ad isa AbstractADType
3543
@test dense_ad(ad) isa AutoReverseDiff
3644
@test dense_ad(ad).compile
3745
end
3846

3947
@testset "AutoSparseZygote" begin
40-
ad = AutoSparseZygote()
48+
ad = @test_deprecated AutoSparseZygote()
4149
@test ad isa AbstractADType
4250
@test dense_ad(ad) isa AutoZygote
4351
end

0 commit comments

Comments
 (0)