Skip to content

Conversation

ChrisRackauckas
Copy link
Member

The issue is that DI strictness does not allow views, even though most of the AD engines are fine with views.

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)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
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)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
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)))

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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
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))

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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
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))

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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
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))

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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
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))

@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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
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))

@ChrisRackauckas ChrisRackauckas merged commit 6c893d2 into master Jul 20, 2025
80 of 98 checks passed
@ChrisRackauckas ChrisRackauckas deleted the ChrisRackauckas-patch-1 branch July 20, 2025 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant