# Flux 0.10.0 does not update function definitions in Jupyter

**URL:** <https://discourse.julialang.org/t/flux-0-10-0-does-not-update-function-definitions-in-jupyter/33261>\
**Category:** Machine Learning\
**Tags:** jupyter, flux, zygote\
**Created:** [January 12, 2020, 5:57am UTC](https://discourse.julialang.org/t/flux-0-10-0-does-not-update-function-definitions-in-jupyter/33261 "2020-01-12T05:57:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RM314](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@RM314](https://discourse.julialang.org/u/RM314)\
**Post date:** [January 12, 2020, 5:57am UTC](https://discourse.julialang.org/t/flux-0-10-0-does-not-update-function-definitions-in-jupyter/33261/1 "2020-01-12T05:57:58Z")

</div>

I stumbled onto this behaviour recently and I’m unsure if it’s intentional, or what to do about it. If I update a function definition, invocations of gradient() seem to use the old definition even as the rest of the notebook sees the update.

I am using Julia 1.1.1, Flux 0.10.0, Zygote 0.4.5, and IJulia 1.20.0.

Running a cell with

```julia
using Revise
using Flux

function f(x)
    return x[1]^2
end

x=[3]
gds = gradient(() -> f(x), params(x))
gds.grads

```

will work correctly. If I change f to return x[1]^3, instead it will not. The gradient invocation will still work off the old definition, even though the rest of the notebook sees the new one. Is this intentional? Is there a command I can use to force Flux/Zygote to recompile the function without restarting the kernel entirely?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [January 12, 2020, 10:39am UTC](https://discourse.julialang.org/t/flux-0-10-0-does-not-update-function-definitions-in-jupyter/33261/2 "2020-01-12T10:39:42Z")

</div>

You need Julia 1.3 for this to work automatically. I think `Zygote.refresh()` is the manual way.
