Skip to content
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

Error when moving from v0.6.43 to v0.6.44 #1304

Open
vikram-s-narayan opened this issue Sep 8, 2022 · 0 comments
Open

Error when moving from v0.6.43 to v0.6.44 #1304

vikram-s-narayan opened this issue Sep 8, 2022 · 0 comments

Comments

@vikram-s-narayan
Copy link

vikram-s-narayan commented Sep 8, 2022

If the following code is run with Zygote v0.6.43 it works fine.

using Surrogates
using Zygote

n = 10
d = 2
lb = [0.0, 0.0]
ub = [5.0, 5.0]
x = sample(n, lb, ub, SobolSample())
f = x -> x[1]^2 + x[2]^2
y = f.(x)
my_gek_ND = GEK(x, y, lb, ub)
g = x -> Zygote.gradient(my_gek_ND, x)
g((2.0, 5.0)) 

However, if we move to Zygote v0.6.44, it generates the following error message:


ERROR: MethodError: no method matching +(::NamedTuple{(:x, :y, :lb, :ub, :p, :theta, :mu, :b, :sigma, :inverse_of_R), Tuple{Vector{Tuple{Float64, Float64}}, Nothing, Nothing, Nothing, Vector{Float64}, Vector{Float64}, Nothing, Matrix{Float64}, Nothing, Nothing}}, ::Base.RefValue{Any})
Closest candidates are:
  +(::Any, ::Any, ::Any, ::Any...) at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/base/operators.jl:655
  +(::ChainRulesCore.AbstractThunk, ::Any) at ~/.julia/packages/ChainRulesCore/ctmSK/src/tangent_arithmetic.jl:122
  +(::ChainRulesCore.Tangent{P}, ::P) where P at ~/.julia/packages/ChainRulesCore/ctmSK/src/tangent_arithmetic.jl:146
  ...
Stacktrace:
  [1] accum(x::NamedTuple{(:x, :y, :lb, :ub, :p, :theta, :mu, :b, :sigma, :inverse_of_R), Tuple{Vector{Tuple{Float64, Float64}}, Nothing, Nothing, Nothing, Vector{Float64}, Vector{Float64}, Nothing, Matrix{Float64}, Nothing, Nothing}}, y::Base.RefValue{Any})
    @ Zygote ~/.julia/packages/Zygote/xGkZ5/src/lib/lib.jl:17
  [2] accum(::NamedTuple{(:x, :y, :lb, :ub, :p, :theta, :mu, :b, :sigma, :inverse_of_R), Tuple{Vector{Tuple{Float64, Float64}}, Nothing, Nothing, Nothing, Vector{Float64}, Vector{Float64}, Nothing, Matrix{Float64}, Nothing, Nothing}}, ::Base.RefValue{Any}, ::Nothing, ::Vararg{Nothing})
    @ Zygote ~/.julia/packages/Zygote/xGkZ5/src/lib/lib.jl:22
  [3] getindex
    @ ./tuple.jl:29 [inlined]
  [4] gradindex
    @ ~/.julia/packages/Zygote/xGkZ5/src/compiler/reverse.jl:12 [inlined]
  [5] Pullback
    @ ~/Documents/julia-projects/Surrogates.jl/src/GEK.jl:198 [inlined]
  [6] (::typeof(∂(λ)))(Δ::Float64)
    @ Zygote ~/.julia/packages/Zygote/xGkZ5/src/compiler/interface2.jl:0
  [7] (::Zygote.var"#60#61"{typeof(∂(λ))})(Δ::Float64)
    @ Zygote ~/.julia/packages/Zygote/xGkZ5/src/compiler/interface.jl:45
  [8] gradient(f::Function, args::Tuple{Float64, Float64})
    @ Zygote ~/.julia/packages/Zygote/xGkZ5/src/compiler/interface.jl:97
  [9] (::var"#7#8")(x::Tuple{Float64, Float64})
    @ Main ~/Documents/julia-projects/Surrogates.jl/test/playground.jl:12
 [10] top-level scope
    @ ~/Documents/julia-projects/Surrogates.jl/test/playground.jl:13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant