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
I can make the dual type leak out into a global variable:
julia>functionf(x)
global y =sin(x)
end
f (generic function with 1 method)
julia> ForwardDiff2.D(f)(1)*10.5403023058681398
julia> y
(0.8414709848078965+0.5403023058681398ϵ₁)
Presumably this can happen any time a differentiated value escapes the program, e.g. when you have a global cache or similar.
The text was updated successfully, but these errors were encountered:
FWIW, this is not just academic since it can lead to bad gradients (effectively a form of perturbation confusion). For example:
julia>functionf(x)
global y =sin(x)
end
f (generic function with 1 method)
julia>g(x) = x+y
g (generic function with 1 method)
julia> ForwardDiff2.D(f)(2)*1-0.4161468365471424
julia> ForwardDiff2.D(g)(2)*10.5838531634528576
This is a little contrived, but a function that updates and uses a global cache in some way could follow the same pattern and get silent incorrect gradients.
I can make the dual type leak out into a global variable:
Presumably this can happen any time a differentiated value escapes the program, e.g. when you have a global cache or similar.
The text was updated successfully, but these errors were encountered: