-
Notifications
You must be signed in to change notification settings - Fork 149
Why is seeding ydual
necessary?
#740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
MWE of the error: julia> using ForwardDiff
julia> x = BigFloat[1, 2]
2-element Vector{BigFloat}:
1.0
2.0
julia> y = similar(x)
2-element Vector{BigFloat}:
#undef
#undef
julia> ForwardDiff.jacobian(copyto!, y, x)
ERROR: UndefRefError: access to undefined reference
Stacktrace:
[1] getindex
@ ./essentials.jl:917 [inlined]
[2] _broadcast_getindex
@ ./broadcast.jl:644 [inlined]
[3] _getindex
@ ./broadcast.jl:674 [inlined]
[4] _broadcast_getindex
@ ./broadcast.jl:650 [inlined]
[5] getindex
@ ./broadcast.jl:610 [inlined]
[6] macro expansion
@ ./broadcast.jl:973 [inlined]
[7] macro expansion
@ ./simdloop.jl:77 [inlined]
[8] copyto!
@ ./broadcast.jl:972 [inlined]
[9] copyto!
@ ./broadcast.jl:925 [inlined]
[10] materialize!
@ ./broadcast.jl:883 [inlined]
[11] materialize!
@ ./broadcast.jl:880 [inlined]
[12] seed!(duals::Vector{ForwardDiff.Dual{…}}, x::Vector{BigFloat}, seed::ForwardDiff.Partials{2, BigFloat})
@ ForwardDiff ~/.julia/packages/ForwardDiff/UBbGT/src/apiutils.jl:45
[13] seed!
@ ~/.julia/packages/ForwardDiff/UBbGT/src/apiutils.jl:45 [inlined]
[14] vector_mode_dual_eval!
@ ~/.julia/packages/ForwardDiff/UBbGT/src/apiutils.jl:30 [inlined]
[15] vector_mode_jacobian(f!::typeof(copyto!), y::Vector{…}, x::Vector{…}, cfg::ForwardDiff.JacobianConfig{…})
@ ForwardDiff ~/.julia/packages/ForwardDiff/UBbGT/src/jacobian.jl:139
[16] jacobian
@ ~/.julia/packages/ForwardDiff/UBbGT/src/jacobian.jl:40 [inlined]
[17] jacobian(f!::typeof(copyto!), y::Vector{…}, x::Vector{…}, cfg::ForwardDiff.JacobianConfig{…})
@ ForwardDiff ~/.julia/packages/ForwardDiff/UBbGT/src/jacobian.jl:37
[18] jacobian(f!::typeof(copyto!), y::Vector{BigFloat}, x::Vector{BigFloat})
@ ForwardDiff ~/.julia/packages/ForwardDiff/UBbGT/src/jacobian.jl:37
[19] top-level scope
@ REPL[5]:1
Some type information was truncated. Use `show(err)` to see complete types. |
Maybe to zero out partials from possible previous invocations ( |
Oh right, because if Any idea how to stop it from erroring in the MWE above? |
Closing as a duplicate of #436. |
#743 seems to fix it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are some lines in the code that I don't understand, essentially all the ones that show up here:
https://github.com/search?q=repo%3AJuliaDiff%2FForwardDiff.jl%20seed!(y&type=code
Why would we need to set the dual numbers inside
ydual
to a specific value, before overwriting them withf!(ydual, xdual)
? Can we just get rid of these steps?This is causing issues when
y
has non-bitstype elements, because they may not be initialized the first time thatjacobian
is called.Related:
The text was updated successfully, but these errors were encountered: