-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
test fails on Julia 1.8 #93
Comments
On v1.8 with the latest Integrals this outputs: julia > dlb1, dub1, dp1 = Zygote.gradient(testf, lb, ub, p)
(-0.9092974268256817, -0.27941549819892586, -0.4091435516769757) |
I'm having the same issue in Julia 1.8.5. What version of Julia and versions of Zygote and Integrals was this working under? |
The example is incorrect. Corrected: using Integrals, Zygote
f(x, p) = sum(sin.(p * x))
lb = 1.0
ub = 3.0
p = 2.0
function testf(lb, ub, p)
prob = IntegralProblem(f, lb, ub, p)
sin(solve(prob, QuadGKJL(), reltol = 1e-3, abstol = 1e-3)[1])
end
dlb1, dub1, dp1 = Zygote.gradient(testf, lb, ub, p) The difference is If you have an example that' supposed to work, please open a new issue. |
? that's the problem though julia> p = [2.0]
1-element Vector{Float64}:
2.0
julia> function testf(lb, ub, p)
prob = IntegralProblem(f, lb, ub, p)
sin(solve(prob, QuadGKJL(), reltol = 1e-3, abstol = 1e-3)[1])
end
testf (generic function with 1 method)
julia> dlb1, dub1, dp1 = Zygote.gradient(testf, lb, ub, p)
ERROR: BoundsError: attempt to access 0-element Vector{Any} at index []
Stacktrace:
[1] throw_boundserror(A::Vector{Any}, I::Tuple{})
@ Base ./abstractarray.jl:744
[2] checkbounds
@ ./abstractarray.jl:709 [inlined]
[3] _getindex
@ ./abstractarray.jl:1326 [inlined]
[4] getindex
@ ./abstractarray.jl:1294 [inlined]
[5] macro expansion
@ ~/.julia/packages/Zygote/SuKWp/src/lib/lib.jl:314 [inlined]
[6] (::Zygote.Jnew{Base.MethodList, Vector{Any}, false})(Δ::Nothing)
@ Zygote ~/.julia/packages/Zygote/SuKWp/src/lib/lib.jl:308 also Zygote can handle this: julia> p = [2.0]
1-element Vector{Float64}:
2.0
julia> Zygote.gradient(f, 30, p)
(-1.9048259608303126, [-28.57238941245469])
julia> p = 2.0
2.0
julia> Zygote.gradient(f, 30, p)
(-1.9048259608303126, -28.57238941245469) |
Hi All, Thanks for the help with this. Here is a simple example: ` lb = 1.0 function testf(lb, ub, p) dlb1, dub1, dp1 = Zygote.gradient(testf, lb, ub, p) I get "ERROR: BoundsError: attempt to access 0-element Vector{Any} at index []" |
Also, the example at https://docs.juliahub.com/Integrals/QIwht/3.1.1/tutorials/differentiating_integrals/ creates the same error for Zygote, but works fine for ForwardDiff and and FiniteDiff (I had to replace CubaCuhre with HCubatureJL). This is true using either Integrals 3.1.1 (which is the version listed at that page) and 3.7. |
@ArnoStrouwen does that already have an issue? |
I think it is this issue #99? |
The text was updated successfully, but these errors were encountered: