Skip to content

Commit

Permalink
remove some AD pkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
prbzrg committed Aug 1, 2023
1 parent 402e5de commit 174813b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 193 deletions.
6 changes: 0 additions & 6 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,23 @@ AbstractDifferentiation = "c29ec348-61ec-40c8-8164-b8c60e9d9f3d"
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
Calculus = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
ComputationalResources = "ed09eef8-17a6-5b46-8889-db040fac31e3"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Lux = "b2108857-7c20-44ae-9111-449ecde12c47"
LuxCUDA = "d0bbae9a-e099-4d5b-a835-1c6931763bda"
MLJBase = "a7f614a8-145f-11e9-1d2a-a57a1082229d"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
cuDNN = "02a925ec-e4fe-4b08-9a7e-0d78e3d38ccd"
Expand Down
152 changes: 0 additions & 152 deletions test/call_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@
AbstractDifferentiation.ZygoteBackend(),
AbstractDifferentiation.ReverseDiffBackend(),
AbstractDifferentiation.ForwardDiffBackend(),
AbstractDifferentiation.TrackerBackend(),
AbstractDifferentiation.FiniteDifferencesBackend(),
]
fd_m = FiniteDifferences.central_fdm(5, 1)
rng = Random.default_rng()

@testset "$at | $tp | $(typeof(adb_u).name.name) | $nvars Vars | $mt" for at in ats,
Expand All @@ -45,9 +42,7 @@
omode in omodes,
mt in mts

adb_u isa AbstractDifferentiation.FiniteDifferencesBackend && continue
adb_u isa AbstractDifferentiation.ReverseDiffBackend && continue
adb_u isa AbstractDifferentiation.TrackerBackend && mt <: Planar && continue

data_dist = Distributions.Beta{tp}(convert(Tuple{tp, tp}, (2, 4))...)
r = convert(at{tp}, rand(data_dist, nvars))
Expand Down Expand Up @@ -85,7 +80,6 @@
diff_loss(x) = loss(icnf, omode, r, x, st)

@testset "Using $(typeof(adb).name.name) For Loss" for adb in adb_list
adb isa AbstractDifferentiation.TrackerBackend && continue
@test_throws MethodError !isnothing(
AbstractDifferentiation.derivative(adb, diff_loss, ps),
)
Expand Down Expand Up @@ -126,27 +120,9 @@
@test_throws DimensionMismatch !isnothing(ForwardDiff.jacobian(diff_loss, ps))
# @test !isnothing(ForwardDiff.hessian(diff_loss, ps))

# @test !isnothing(Tracker.gradient(diff_loss, ps))
# @test !isnothing(Tracker.jacobian(diff_loss, ps))
# @test !isnothing(Tracker.hessian(diff_loss, ps))

@test !isnothing(FiniteDifferences.grad(fd_m, diff_loss, ps))
@test !isnothing(FiniteDifferences.jacobian(fd_m, diff_loss, ps))

@test_throws MethodError !isnothing(
FiniteDiff.finite_difference_derivative(diff_loss, ps),
)
@test !isnothing(FiniteDiff.finite_difference_gradient(diff_loss, ps))
@test_broken !isnothing(FiniteDiff.finite_difference_jacobian(diff_loss, ps))
# @test !isnothing(FiniteDiff.finite_difference_hessian(diff_loss, ps))

@test_throws MethodError !isnothing(Calculus.gradient(diff_loss, ps))
# @test !isnothing(Calculus.hessian(diff_loss, ps))

diff2_loss(x) = loss(icnf, omode, x, ps, st)

@testset "Using $(typeof(adb).name.name) For Loss" for adb in adb_list
adb isa AbstractDifferentiation.TrackerBackend && continue
@test_throws MethodError !isnothing(
AbstractDifferentiation.derivative(adb, diff2_loss, r),
)
Expand Down Expand Up @@ -187,23 +163,6 @@
@test_throws DimensionMismatch !isnothing(ForwardDiff.jacobian(diff2_loss, r))
# @test !isnothing(ForwardDiff.hessian(diff2_loss, r))

# @test !isnothing(Tracker.gradient(diff2_loss, r))
# @test !isnothing(Tracker.jacobian(diff2_loss, r))
# @test !isnothing(Tracker.hessian(diff2_loss, r))

@test !isnothing(FiniteDifferences.grad(fd_m, diff2_loss, r))
@test !isnothing(FiniteDifferences.jacobian(fd_m, diff2_loss, r))

@test_throws MethodError !isnothing(
FiniteDiff.finite_difference_derivative(diff2_loss, r),
)
@test !isnothing(FiniteDiff.finite_difference_gradient(diff2_loss, r))
@test_broken !isnothing(FiniteDiff.finite_difference_jacobian(diff2_loss, r))
# @test !isnothing(FiniteDiff.finite_difference_hessian(diff2_loss, r))

@test_throws MethodError !isnothing(Calculus.gradient(diff2_loss, r))
# @test !isnothing(Calculus.hessian(diff2_loss, r))

d = ICNFDist(icnf, omode, ps, st)

@test !isnothing(Distributions.logpdf(d, r))
Expand Down Expand Up @@ -256,7 +215,6 @@
diff_loss(x) = loss(icnf, omode, r_arr, x, st)

@testset "Using $(typeof(adb).name.name) For Loss" for adb in adb_list
adb isa AbstractDifferentiation.TrackerBackend && continue
@test_throws MethodError !isnothing(
AbstractDifferentiation.derivative(adb, diff_loss, ps),
)
Expand Down Expand Up @@ -297,27 +255,9 @@
@test_throws DimensionMismatch !isnothing(ForwardDiff.jacobian(diff_loss, ps))
# @test !isnothing(ForwardDiff.hessian(diff_loss, ps))

# @test !isnothing(Tracker.gradient(diff_loss, ps))
# @test !isnothing(Tracker.jacobian(diff_loss, ps))
# @test !isnothing(Tracker.hessian(diff_loss, ps))

@test !isnothing(FiniteDifferences.grad(fd_m, diff_loss, ps))
@test !isnothing(FiniteDifferences.jacobian(fd_m, diff_loss, ps))

@test_throws MethodError !isnothing(
FiniteDiff.finite_difference_derivative(diff_loss, ps),
)
@test !isnothing(FiniteDiff.finite_difference_gradient(diff_loss, ps))
@test_broken !isnothing(FiniteDiff.finite_difference_jacobian(diff_loss, ps))
# @test !isnothing(FiniteDiff.finite_difference_hessian(diff_loss, ps))

@test_throws MethodError !isnothing(Calculus.gradient(diff_loss, ps))
# @test !isnothing(Calculus.hessian(diff_loss, ps))

diff2_loss(x) = loss(icnf, omode, x, ps, st)

@testset "Using $(typeof(adb).name.name) For Loss" for adb in adb_list
adb isa AbstractDifferentiation.TrackerBackend && continue
@test_throws MethodError !isnothing(
AbstractDifferentiation.derivative(adb, diff2_loss, r),
)
Expand Down Expand Up @@ -358,23 +298,6 @@
@test_throws DimensionMismatch !isnothing(ForwardDiff.jacobian(diff2_loss, r))
# @test !isnothing(ForwardDiff.hessian(diff2_loss, r))

# @test !isnothing(Tracker.gradient(diff2_loss, r))
# @test !isnothing(Tracker.jacobian(diff2_loss, r))
# @test !isnothing(Tracker.hessian(diff2_loss, r))

@test !isnothing(FiniteDifferences.grad(fd_m, diff2_loss, r))
@test !isnothing(FiniteDifferences.jacobian(fd_m, diff2_loss, r))

@test_throws MethodError !isnothing(
FiniteDiff.finite_difference_derivative(diff2_loss, r),
)
@test !isnothing(FiniteDiff.finite_difference_gradient(diff2_loss, r))
@test_broken !isnothing(FiniteDiff.finite_difference_jacobian(diff2_loss, r))
# @test !isnothing(FiniteDiff.finite_difference_hessian(diff2_loss, r))

@test_throws MethodError !isnothing(Calculus.gradient(diff2_loss, r))
# @test !isnothing(Calculus.hessian(diff2_loss, r))

d = ICNFDist(icnf, omode, ps, st)

@test !isnothing(Distributions.logpdf(d, r))
Expand All @@ -391,10 +314,7 @@
omode in omodes,
mt in cmts

adb_u isa AbstractDifferentiation.FiniteDifferencesBackend && continue
adb_u isa AbstractDifferentiation.ReverseDiffBackend && continue
adb_u isa AbstractDifferentiation.TrackerBackend && continue
adb_u isa AbstractDifferentiation.TrackerBackend && mt <: CondPlanar && continue

data_dist = Distributions.Beta{tp}(convert(Tuple{tp, tp}, (2, 4))...)
data_dist2 = Distributions.Beta{tp}(convert(Tuple{tp, tp}, (4, 2))...)
Expand Down Expand Up @@ -437,7 +357,6 @@
diff_loss(x) = loss(icnf, omode, r, r2, x, st)

@testset "Using $(typeof(adb).name.name) For Loss" for adb in adb_list
adb isa AbstractDifferentiation.TrackerBackend && continue
@test_throws MethodError !isnothing(
AbstractDifferentiation.derivative(adb, diff_loss, ps),
)
Expand Down Expand Up @@ -478,27 +397,9 @@
@test_throws DimensionMismatch !isnothing(ForwardDiff.jacobian(diff_loss, ps))
# @test !isnothing(ForwardDiff.hessian(diff_loss, ps))

# @test !isnothing(Tracker.gradient(diff_loss, ps))
# @test !isnothing(Tracker.jacobian(diff_loss, ps))
# @test !isnothing(Tracker.hessian(diff_loss, ps))

@test !isnothing(FiniteDifferences.grad(fd_m, diff_loss, ps))
@test !isnothing(FiniteDifferences.jacobian(fd_m, diff_loss, ps))

@test_throws MethodError !isnothing(
FiniteDiff.finite_difference_derivative(diff_loss, ps),
)
@test !isnothing(FiniteDiff.finite_difference_gradient(diff_loss, ps))
@test_broken !isnothing(FiniteDiff.finite_difference_jacobian(diff_loss, ps))
# @test !isnothing(FiniteDiff.finite_difference_hessian(diff_loss, ps))

@test_throws MethodError !isnothing(Calculus.gradient(diff_loss, ps))
# @test !isnothing(Calculus.hessian(diff_loss, ps))

diff2_loss(x) = loss(icnf, omode, x, r2, ps, st)

@testset "Using $(typeof(adb).name.name) For Loss" for adb in adb_list
adb isa AbstractDifferentiation.TrackerBackend && continue
@test_throws MethodError !isnothing(
AbstractDifferentiation.derivative(adb, diff2_loss, r),
)
Expand Down Expand Up @@ -539,23 +440,6 @@
@test_throws DimensionMismatch !isnothing(ForwardDiff.jacobian(diff2_loss, r))
# @test !isnothing(ForwardDiff.hessian(diff2_loss, r))

# @test !isnothing(Tracker.gradient(diff2_loss, r))
# @test !isnothing(Tracker.jacobian(diff2_loss, r))
# @test !isnothing(Tracker.hessian(diff2_loss, r))

@test !isnothing(FiniteDifferences.grad(fd_m, diff2_loss, r))
@test !isnothing(FiniteDifferences.jacobian(fd_m, diff2_loss, r))

@test_throws MethodError !isnothing(
FiniteDiff.finite_difference_derivative(diff2_loss, r),
)
@test !isnothing(FiniteDiff.finite_difference_gradient(diff2_loss, r))
@test_broken !isnothing(FiniteDiff.finite_difference_jacobian(diff2_loss, r))
# @test !isnothing(FiniteDiff.finite_difference_hessian(diff2_loss, r))

@test_throws MethodError !isnothing(Calculus.gradient(diff2_loss, r))
# @test !isnothing(Calculus.hessian(diff2_loss, r))

d = CondICNFDist(icnf, omode, r2, ps, st)

@test !isnothing(Distributions.logpdf(d, r))
Expand Down Expand Up @@ -613,7 +497,6 @@
diff_loss(x) = loss(icnf, omode, r_arr, r2_arr, x, st)

@testset "Using $(typeof(adb).name.name) For Loss" for adb in adb_list
adb isa AbstractDifferentiation.TrackerBackend && continue
@test_throws MethodError !isnothing(
AbstractDifferentiation.derivative(adb, diff_loss, ps),
)
Expand Down Expand Up @@ -654,27 +537,9 @@
@test_throws DimensionMismatch !isnothing(ForwardDiff.jacobian(diff_loss, ps))
# @test !isnothing(ForwardDiff.hessian(diff_loss, ps))

# @test !isnothing(Tracker.gradient(diff_loss, ps))
# @test !isnothing(Tracker.jacobian(diff_loss, ps))
# @test !isnothing(Tracker.hessian(diff_loss, ps))

@test !isnothing(FiniteDifferences.grad(fd_m, diff_loss, ps))
@test !isnothing(FiniteDifferences.jacobian(fd_m, diff_loss, ps))

@test_throws MethodError !isnothing(
FiniteDiff.finite_difference_derivative(diff_loss, ps),
)
@test !isnothing(FiniteDiff.finite_difference_gradient(diff_loss, ps))
@test_broken !isnothing(FiniteDiff.finite_difference_jacobian(diff_loss, ps))
# @test !isnothing(FiniteDiff.finite_difference_hessian(diff_loss, ps))

@test_throws MethodError !isnothing(Calculus.gradient(diff_loss, ps))
# @test !isnothing(Calculus.hessian(diff_loss, ps))

diff2_loss(x) = loss(icnf, omode, x, r2, ps, st)

@testset "Using $(typeof(adb).name.name) For Loss" for adb in adb_list
adb isa AbstractDifferentiation.TrackerBackend && continue
@test_throws MethodError !isnothing(
AbstractDifferentiation.derivative(adb, diff2_loss, r),
)
Expand Down Expand Up @@ -715,23 +580,6 @@
@test_throws DimensionMismatch !isnothing(ForwardDiff.jacobian(diff2_loss, r))
# @test !isnothing(ForwardDiff.hessian(diff2_loss, r))

# @test !isnothing(Tracker.gradient(diff2_loss, r))
# @test !isnothing(Tracker.jacobian(diff2_loss, r))
# @test !isnothing(Tracker.hessian(diff2_loss, r))

@test !isnothing(FiniteDifferences.grad(fd_m, diff2_loss, r))
@test !isnothing(FiniteDifferences.jacobian(fd_m, diff2_loss, r))

@test_throws MethodError !isnothing(
FiniteDiff.finite_difference_derivative(diff2_loss, r),
)
@test !isnothing(FiniteDiff.finite_difference_gradient(diff2_loss, r))
@test_broken !isnothing(FiniteDiff.finite_difference_jacobian(diff2_loss, r))
# @test !isnothing(FiniteDiff.finite_difference_hessian(diff2_loss, r))

@test_throws MethodError !isnothing(Calculus.gradient(diff2_loss, r))
# @test !isnothing(Calculus.hessian(diff2_loss, r))

d = CondICNFDist(icnf, omode, r2_arr, ps, st)

@test !isnothing(Distributions.logpdf(d, r))
Expand Down
23 changes: 0 additions & 23 deletions test/fit_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,11 @@
AbstractDifferentiation.ZygoteBackend(),
AbstractDifferentiation.ReverseDiffBackend(),
AbstractDifferentiation.ForwardDiffBackend(),
AbstractDifferentiation.TrackerBackend(),
AbstractDifferentiation.FiniteDifferencesBackend(),
]
go_ads = ADTypes.AbstractADType[
ADTypes.AutoEnzyme(),
ADTypes.AutoZygote(),
ADTypes.AutoReverseDiff(),
ADTypes.AutoForwardDiff(),
ADTypes.AutoTracker(),
ADTypes.AutoFiniteDiff(),
ADTypes.AutoModelingToolkit(),
]

@testset "$at | $tp | $(typeof(adb_u).name.name) for internal | $(typeof(go_ad).name.name) for fitting | $nvars Vars | $mt" for at in
Expand All @@ -52,12 +46,7 @@
nvars in nvars_,
mt in mts

adb_u isa AbstractDifferentiation.FiniteDifferencesBackend && continue
adb_u isa AbstractDifferentiation.ReverseDiffBackend && continue
adb_u isa AbstractDifferentiation.TrackerBackend && mt <: Planar && continue
go_ad isa ADTypes.AutoTracker && continue
go_ad isa ADTypes.AutoEnzyme && continue
go_ad isa ADTypes.AutoModelingToolkit && continue

data_dist = Distributions.Beta{tp}(convert(Tuple{tp, tp}, (2, 4))...)
r = convert(at{tp}, rand(data_dist, nvars, 2))
Expand Down Expand Up @@ -99,9 +88,6 @@
mt in mts

cmode <: SDJacVecMatrixMode && continue
go_ad isa ADTypes.AutoTracker && continue
go_ad isa ADTypes.AutoEnzyme && continue
go_ad isa ADTypes.AutoModelingToolkit && continue

data_dist = Distributions.Beta{tp}(convert(Tuple{tp, tp}, (2, 4))...)
r = convert(at{tp}, rand(data_dist, nvars, 2))
Expand Down Expand Up @@ -136,13 +122,7 @@
nvars in nvars_,
mt in cmts

adb_u isa AbstractDifferentiation.FiniteDifferencesBackend && continue
adb_u isa AbstractDifferentiation.ReverseDiffBackend && continue
adb_u isa AbstractDifferentiation.TrackerBackend && continue
adb_u isa AbstractDifferentiation.TrackerBackend && mt <: CondPlanar && continue
go_ad isa ADTypes.AutoTracker && continue
go_ad isa ADTypes.AutoEnzyme && continue
go_ad isa ADTypes.AutoModelingToolkit && continue

data_dist = Distributions.Beta{tp}(convert(Tuple{tp, tp}, (2, 4))...)
data_dist2 = Distributions.Beta{tp}(convert(Tuple{tp, tp}, (4, 2))...)
Expand Down Expand Up @@ -187,9 +167,6 @@
mt in cmts

cmode <: SDJacVecMatrixMode && continue
go_ad isa ADTypes.AutoTracker && continue
go_ad isa ADTypes.AutoEnzyme && continue
go_ad isa ADTypes.AutoModelingToolkit && continue

data_dist = Distributions.Beta{tp}(convert(Tuple{tp, tp}, (2, 4))...)
data_dist2 = Distributions.Beta{tp}(convert(Tuple{tp, tp}, (4, 2))...)
Expand Down
10 changes: 5 additions & 5 deletions test/instability _tests.jl → test/instability_tests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@testset "Instability" begin
JET.report_package("ContinuousNormalizingFlows")

@test true
end
@testset "Instability" begin
JET.report_package("ContinuousNormalizingFlows")

@test true
end
Loading

0 comments on commit 174813b

Please sign in to comment.