Open ilysym opened 4 years ago
There's something unexpected happening with variable assignment with Zygote.
Using the copy(t0)
results in expected behavior:
function fn_broken(t0, τ, duration)
x = 1.0
t = copy(t0)
while t < t0 + duration
x += -τ*x
t += 0.01
println("t: ", t, " | t0: ", t0)
end
x
end
If the copy
is removed, the the printing shows that forward call still behaves appropriately (f_broken_fixed(0.01)
), but the diff shows that t0 is tracking the value of t
, resulting in an infinite loop.