@@ -1812,7 +1812,7 @@ function DiffEqBase._concrete_solve_adjoint(
18121812
18131813 dp = adjoint_sensitivities (sol, alg; sensealg = sensealg, dgdu = df)
18141814
1815- dp, Δtunables = if Δ isa AbstractArray || Δ isa Number
1815+ dp, Δtunables = if Δ isa AbstractArray || Δ isa Number
18161816 # if Δ isa AbstractArray, the gradients correspond to `u`
18171817 # this is something that needs changing in the future, but
18181818 # this is the applicable till the movement to structuaral
@@ -1828,10 +1828,15 @@ function DiffEqBase._concrete_solve_adjoint(
18281828 end
18291829 else
18301830 dp, Δtunables = if isscimlstructure (p)
1831- Δp = setproperties (dp, to_nt (Δ. prob. p))
1832- Δtunables, _, _ = canonicalize (Tunable (), Δp)
1833- dp, _, _ = canonicalize (Tunable (), dp)
1834- dp, Δtunables
1831+ if (Δ. prob. p == ZeroTangent () || Δ. prob. p == NoTangent ())
1832+ dp, _, _ = canonicalize (Tunable (), dp)
1833+ dp, nothing
1834+ else
1835+ Δp = setproperties (dp, to_nt (Δ. prob. p))
1836+ Δtunables, _, _ = canonicalize (Tunable (), Δp)
1837+ dp, _, _ = canonicalize (Tunable (), dp)
1838+ dp, Δtunables
1839+ end
18351840 elseif isfunctor (p)
18361841 dp, _ = Functors. functor (dp)
18371842 Δtunables, _ = Functors. functor (Δ. prob. p)
0 commit comments