@@ -8,7 +8,7 @@ struct ReverseModeJacobianCache{CO, CA, J, FX, X, I} <: AbstractMaybeSparseJacob
8
8
end
9
9
10
10
function sparse_jacobian_cache (ad:: Union{AutoEnzyme, AbstractReverseMode} ,
11
- sd:: AbstractMaybeSparsityDetection , f, x; fx = nothing )
11
+ sd:: AbstractMaybeSparsityDetection , f:: F , x; fx = nothing ) where {F}
12
12
fx = fx === nothing ? similar (f (x)) : fx
13
13
coloring_result = sd (ad, f, x)
14
14
jac_prototype = __getfield (coloring_result, Val (:jacobian_sparsity ))
@@ -17,7 +17,7 @@ function sparse_jacobian_cache(ad::Union{AutoEnzyme, AbstractReverseMode},
17
17
end
18
18
19
19
function sparse_jacobian_cache (ad:: Union{AutoEnzyme, AbstractReverseMode} ,
20
- sd:: AbstractMaybeSparsityDetection , f!, fx, x)
20
+ sd:: AbstractMaybeSparsityDetection , f!:: F , fx, x) where {F}
21
21
coloring_result = sd (ad, f!, fx, x)
22
22
jac_prototype = __getfield (coloring_result, Val (:jacobian_sparsity ))
23
23
return ReverseModeJacobianCache (coloring_result, nothing , jac_prototype, fx, x,
@@ -34,12 +34,12 @@ function sparse_jacobian!(J::AbstractMatrix, ad, cache::ReverseModeJacobianCache
34
34
end
35
35
36
36
function __sparse_jacobian_reverse_impl! (J:: AbstractMatrix , ad, idx_vec,
37
- cache:: MatrixColoringResult , f, x)
37
+ cache:: MatrixColoringResult , f:: F , x) where {F}
38
38
return __sparse_jacobian_reverse_impl! (J, ad, idx_vec, cache, f, nothing , x)
39
39
end
40
40
41
41
function __sparse_jacobian_reverse_impl! (J:: AbstractMatrix , ad, idx_vec,
42
- cache:: MatrixColoringResult , f, fx, x)
42
+ cache:: MatrixColoringResult , f:: F , fx, x) where {F}
43
43
# If `fx` is `nothing` then assume `f` is not in-place
44
44
x_ = __maybe_copy_x (ad, x)
45
45
fx_ = __maybe_copy_x (ad, fx)
0 commit comments