Skip to content

Commit 61870b3

Browse files
Update Flux.md (#506)
Minor mistake in the documentation at https://diffeqflux.sciml.ai/stable/Flux/#Using-Flux-Chain-neural-networks-with-Flux.train!-1 it had following missing lines, without which it would result in `UndefVarError: p not defined` ``` p,re = Flux.destructure(dudt2) # use this p as the initial condition! dudt(u,p,t) = re(p)(u) # need to restrcture for backprop! ```
1 parent 0b6cf2b commit 61870b3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/src/Flux.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ ode_data = Array(solve(prob,Tsit5(),saveat=t))
2727
dudt2 = Chain(x -> x.^3,
2828
Dense(2,50,tanh),
2929
Dense(50,2))
30-
dudt(u,p,t) = dudt2(u)
30+
p,re = Flux.destructure(dudt2) # use this p as the initial condition!
31+
dudt(u,p,t) = re(p)(u) # need to restrcture for backprop!
3132
prob = ODEProblem(dudt,u0,tspan)
3233

3334
function predict_n_ode()

0 commit comments

Comments
 (0)