Autodiffing with Enzyme through a DifferentialEquations ODEproblem

Yeah you cannot differentiate w.r.t. the save points with Enzyme because it doesn’t handle keyword arguments like that.

For the record, you can do this with ForwardDiff. You would need to do a trick of forcing duals on your state and time though, i.e.:

	u0 = eltype(t)(1.0)
	tspan = eltype(t).((0.0,1.0))

and then ForwardDiff.jl would give you the derivatives w.r.t. the save points t. This is used in optimal experimental design. I know

uses this

4 Likes