-
-
Notifications
You must be signed in to change notification settings - Fork 46
Turn off DI strictness #643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -307,14 +307,14 @@ function prepare_vjp(::Val{false}, prob::AbstractNonlinearProblem, | |||||||
@assert DI.check_inplace(autodiff) "Backend: $(autodiff) doesn't support in-place \ | ||||||||
problems." | ||||||||
fu_cache = copy(fu) | ||||||||
di_extras = DI.prepare_pullback(f, fu_cache, autodiff, u, (fu,), Constant(prob.p)) | ||||||||
di_extras = DI.prepare_pullback(f, fu_cache, autodiff, u, (fu,), Constant(prob.p), strict=Val(false)) | ||||||||
return @closure (vJ, v, u, p) -> begin | ||||||||
DI.pullback!(f, fu_cache, (reshape(vJ, size(u)),), di_extras, autodiff, | ||||||||
u, (reshape(v, size(fu_cache)),), Constant(p)) | ||||||||
return | ||||||||
end | ||||||||
else | ||||||||
di_extras = DI.prepare_pullback(f, autodiff, u, (fu,), Constant(prob.p)) | ||||||||
di_extras = DI.prepare_pullback(f, autodiff, u, (fu,), Constant(prob.p), strict=Val(false)) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||
return @closure (v, u, p) -> begin | ||||||||
return only(DI.pullback( | ||||||||
f, di_extras, autodiff, u, (reshape(v, size(fu)),), Constant(p))) | ||||||||
|
@@ -352,14 +352,14 @@ function prepare_jvp(::Val{false}, prob::AbstractNonlinearProblem, | |||||||
@assert DI.check_inplace(autodiff) "Backend: $(autodiff) doesn't support in-place \ | ||||||||
problems." | ||||||||
fu_cache = copy(fu) | ||||||||
di_extras = DI.prepare_pushforward(f, fu_cache, autodiff, u, (u,), Constant(prob.p)) | ||||||||
di_extras = DI.prepare_pushforward(f, fu_cache, autodiff, u, (u,), Constant(prob.p), strict=Val(false)) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||
return @closure (Jv, v, u, p) -> begin | ||||||||
DI.pushforward!(f, fu_cache, (reshape(Jv, size(fu_cache)),), di_extras, | ||||||||
autodiff, u, (reshape(v, size(u)),), Constant(p)) | ||||||||
return | ||||||||
end | ||||||||
else | ||||||||
di_extras = DI.prepare_pushforward(f, autodiff, u, (u,), Constant(prob.p)) | ||||||||
di_extras = DI.prepare_pushforward(f, autodiff, u, (u,), Constant(prob.p), strict=Val(false)) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||
return @closure (v, u, p) -> begin | ||||||||
return only(DI.pushforward( | ||||||||
f, di_extras, autodiff, u, (reshape(v, size(u)),), Constant(p))) | ||||||||
|
@@ -375,7 +375,7 @@ function prepare_scalar_op(::Val{false}, prob::AbstractNonlinearProblem, | |||||||
|
||||||||
@assert autodiff!==nothing "`autodiff` must be provided if `f` doesn't have \ | ||||||||
analytic `vjp` or `jvp` or `jac`." | ||||||||
di_extras = DI.prepare_derivative(f, autodiff, u, Constant(prob.p)) | ||||||||
di_extras = DI.prepare_derivative(f, autodiff, u, Constant(prob.p), strict=Val(false)) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||
return @closure (v, u, p) -> DI.derivative(f, di_extras, autodiff, u, Constant(p)) * v | ||||||||
end | ||||||||
|
||||||||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -87,10 +87,10 @@ end | |||||||
function prepare_jacobian(prob, autodiff, fx, x) | ||||||||
SciMLBase.has_jac(prob.f) && return AnalyticJacobian() | ||||||||
if SciMLBase.isinplace(prob.f) | ||||||||
return DIExtras(DI.prepare_jacobian(prob.f, fx, autodiff, x, Constant(prob.p))) | ||||||||
return DIExtras(DI.prepare_jacobian(prob.f, fx, autodiff, x, Constant(prob.p), strict = Val(false))) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||
else | ||||||||
x isa SArray && return DINoPreparation() | ||||||||
return DIExtras(DI.prepare_jacobian(prob.f, autodiff, x, Constant(prob.p))) | ||||||||
return DIExtras(DI.prepare_jacobian(prob.f, autodiff, x, Constant(prob.p), strict = Val(false))) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||
end | ||||||||
end | ||||||||
|
||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶