Skip to content

Commit

Permalink
Merge branch 'master' into kellertuer/polish-diff-interfaces
Browse files Browse the repository at this point in the history
# Conflicts:
#	Project.toml
#	src/Manifolds.jl
#	src/differentiation/differentiation.jl
#	src/differentiation/finite_diff.jl
#	src/differentiation/reverse_diff.jl
#	src/differentiation/riemannian_diff.jl
#	src/differentiation/zygote.jl
#	test/differentiation.jl
  • Loading branch information
kellertuer committed Sep 24, 2021
2 parents 4376b8b + 2a03fb1 commit b2f2674
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/differentiation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,42 @@ using LinearAlgebra: Diagonal, dot
set_default_differential_backend!(fd51)
end

using ReverseDiff

reverse_diff = Manifolds.ReverseDiffBackend()
@testset "ReverseDiff" begin
@test diff_backend() isa Manifolds.FiniteDifferencesBackend
@test length(diff_backends()) == 4
@test diff_backends()[3] == reverse_diff

@test diff_backend!(reverse_diff) == reverse_diff
@test diff_backend() == reverse_diff
@test diff_backend!(fd51) isa Manifolds.FiniteDifferencesBackend
@test diff_backend() isa Manifolds.FiniteDifferencesBackend

diff_backend!(reverse_diff)
@test diff_backend() == reverse_diff
diff_backend!(fd51)
end

using Zygote: Zygote

zygote_diff = Manifolds.ZygoteDiffBackend()
@testset "Zygote" begin
@test diff_backend() isa Manifolds.FiniteDifferencesBackend
@test length(diff_backends()) == 5
@test diff_backends()[5] == zygote_diff

@test diff_backend!(zygote_diff) == zygote_diff
@test diff_backend() == zygote_diff
@test diff_backend!(fd51) isa Manifolds.FiniteDifferencesBackend
@test diff_backend() isa Manifolds.FiniteDifferencesBackend

diff_backend!(zygote_diff)
@test diff_backend() == zygote_diff
diff_backend!(fd51)
end

@testset "gradient" begin
set_default_differential_backend!(fd51)
r2 = Euclidean(2)
Expand Down

0 comments on commit b2f2674

Please sign in to comment.