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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZeroMean{Float64} is not callable #14

Closed
theogf opened this issue Jun 25, 2020 · 8 comments
Closed

ZeroMean{Float64} is not callable #14

theogf opened this issue Jun 25, 2020 · 8 comments

Comments

@theogf
Copy link
Member

theogf commented Jun 25, 2020

So diligently using ColVecs 馃槃 I faced the following bug when trying to optimize kernel parameters. Here is the MWE

using AbstractGPs, KernelFunctions, Flux
X = rand(2, 10)
y = rand(10)
l = rand(2)
k = transform(SqExponentialKernel(), l)
Flux.gradient(Flux.params(k)) do
    m = GP(k)(KernelFunctions.ColVecs(X), 0.01)
    logpdf(m, y)
end

And get the error LoadError: MethodError: objects of type AbstractGPs.ZeroMean{Float64} are not callable

One additional note : KernelFunctions and ColVecs/RowVecs should be exported.

@willtebbutt
Copy link
Member

This will be resolved by #16 -- just need to wait for Flux to allow Zygote 0.5 .

@theogf
Copy link
Member Author

theogf commented Jul 23, 2020

I am afraid this is still not working with AbstractGPs 0.2.3, Flux 0.11.0 and Zygote 0.5.3.
The rrule you defined never seems to be called...

@willtebbutt
Copy link
Member

Same error?

@theogf
Copy link
Member Author

theogf commented Jul 23, 2020

Yes :

ERROR: MethodError: objects of type AbstractGPs.ZeroMean{Float64} are not callable
Stacktrace:
 [1] macro expansion at /home/theo/.julia/packages/Zygote/iFibI/src/compiler/interface2.jl:0 [inlined]
 [2] _pullback(::Zygote.Context, ::AbstractGPs.ZeroMean{Float64}, ::SubArray{Float64,1,Array{Float64,2},Tuple{Base.Slice{Base.OneTo{Int64}},Int64},true}) at /home/theo/.julia/packages/Zygote/iFibI/src/compiler/interface2.jl:13
 [3] (::Zygote.var"#586#590"{Zygote.Context,AbstractGPs.ZeroMean{Float64}})(::SubArray{Float64,1,Array{Float64,2},Tuple{Base.Slice{Base.OneTo{Int64}},Int64},true}) at /home/theo/.julia/packages/Zygote/iFibI/src/lib/array.jl:176
 [4] iterate at ./generator.jl:47 [inlined]
 [5] _collect at ./array.jl:678 [inlined]
 [6] collect_similar at ./array.jl:607 [inlined]
 [7] map at ./abstractarray.jl:2072 [inlined]
 [8] 鈭噈ap at /home/theo/.julia/packages/Zygote/iFibI/src/lib/array.jl:176 [inlined]
 [9] adjoint at /home/theo/.julia/packages/Zygote/iFibI/src/lib/array.jl:191 [inlined]
 [10] _pullback at /home/theo/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:47 [inlined]
 [11] mean at /home/theo/.julia/dev/AbstractGPs/src/gp/gp.jl:67 [inlined]

@willtebbutt
Copy link
Member

Could you also provide your completely ] st?

@theogf
Copy link
Member Author

theogf commented Jul 23, 2020

(@v1.4) pkg> st Zygote Flux AbstractGPs ChainRulesCore
Status `~/.julia/environments/v1.4/Project.toml`
  [99985d1d] AbstractGPs v0.2.3 [`~/.julia/dev/AbstractGPs`]
  [d360d2e6] ChainRulesCore v0.9.5
  [587475ba] Flux v0.11.0
  [e88e6eb3] Zygote v0.5.3

@theogf
Copy link
Member Author

theogf commented Nov 3, 2020

Hey back to this beautiful topic. As in KernelFunctions.jl, replacing Base.map by _map everywhere solves the problem.
I know it's not the best way but at least it works. What do you think @willtebbutt, should I make a PR to correct it?

@willtebbutt
Copy link
Member

A PR would be welcome for now I reckon -- it continues to make me very sad, but I don't think that we have a better solution right now.

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

2 participants