Skip to content

Commit 259cb68

Browse files
jClugstorChrisRackauckas
authored andcommitted
use gradient, p might not be scalar
1 parent 306b5d2 commit 259cb68

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/BracketingNonlinearSolve/ext/BracketingNonlinearSolveChainRulesCoreExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function ChainRulesCore.rrule(
1818
function ∇bracketingnonlinear_solve_up(Δ)
1919
# Δ = dg/du
2020
λ = only(ForwardDiff.derivative(u -> f(u, p), only(u)) \ Δ.u)
21-
dgdp = -λ * ForwardDiff.derivative(p -> f(u, p), only(p))
21+
dgdp = -λ * ForwardDiff.gradient(p -> f(u, p), p)
2222
return (NoTangent(), NoTangent(), NoTangent(),
2323
dgdp, NoTangent(),
2424
ntuple(_ -> NoTangent(), length(args))...)

0 commit comments

Comments
 (0)