You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug 🐞
Related to DARPA-ASKEM/sciml-service#177
A simple harmonic oscillator model that uses component arrays to hold the state and the parameters.
Expected behavior
I want to get the gradient of fake_loss with respect to the parameter k
Minimal Reproducible Example 👇
using ComponentArrays, OrdinaryDiffEq
x0 = [1.0]
v0 = [0.0]
u₀ =ComponentArray(X=x0, V=v0)
p =ComponentArray(k=1.0)
tₑ =10f(du, u, p, t) =begin
X = u.X
k = p.k
V = u.V
var"•1"=-k
V̇ =var"•1".* X
getproperty(du, :X) .= V
getproperty(du, :V) .= V̇
returnnothingend
data_prob =ODEProblem{true,SciMLBase.FullSpecialize}(f, u₀, (0, tₑ), p)
solve(data_prob, Tsit5())
using SciMLSensitivity, Zygote, Enzyme
Enzyme.API.runtimeActivity!(true)
functionfake_loss(par)
prob =remake(data_prob, p=par)
soln =solve(prob, Tsit5(), sensealg =ForwardDiffSensitivity()))
@info("Done")
# return soln(tₑ)sum(last(soln)) # last, not soln(tₑ) because to avoid interpolation fails when AD fails.end
Julia Version 1.10.4
Commit 48d4fd48430 (2024-06-0410:41 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU:16× AMD Ryzen 76800U with Radeon Graphics
WORD_SIZE:64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, znver3)
Threads:16 default, 0 interactive, 8 GC (on 16 virtual cores)
Environment:
JULIA_EDITOR = code
Additional context
The continuous adjoint sensealgs work, but not ForwardDiff or FowardSensitivity. Enzyme will work if the runtime activity option is used.
The text was updated successfully, but these errors were encountered:
Note that I am seeing something specifically with Tracker, and that should get resolved over the next week. But if you're not doing TrackerAdjoint with ComponentArray p you should generally be fine with ComponentArrays.
Describe the bug 🐞
Related to DARPA-ASKEM/sciml-service#177
A simple harmonic oscillator model that uses component arrays to hold the state and the parameters.
Expected behavior
I want to get the gradient of
fake_loss
with respect to the parameterk
Minimal Reproducible Example 👇
Error & Stacktrace⚠️
Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Additional context
The continuous adjoint sensealgs work, but not ForwardDiff or FowardSensitivity. Enzyme will work if the runtime activity option is used.
The text was updated successfully, but these errors were encountered: