-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Increase code coverage * Fix * Move detector tests
- Loading branch information
Showing
19 changed files
with
147 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using ADTypes | ||
using DifferentiationInterface | ||
using Test | ||
|
||
@test ADTypes.mode(SecondOrder(AutoForwardDiff(), AutoZygote())) isa ADTypes.ForwardMode | ||
|
||
@test startswith(string(SecondOrder(AutoForwardDiff(), AutoZygote())), "SecondOrder") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
DifferentiationInterface/test/Single/Symbolics/detector.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using ADTypes: ADTypes | ||
using DifferentiationInterface: SymbolicsSparsityDetector | ||
using Symbolics | ||
using Test | ||
|
||
detector = SymbolicsSparsityDetector() | ||
@test detector isa ADTypes.AbstractSparsityDetector | ||
|
||
f(x) = reshape(vcat(x[1], diff(vec(x))), size(x)) | ||
f!(y, x) = copyto!(vec(y), vec(f(x))) | ||
|
||
for x in (rand(4), rand(4, 5)) | ||
@test sum(ADTypes.jacobian_sparsity(f, x, detector)) == 2length(x) - 1 | ||
@test sum(ADTypes.jacobian_sparsity(f!, similar(x), x, detector)) == 2length(x) - 1 | ||
end | ||
|
||
g(x) = sum(abs2, diff(vec(x))) | ||
|
||
for x in (rand(4), rand(4, 5)) | ||
@test sum(ADTypes.hessian_sparsity(g, x, detector)) == 3length(x) - 2 | ||
end |
Oops, something went wrong.