We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d039e53 + 01cff42 commit 1ddc132Copy full SHA for 1ddc132
1 file changed
lib/ModelingToolkitBase/src/ModelingToolkitBase.jl
@@ -363,6 +363,13 @@ function EnzymeCore.EnzymeRules.inactive_noinl(
363
)
364
return true
365
end
366
+# Declare the type itself inactive so Enzyme's runtime-activity dispatch
367
+# (e.g. `MixedDuplicated`-wrapping) never tries to track a `System` as a
368
+# differentiable value. Without this, `Enzyme.gradient(set_runtime_activity(Reverse),
369
+# Const(loss), p)` over a closure capturing an MTK-generated problem
370
+# (which transitively carries the symbolic `System`) trips a
371
+# `MethodError MixedDuplicated(::System, ::System)` in `create_activity_wrapper`.
372
+EnzymeCore.EnzymeRules.inactive_type(::Type{<:AbstractSystem}) = true
373
374
function __init__()
375
SU.hashcons(unwrap(t_nounits), true)
0 commit comments