-
-
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
Conversation
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
return DIExtras(DI.prepare_jacobian(prob.f, fx, autodiff, x, Constant(prob.p), strict = Val(false))) | |
return DIExtras(DI.prepare_jacobian( | |
prob.f, fx, autodiff, x, Constant(prob.p), strict = Val(false))) |
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 comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
return DIExtras(DI.prepare_jacobian(prob.f, autodiff, x, Constant(prob.p), strict = Val(false))) | |
return DIExtras(DI.prepare_jacobian( | |
prob.f, autodiff, x, Constant(prob.p), strict = Val(false))) |
@@ -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)) |
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 🐶
di_extras = DI.prepare_pullback(f, fu_cache, autodiff, u, (fu,), Constant(prob.p), strict=Val(false)) | |
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 comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
di_extras = DI.prepare_pullback(f, autodiff, u, (fu,), Constant(prob.p), strict=Val(false)) | |
di_extras = DI.prepare_pullback( | |
f, autodiff, u, (fu,), Constant(prob.p), strict = Val(false)) |
@@ -352,14 +352,14 @@ | |||
@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 comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
di_extras = DI.prepare_pushforward(f, fu_cache, autodiff, u, (u,), Constant(prob.p), strict=Val(false)) | |
di_extras = DI.prepare_pushforward( | |
f, fu_cache, autodiff, u, (u,), Constant(prob.p), strict = Val(false)) |
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 comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
di_extras = DI.prepare_pushforward(f, autodiff, u, (u,), Constant(prob.p), strict=Val(false)) | |
di_extras = DI.prepare_pushforward( | |
f, autodiff, u, (u,), Constant(prob.p), strict = Val(false)) |
@@ -375,7 +375,7 @@ | |||
|
|||
@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 comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶
di_extras = DI.prepare_derivative(f, autodiff, u, Constant(prob.p), strict=Val(false)) | |
di_extras = DI.prepare_derivative(f, autodiff, u, Constant(prob.p), strict = Val(false)) |
The issue is that DI strictness does not allow views, even though most of the AD engines are fine with views.