-
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.
Move sparse AD code to SparseMatrixColorings extension
- Loading branch information
Showing
7 changed files
with
74 additions
and
41 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
40 changes: 40 additions & 0 deletions
40
...tionInterfaceSparseMatrixColoringsExt/DifferentiationInterfaceSparseMatrixColoringsExt.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,40 @@ | ||
module DifferentiationInterfaceSparseMatrixColoringsExt | ||
|
||
using ADTypes: AutoSparse, dense_ad | ||
using ADTypes: coloring_algorithm, sparsity_detector, jacobian_sparsity, hessian_sparsity | ||
using Compat | ||
using DifferentiationInterface | ||
using DifferentiationInterface: | ||
Batch, | ||
GradientExtras, | ||
JacobianExtras, | ||
HessianExtras, | ||
HVPExtras, | ||
hvp_batched, | ||
make_seed, | ||
maybe_inner, | ||
pick_batchsize, | ||
pushforward_batched, | ||
pullback_batched, | ||
prepare_gradient, | ||
prepare_hvp_batched_same_point, | ||
prepare_pushforward_batched_same_point, | ||
prepare_pullback_batched_same_point | ||
import DifferentiationInterface as DI | ||
using SparseMatrixColorings: | ||
AbstractColoringResult, | ||
ColoringProblem, | ||
GreedyColoringAlgorithm, | ||
coloring, | ||
column_colors, | ||
row_colors, | ||
column_groups, | ||
row_groups, | ||
decompress, | ||
decompress! | ||
|
||
include("fallbacks.jl") | ||
include("jacobian.jl") | ||
include("hessian.jl") | ||
|
||
end |
9 changes: 9 additions & 0 deletions
9
DifferentiationInterface/ext/DifferentiationInterfaceSparseMatrixColoringsExt/fallbacks.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,9 @@ | ||
DI.check_available(backend::AutoSparse) = DI.check_available(dense_ad(backend)) | ||
DI.twoarg_support(backend::AutoSparse) = DI.twoarg_support(dense_ad(backend)) | ||
|
||
function DI.pushforward_performance(backend::AutoSparse) | ||
return DI.pushforward_performance(dense_ad(backend)) | ||
end | ||
|
||
DI.pullback_performance(backend::AutoSparse) = DI.pullback_performance(dense_ad(backend)) | ||
DI.hvp_mode(backend::AutoSparse{<:SecondOrder}) = DI.hvp_mode(dense_ad(backend)) |
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 was deleted.
Oops, something went wrong.