Skip to content

Instantly share code, notes, and snippets.

@ramboldio
Last active January 10, 2024 10:36
Show Gist options
  • Save ramboldio/925aa3eeea505a0ddf3221cf4b5e94c1 to your computer and use it in GitHub Desktop.
Save ramboldio/925aa3eeea505a0ddf3221cf4b5e94c1 to your computer and use it in GitHub Desktop.
# You will find a step-by-step guide to this example in the docs and the
# corresponding jupyter notebook on our github repository.
using DifferentialEquations
using LightGraphs
using NetworkDynamics
using Plots
using LinearAlgebra
using DiffEqFlux, DiffEqSensitivity, Flux, OrdinaryDiffEq, Zygote
### Defining a graph
N = 10 # number of nodes
k = 3 # average degree
g = barabasi_albert(N, k, seed=43) # a little more exciting than a bare random graph
c = 10000.0
d = 100.0
m = 100.0
s_unstreched = 0.2
grav = [-9.81, 0.0, 0.0]
### Functions for edges and vertices
# the edge and vertex functions are mutating, hence
# by convention `!` is appended to their names
unpack_displacement = v -> [v[1], v[2], v[3]]
unpack_velocity = v -> [v[4], v[5], v[6]]
# e=edges, v_s=source-vertices, v_d=destination-vertices, p=parameters, t=time
function diffusionedge!(e, v_s, v_d, p, t)
# usually e, v_s, v_d are arrays, hence we use the broadcasting operator.
r_source = unpack_displacement(v_s)
r_dest = unpack_displacement(v_d)
v_source = unpack_velocity(v_s)
v_dest = unpack_velocity(v_d)
c_ = p
r_vec = r_source - r_dest
# spring_force = (r_vec + (s_unstreched / norm(r_vec)) .* r_vec) * c_
# simple (& faster) case where default spring length is 0
spring_force = r_vec * c_
damping_force = ((v_source - v_dest) * d)
e .= spring_force + damping_force
nothing
end
# dv=derivative of vertex variables, v=vertex,
# e_s=source edges, e_d=destination edges, p=parameters, t=time
function diffusionvertex!(dv, v, e_s, e_d, p, t)
r_displacement = unpack_displacement(v)
v_velocity = unpack_velocity(v)
fsum = (array) -> reduce((acc, elem) -> acc + elem, array, init=zeros(3))
a_acceleration = ((fsum(e_d) - fsum(e_s)) / m) + grav
dv .= [v_velocity..., a_acceleration...]
# dv[2] = acceleration[1]
nothing
end
a = zeros(6)
diffusionvertex!(a, zeros(6), [], [], nothing, 0)
### Constructing the network dynamics
# ODEVertex and StaticEdge are structs that contain additional information on the function f!, such as number of variables of the internal function (dim), the symbols of those variables, and if a mass_matrix should be used
# VertexFunction/EdgeFunction is an abstract supertype for all vertex/edge function structs in NetworkDynamics
# signature of ODEVertex: (f!, dim, mass_matrix, sym) (mass_matrix and sym are optional arguments)
nd_diffusion_vertex = ODEVertex(f! = diffusionvertex!, dim = 6)
nd_anchor = StaticVertex(f! = f! = (θ, e_s, e_d, c, t) -> θ .= zeros(6), dim=6)
# signature of StaticEdge: (f!, dim, sym) (sym is optional)
nd_diffusion_edge = StaticEdge(f! = diffusionedge!, dim = 3)
# setting up the key constructor network_dynamics
# signature of network_dynamics: (vertices!, edges!, g; parallel = false)
# parameter parallel of type bool enables a parallel environment
# returned object nd of type ODEFunction is compatible with the solvers of OrdinaryDiffEq
nd_vertecies = Array{VertexFunction}([nd_diffusion_vertex for x in range(1, stop=nv(g))])
nd_vertecies[1] = nd_anchor
nd_edges = [nd_diffusion_edge for x in range(1, stop=ne(g))]
nd = network_dynamics(nd_vertecies, nd_edges, g, parallel=true)
nd_wrapper = (dx, x, p, t) -> nd(dx, x, (nothing, p), t)
### Simulation
x0 = rand(N*6) # random initial conditions
# ODEProblem is a struct of OrdinaryDiffEq.jl
# signature:(f::ODEFunction,u0,tspan, ...)
ode_prob = ODEProblem(nd_wrapper, x0, (0., 5.), c)
# solve has signature: (prob::PDEProblem,alg::DiffEqBase.DEAlgorithm,args,kwargs)
@time sol = solve(ode_prob, Rodas3(), save_at=0.1);
### Plotting Trajectories
# vars=list of variables we want to plot, in this case we want to plot variables with symbol "v"
plot(sol[6, :], sol[7, :], sol[8, :])
plot!(sol[12, :], sol[13, :], sol[14, :])
plot!(sol[18, :], sol[19, :], sol[20, :])
### DiffEqFlux Parameter Optimization
p = c
function predict_rd()
Array(solve(ode_prob,Rodas5(),saveat=0.1,reltol=1e-4))
end
loss_rd() = sum(abs2,x-1 for x in predict_rd())
loss_rd()
opt = ADAM(0.1)
cb = function ()
display(loss_rd())
#display(plot(solve(remake(prob,p=p),Tsit5(),saveat=0.1),ylim=(0,6)))
end
Flux.train!(loss_rd, Flux.params(p), Iterators.repeated((), 100), opt, cb = cb)
### DiffEqFlux Surrogate Solving
datasize = 30
tspan = (0.0f0,1.5f0)
t = range(tspan[1],tspan[2],length=datasize)
ode_data = Array(solve(ode_prob,Rodas3(),saveat=t))
dudt2 = Chain(x -> x.^3,
Dense(2,50,tanh),
Dense(50,2))
p,re = Flux.destructure(dudt2) # use this p as the initial condition!
dudt(u,p,t) = re(p)(u) # need to restrcture for backprop!
function predict_n_ode()
Array(solve(ode_prob,Rodas5(),saveat=t))
end
function loss_n_ode()
pred = predict_n_ode()
loss = sum(abs2,ode_data .- pred)
loss
end
loss_n_ode() # n_ode.p stores the initial parameters of the neural ODE
cb = function (;doplot=false) #callback function to observe training
pred = predict_n_ode()
display(sum(abs2,ode_data .- pred))
# plot current prediction against data
pl = scatter(t,ode_data[1,:],label="data")
scatter!(pl,t,pred[1,:],label="prediction")
display(plot(pl))
return false
end
# Display the ODE with the initial parameter values.
cb()
data = Iterators.repeated((), 1000)
Flux.train!(loss_n_ode, Flux.params(x0,p), data, ADAM(0.05), cb = cb)
@ramboldio
Copy link
Author

ramboldio commented Nov 12, 2020

Current issue (when running the first occurrence of Flux.train):


ERROR: LoadError: MethodError: no method matching similar(::Float64, ::Int64)
Closest candidates are:
  similar(::VSCodeServer.JuliaInterpreter.Compiled, ::Any) at /home/lukas/.vscode/extensions/julialang.language-julia-1.0.8/scripts/packages/JuliaInterpreter/src/types.jl:7
  similar(::Array{T,N} where N, ::Int64) where T at array.jl:379
  similar(::BitArray, ::Int64...) at bitarray.jl:369
  ...
Stacktrace:
 [1] ODEAdjointProblem(::ODESolution{Float64,2,Array{Array{Float64,1},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Float64,1},1},1},ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,Float64,ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Rodas5{0,true,DefaultLinSolve,DataType},OrdinaryDiffEq.InterpolationData{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Float64,1},1},Array{Float64,1},Array{Array{Array{Float64,1},1},1},OrdinaryDiffEq.Rosenbrock5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},Array{Float64,2},Array{Float64,2},OrdinaryDiffEq.Rodas5Tableau{Float64,Float64},DiffEqBase.TimeGradientWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},Float64},DiffEqBase.UJacobianWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,Float64},DefaultLinSolve,SparseDiffTools.ForwardColorJacCache{Array{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.UJacobianWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,Float64},Float64},Float64,12},1},Array{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.UJacobianWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,Float64},Float64},Float64,12},1},Array{Float64,1},Array{Array{NTuple{12,Bool},1},1},UnitRange{Int64},Nothing},Array{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.TimeGradientWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},Float64},Float64},Float64,1},1}}},DiffEqBase.DEStats}, ::InterpolatingAdjoint{0,true,Val{:central},Bool,Bool}, ::DiffEqSensitivity.var"#df#134"{Array{Float64,2},Array{Float64,1},Colon}, ::StepRangeLen{Float32,Float64,Float64}, ::Nothing; checkpoints::Array{Float64,1}, callback::CallbackSet{Tuple{},Tuple{}}, reltol::Float64, abstol::Float64, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/lukas/.julia/packages/DiffEqSensitivity/ne6Z9/src/local_sensitivity/interpolating_adjoint.jl:170
 [2] _adjoint_sensitivities(::ODESolution{Float64,2,Array{Array{Float64,1},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Float64,1},1},1},ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,Float64,ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Rodas5{0,true,DefaultLinSolve,DataType},OrdinaryDiffEq.InterpolationData{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Float64,1},1},Array{Float64,1},Array{Array{Array{Float64,1},1},1},OrdinaryDiffEq.Rosenbrock5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},Array{Float64,2},Array{Float64,2},OrdinaryDiffEq.Rodas5Tableau{Float64,Float64},DiffEqBase.TimeGradientWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},Float64},DiffEqBase.UJacobianWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,Float64},DefaultLinSolve,SparseDiffTools.ForwardColorJacCache{Array{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.UJacobianWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,Float64},Float64},Float64,12},1},Array{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.UJacobianWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,Float64},Float64},Float64,12},1},Array{Float64,1},Array{Array{NTuple{12,Bool},1},1},UnitRange{Int64},Nothing},Array{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.TimeGradientWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},Float64},Float64},Float64,1},1}}},DiffEqBase.DEStats}, ::InterpolatingAdjoint{0,true,Val{:central},Bool,Bool}, ::Rodas5{0,true,DefaultLinSolve,DataType}, ::DiffEqSensitivity.var"#df#134"{Array{Float64,2},Array{Float64,1},Colon}, ::StepRangeLen{Float32,Float64,Float64}, ::Nothing; abstol::Float64, reltol::Float64, checkpoints::Array{Float64,1}, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/lukas/.julia/packages/DiffEqSensitivity/ne6Z9/src/local_sensitivity/sensitivity_interface.jl:17
 [3] _adjoint_sensitivities(::ODESolution{Float64,2,Array{Array{Float64,1},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Float64,1},1},1},ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,Float64,ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Rodas5{0,true,DefaultLinSolve,DataType},OrdinaryDiffEq.InterpolationData{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Float64,1},1},Array{Float64,1},Array{Array{Array{Float64,1},1},1},OrdinaryDiffEq.Rosenbrock5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},Array{Float64,2},Array{Float64,2},OrdinaryDiffEq.Rodas5Tableau{Float64,Float64},DiffEqBase.TimeGradientWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},Float64},DiffEqBase.UJacobianWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,Float64},DefaultLinSolve,SparseDiffTools.ForwardColorJacCache{Array{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.UJacobianWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,Float64},Float64},Float64,12},1},Array{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.UJacobianWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,Float64},Float64},Float64,12},1},Array{Float64,1},Array{Array{NTuple{12,Bool},1},1},UnitRange{Int64},Nothing},Array{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.TimeGradientWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},Float64},Float64},Float64,1},1}}},DiffEqBase.DEStats}, ::InterpolatingAdjoint{0,true,Val{:central},Bool,Bool}, ::Rodas5{0,true,DefaultLinSolve,DataType}, ::Function, ::StepRangeLen{Float32,Float64,Float64}, ::Nothing) at /home/lukas/.julia/packages/DiffEqSensitivity/ne6Z9/src/local_sensitivity/sensitivity_interface.jl:13 (repeats 2 times)
 [4] adjoint_sensitivities(::ODESolution{Float64,2,Array{Array{Float64,1},1},Nothing,Nothing,Array{Float64,1},Array{Array{Array{Float64,1},1},1},ODEProblem{Array{Float64,1},Tuple{Float64,Float64},true,Float64,ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem},Rodas5{0,true,DefaultLinSolve,DataType},OrdinaryDiffEq.InterpolationData{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Array{Float64,1},1},Array{Float64,1},Array{Array{Array{Float64,1},1},1},OrdinaryDiffEq.Rosenbrock5Cache{Array{Float64,1},Array{Float64,1},Array{Float64,1},Array{Float64,2},Array{Float64,2},OrdinaryDiffEq.Rodas5Tableau{Float64,Float64},DiffEqBase.TimeGradientWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},Float64},DiffEqBase.UJacobianWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,Float64},DefaultLinSolve,SparseDiffTools.ForwardColorJacCache{Array{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.UJacobianWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,Float64},Float64},Float64,12},1},Array{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.UJacobianWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Float64,Float64},Float64},Float64,12},1},Array{Float64,1},Array{Array{NTuple{12,Bool},1},1},UnitRange{Int64},Nothing},Array{ForwardDiff.Dual{ForwardDiff.Tag{DiffEqBase.TimeGradientWrapper{ODEFunction{true,var"#47#48",UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Array{Float64,1},Float64},Float64},Float64,1},1}}},DiffEqBase.DEStats}, ::Rodas5{0,true,DefaultLinSolve,DataType}, ::Vararg{Any,N} where N; sensealg::InterpolatingAdjoint{0,true,Val{:central},Bool,Bool}, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/lukas/.julia/packages/DiffEqSensitivity/ne6Z9/src/local_sensitivity/sensitivity_interface.jl:6
 [5] (::DiffEqSensitivity.var"#adjoint_sensitivity_backpass#133"{Rodas5{0,true,DefaultLinSolve,DataType},InterpolatingAdjoint{0,true,Val{:central},Bool,Bool},Array{Float64,1},Float64,Tuple{},Colon})(::Array{Float64,2}) at /home/lukas/.julia/packages/DiffEqSensitivity/ne6Z9/src/local_sensitivity/concrete_solve.jl:144
 [6] #694#back at /home/lukas/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:55 [inlined]
 [7] #150 at /home/lukas/.julia/packages/Zygote/c0awc/src/lib/lib.jl:191 [inlined]
 [8] (::Zygote.var"#1693#back#152"{Zygote.var"#150#151"{DiffEqBase.var"#694#back#474"{DiffEqSensitivity.var"#adjoint_sensitivity_backpass#133"{Rodas5{0,true,DefaultLinSolve,DataType},InterpolatingAdjoint{0,true,Val{:central},Bool,Bool},Array{Float64,1},Float64,Tuple{},Colon}},Tuple{NTuple{6,Nothing},Tuple{Nothing}}}})(::Array{Float64,2}) at /home/lukas/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:49
 [9] #solve#460 at /home/lukas/.julia/packages/DiffEqBase/V7P18/src/solve.jl:102 [inlined]
 [10] (::typeof(∂(#solve#460)))(::Array{Float64,2}) at /home/lukas/.julia/packages/Zygote/c0awc/src/compiler/interface2.jl:0
 [11] (::Zygote.var"#150#151"{typeof(∂(#solve#460)),Tuple{NTuple{6,Nothing},Tuple{Nothing}}})(::Array{Float64,2}) at /home/lukas/.julia/packages/Zygote/c0awc/src/lib/lib.jl:191
 [12] (::Zygote.var"#1693#back#152"{Zygote.var"#150#151"{typeof(∂(#solve#460)),Tuple{NTuple{6,Nothing},Tuple{Nothing}}}})(::Array{Float64,2}) at /home/lukas/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:49
 [13] (::typeof(∂(solve##kw)))(::Array{Float64,2}) at /home/lukas/.julia/packages/Zygote/c0awc/src/compiler/interface2.jl:0
 [14] predict_n_ode at /home/lukas/Documents/HPI SS20/trussspring/julia_poc23.jl:134 [inlined]
 [15] (::typeof(∂(predict_n_ode)))(::Array{Float64,2}) at /home/lukas/.julia/packages/Zygote/c0awc/src/compiler/interface2.jl:0
 [16] loss_n_ode at /home/lukas/Documents/HPI SS20/trussspring/julia_poc23.jl:138 [inlined]
 [17] (::typeof(∂(loss_n_ode)))(::Float64) at /home/lukas/.julia/packages/Zygote/c0awc/src/compiler/interface2.jl:0
 [18] #150 at /home/lukas/.julia/packages/Zygote/c0awc/src/lib/lib.jl:191 [inlined]
 [19] #1693#back at /home/lukas/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:49 [inlined]
 [20] #15 at /home/lukas/.julia/packages/Flux/q3zeA/src/optimise/train.jl:103 [inlined]
 [21] (::Zygote.var"#54#55"{Params,Zygote.Context,typeof(∂(#15))})(::Float64) at /home/lukas/.julia/packages/Zygote/c0awc/src/compiler/interface.jl:177
 [22] gradient(::Function, ::Params) at /home/lukas/.julia/packages/Zygote/c0awc/src/compiler/interface.jl:54
 [23] macro expansion at /home/lukas/.julia/packages/Flux/q3zeA/src/optimise/train.jl:102 [inlined]
 [24] macro expansion at /home/lukas/.julia/packages/Juno/n6wyj/src/progress.jl:134 [inlined]
 [25] train!(::Function, ::Params, ::Base.Iterators.Take{Base.Iterators.Repeated{Tuple{}}}, ::ADAM; cb::var"#55#57") at /home/lukas/.julia/packages/Flux/q3zeA/src/optimise/train.jl:100
 [26] top-level scope at /home/lukas/Documents/HPI SS20/trussspring/julia_poc23.jl:159
 [27] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091
 [28] invokelatest(::Any, ::Any, ::Vararg{Any,N} where N; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at ./essentials.jl:710
 [29] invokelatest(::Any, ::Any, ::Vararg{Any,N} where N) at ./essentials.jl:709
 [30] inlineeval(::Module, ::String, ::Int64, ::Int64, ::String; softscope::Bool) at /home/lukas/.vscode/extensions/julialang.language-julia-1.0.8/scripts/packages/VSCodeServer/src/eval.jl:83
 [31] (::VSCodeServer.var"#43#45"{VSCodeServer.ReplRunCodeRequestParams,String,Int64,Int64,String,Module,Bool})() at /home/lukas/.vscode/extensions/julialang.language-julia-1.0.8/scripts/packages/VSCodeServer/src/eval.jl:45
 [32] withpath(::VSCodeServer.var"#43#45"{VSCodeServer.ReplRunCodeRequestParams,String,Int64,Int64,String,Module,Bool}, ::String) at /home/lukas/.vscode/extensions/julialang.language-julia-1.0.8/scripts/packages/VSCodeServer/src/repl.jl:118
 [33] (::VSCodeServer.var"#42#44"{VSCodeServer.ReplRunCodeRequestParams,String,Int64,Int64,String,Module,Bool,Bool})() at /home/lukas/.vscode/extensions/julialang.language-julia-1.0.8/scripts/packages/VSCodeServer/src/eval.jl:43
 [34] hideprompt(::VSCodeServer.var"#42#44"{VSCodeServer.ReplRunCodeRequestParams,String,Int64,Int64,String,Module,Bool,Bool}) at /home/lukas/.vscode/extensions/julialang.language-julia-1.0.8/scripts/packages/VSCodeServer/src/repl.jl:36
 [35] repl_runcode_request(::VSCodeServer.JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint,Base.PipeEndpoint}, ::VSCodeServer.ReplRunCodeRequestParams) at /home/lukas/.vscode/extensions/julialang.language-julia-1.0.8/scripts/packages/VSCodeServer/src/eval.jl:23
 [36] dispatch_msg(::VSCodeServer.JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint,Base.PipeEndpoint}, ::VSCodeServer.JSONRPC.MsgDispatcher, ::Dict{String,Any}) at /home/lukas/.vscode/extensions/julialang.language-julia-1.0.8/scripts/packages/JSONRPC/src/typed.jl:66
 [37] macro expansion at /home/lukas/.vscode/extensions/julialang.language-julia-1.0.8/scripts/packages/VSCodeServer/src/VSCodeServer.jl:95 [inlined]
 [38] (::VSCodeServer.var"#61#63"{Bool,String})() at ./task.jl:356
in expression starting at /home/lukas/Documents/HPI SS20/trussspring/julia_poc23.jl:159

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment